Hi Leute,
Ich will euch mal mein Admin filterscripts geben schaut es euch einfach an bei Fragen oder Anregungen einfach bescheit sagen.
Ihr braucht zusätzlich noch das include ocmd,dini,sscanf
stock isPlayerAnAdmin(playerid,rang)
{
if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
return 0;
}
ocmd:setadmin(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID, rank;
if(sscanf(params,"ui",pID,rank))return SendClientMessage(playerid,ROT,"/setadmin [id] [lvl]");
if(rank<1||rank>5)return SendClientMessage(playerid,ROT,"The rank don't exists");
SetPVarInt(pID,"Adminlevel",rank);
SpielerSpeichern(pID);
SendClientMessageToAll(BLAU,"A player is now an admin");
return 1;
}
ocmd:ann(playerid,params[])
{
new text, string[128 + MAX_PLAYER_NAME];
if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You must be an admin lvl 1!");
if(sscanf(params,"s",text))return SendClientMessage(playerid,ROT,"Using: /ann [text]");
format(string, sizeof(string), "%s",text);
GameTextForAll(string,5000,6);
return 1;
}
ocmd:goto(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID;
if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"The admin %s teleported to you",name);
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(pID,pname,sizeof(pname));
format(string1,sizeof(string1),"You've teleported to %s",pname);
new Float:x,Float:y,Float:z;
GetPlayerPos(pID,x,y,z);
SetPlayerPos(playerid,x+2,y,z);
return 1;
}
ocmd:jail(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID;
if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"The admin %s jailed you",name);
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(pID,pname,sizeof(pname));
format(string1,sizeof(string1),"You've jailed %s",pname);
SetPVarInt(playerid,"jailed",1);
SetPlayerInterior(pID, 3);
SetPlayerPos(pID, 197.6661, 173.8179, 1003.0234);
return 1;
}
ocmd:unjail(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID;
if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/goto [id]");
if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"The admin %s unjailed you",name);
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(pID,pname,sizeof(pname));
format(string1,sizeof(string1),"You've unjailed %s",pname);
SetPVarInt(playerid,"jailed",0);
SetPlayerInterior(pID,0);
SetPlayerPos(pID, -62.1489,-1117.5663,1.0781);
return 1;
}
ocmd:warn(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,BLAU,"Du musst admin lvl 2 sein !");
new string1[128],pID,pname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],text[128],string2[128];
if(sscanf(params,"us",pID,text))return SendClientMessage(playerid,ROT,"Usage:/warn [id] [reason]");
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(pID,pname,sizeof(pname));
SetPVarInt(pID,"warn",GetPVarInt(pID,"warn") + 1);
SpielerSpeichern(pID);
format(string1,sizeof(string1),"Admin %s warned %s reason: %s",name,pname,text);
format(string2,sizeof(string2),"Admin %s warned you reason : %s",name,text);
GameTextForPlayer(playerid,string2,10000,5);
SendClientMessageToAll(BLAU,string1);
SetTimer("warns",5000,0);
if(GetPVarInt(pID,"warn")>= 3)
{
SetPVarInt(pID,"warn",0);
SpielerSpeichern(pID);
SendClientMessage(pID,ROT,"You got 3 warnings and be kicked!");
Kick(pID);
}
return 1;
}
ocmd:gethere(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID;
if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/gethere [id]");
if(!IsPlayerConnected(playerid))return SendClientMessage(playerid,ROT,"The player has not connected!");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"You've been teleported to %s",name);
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(pID,pname,sizeof(pname));
format(string1,sizeof(string1),"You've get %s to you",pname);
SendClientMessage(playerid,BLAU,string1);
SendClientMessage(pID,BLAU,string);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(pID,x+2,y,z);
return 1;
}
stock adminschleife(string1[128],rang)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(isPlayerAnAdmin(i,rang))
{
SendClientMessage(i,BLAU,string1);
}
}
return 1;
}
stock SendAdminMessage(rang,color,message[])
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(isPlayerAnAdmin(i,rang))
{
SendClientMessage(i,color,message);
}
}
return 1;
}
ocmd:smta(playerid,params[])
{
if(GetPVarInt(playerid,"jailed")== 1)return SendClientMessage(playerid,ROT,"You can't use commands if you're jailed!");
{
new text[MAX_PLAYER_NAME];
if(sscanf(params,"s",text))return SendClientMessage(playerid,ROT,"/smta [text]");
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(string1,sizeof(string1),"Admin Message recieved from %s.Text:%s",pname,text);
SendAdminMessage(1,ROT,string1);
}
return 1;
}
ocmd:report(playerid,params[])
{
if(GetPVarInt(playerid,"jailed")== 1)return SendClientMessage(playerid,ROT,"You can't use commands if you're jailed!");
{
new pID, text[MAX_PLAYER_NAME];
if(sscanf(params,"us",pID,text))return SendClientMessage(playerid,ROT,"/report [id] [text]");
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new name[MAX_PLAYER_NAME];
GetPlayerName(pID,name,sizeof(name));
new string1[128];
format(string1,sizeof(string1),"%s reported %s with the text : %s",pname,name,text);
adminschleife(string1,1);
}
return 1;
}
ocmd:slap(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5");
new pID;
if(sscanf(params,"u",pID))return SendClientMessage(playerid,ROT,"/slap [id]");
if(!IsPlayerConnected(pID))return SendClientMessage(playerid,ROT,"The player has not connected!");
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"You've been teleported to %s",name);
new string1[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(pID,pname,sizeof(pname));
format(string1,sizeof(string1),"You've get %s to you",pname);
SendClientMessage(playerid,BLAU,string1);
SendClientMessage(pID,BLAU,string);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(pID,x+2,y,z+100);
return 1;
}
ocmd:ban(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,4))return SendClientMessage(playerid,ROT,"You are not admin lvl 4");
new pID, reason[128],string[128];
if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/ban [id] [reason]");
format(string,sizeof(string),"AdmCmd: %s has benn banned from admin %s. Reason: %s",SpielerName(pID),SpielerName(playerid),reason);
SendClientMessageToAll(ROT,string);
SetPVarInt(pID,"Baned",1);
Kick(pID);
return 1;
}
ocmd:kick(playerid,params[])
{
if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You are not admin lvl 1");
new pID, reason[128],string[128];
if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,BLAU,"/kick [id] [reason]");
format(string,sizeof(string),"AdmCmd: %s has been kicked from admin %s Reason: %s",SpielerName(pID),SpielerName(playerid),reason);
SendClientMessageToAll(ROT,string);
Kick(pID);
return 1;
}
ocmd:unfreeze(playerid,params[])
{
new pid;
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
if(sscanf(params,"u",pid)) return SendClientMessage(playerid,BLAU,"Using:/freeze [ID]");
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid,BLAU,"This player don't connected!");
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 3!");
TogglePlayerControllable(pid,1);
SendClientMessage(pid,BLAU,"You are beeing unfreezed");
SendClientMessage(playerid,BLAU,"You unfreezd the player");
return 1;
}
ocmd:giveweapon(playerid,params[])
{
new pID,
string[128],
string2[128],
weapon,
ammunation;
if(sscanf(params,"udd",pID,weapon,ammunation)) return SendClientMessage(playerid,ROT,"Using:/giveweapon [ID] [weapon] [Ammunation]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,ROT,"This player don't connected!");
if(!isPlayerAnAdmin(playerid,5))return SendClientMessage(playerid,ROT,"You are not admin lvl 5!");
format(string,sizeof(string),"You gave %s a weapon",SpielerName(pID));
format(string2,sizeof(string2),"You gave from %s a weapon",SpielerName(pID));
GivePlayerWeapon(pID,weapon,ammunation);
SendClientMessage(playerid,ROT,string);
SendClientMessage(pID,ROT,string2);
return 1;
}
ocmd:freeze(playerid,params[])
{
new pid;
if(sscanf(params,"u",pid)) return SendClientMessage(playerid,ROT,"Using:/freeze [ID]");
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid,ROT,"This player don't conneceted");
if(!isPlayerAnAdmin(playerid,2))return SendClientMessage(playerid,ROT,"You are not admin lvl 2!");
TogglePlayerControllable(pid,0);
SendClientMessage(pid,BLAU,"You've being freezed!");
SendClientMessage(playerid,BLAU,"You freezed a player");
return 1;
}
ocmd:spawncar(playerid,params[])
{
new mid,c1,c2,vehicleid1;
if(sscanf(params,"ddd",mid,c1,c2)) return SendClientMessage(playerid,ROT,"Using: /spawncar [ModelID] [Color1] [Color2]");
if(!isPlayerAnAdmin(playerid,1))return SendClientMessage(playerid,ROT,"You are not admin lvl 1!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
vehicleid1 = CreateVehicle(mid,x,y,z+10,0,c1,c2,-1);
PutPlayerInVehicle(playerid,vehicleid1,0);
SendClientMessage(playerid,BLAU,"You've spawned a car");
return 1;
}
so bei eurem SpielerSpeichern müsst ihr dann noch:
dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
dini_IntSet(Spielerdatei,"warn",GetPVarInt(playerid,"warn"));
dini_IntSet(Spielerdatei,"Baned",GetPVarInt(playerid,"Baned"));
bei Spielerladen:
SetPVarInt(playerid,"jobs",dini_Int(Spielerdatei,"jobs"));
SetPVarInt(playerid,"Baned",dini_Int(Spielerdatei,"Baned"));
SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));
und bei onplayerceonnect:
if(GetPVarInt(playerid,"Baned")==1)return Kick(playerid);