Mit Enum:
dcmd_warn(playerid,params[])
{
new Reason[256],pID;
if(Player[playerid][admin] < 1))return SendClientMessage(playerid,COLOR_RED,"Du bist kein Moderator/Admin!");
if(sscanf(params,"us",pID,Reason))return SendClientMessage(playerid,COLOR_RED,"FEHLER: /kick [spielerid] [grund]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"SpielerID nicht gefunden!");
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(pID,name,sizeof(name));
new Aname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Aname,sizeof(Aname));
format(string,sizeof(string),"Admin %s hat %s verwarnt, Grund: %s",Aname,name,Reason);
SendClientMessageToAll(COLOR_RED,string);
if(SpielerInfo[pID][WARNVARIABLE] == 3)
{
Kick(pID);
}
return 1;
}
Oder aber mit PVars:
dcmd_warn(playerid,params[])
{
new Reason[256],pID;
if(Player[playerid][admin] < 1))return SendClientMessage(playerid,COLOR_RED,"Du bist kein Moderator/Admin!");
if(sscanf(params,"us",pID,Reason))return SendClientMessage(playerid,COLOR_RED,"FEHLER: /kick [spielerid] [grund]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"SpielerID nicht gefunden!");
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(pID,name,sizeof(name));
new Aname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Aname,sizeof(Aname));
format(string,sizeof(string),"Admin %s hat %s verwarnt, Grund: %s",Aname,name,Reason);
SendClientMessageToAll(COLOR_RED,string);
if(GetPVarInt(pID,"WARNVARIABLE")==3)
{
Kick(pID);
}
return 1;
}
Und dann halt bei OnPlayerDisconnect:
SpielerInfo[pID][WARNVARIABLE] == 0;
Oder:
SetPVarInt(pID,"Warnvariable",0);