21.07.2016, 15:18
I'm trying to make a warning system, that kicks a player when he reaches 3 warns.
I've currently wrote this, but it seems like the code is not working.
I've currently wrote this, but it seems like the code is not working.
Код:
CMD:warn(playerid, params[])
{
new str[128], lookupid, reason[128];
if(pData[playerid][Admin] > 3)
{
if(sscanf(params, "us",lookupid, reason)) return SendClientMessage(playerid ,COLOR_WHITE, "[Admin]:/warn [ID/Name] [Reason]");
if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid, COLOR_WHITE, "[Error]: This Player is not connected.");
format(str, sizeof(str), "[Admin]: %s(%d) has warned %s(%d) Reason: %s", GetName(playerid), playerid, GetName(lookupid),lookupid,reason);
SendClientMessageToAll(COLOR_WHITE, str);
pData[lookupid][Warns] + 1;
SavePlayerData(lookupid);
return 1;
}
if(pData[lookupid][Warns] = 3)
{
Kick(lookupid);
return 1;
}
else return SendClientMessage(playerid, COLOR_WHITE, "[Error]: You are not authorized to use this command.");
}

