CMD Help [DINI][sscanf]
#4

Add pWarns.

So each time you warn him/her the warn will be added

Example

pWarns

add this when you warn him/her
pWarns[playerid]++;

And add for example under OnPlayerUpdate
Код:
if(pWarns[playerid] == 3)
{
	Ban(playerid);
	return 1;
}
Cut the code bit down

Код:
if(dini_Int(aFile,"Admin") >= 3)
   {
	SendClientMessage(playerid,0xFF0000AA,"Usa: /warn <id/nome> <motivo>  |  /swarn <id/nome>");
   }
   if(0 < dini_Int(aFile,"Admin") < 3)
   {
	SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin da Liv.3 in poi.");
   }
   if(dini_Int(aFile,"Admin") == 0)
   {
	SendClientMessage(playerid,0xFF0000AA,"Comando abilitato agli Admin.");
   }

Here is an example of entire command (not tested)
Код:
COMMAND:warn(playerid, params[])
{
    new pid, reason[105];
    if(PlayerInfo[playerid][pAdminlevel] >= 1) return SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
    if(sscanf(params, "us", pid, reason)) return SendClientMessage(playerid,  0xFFFFFFFF, "/warn [playerid/name] [reason]");
    if(IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID && pid != playerid)
    {
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "%s has been warned by %s for: %s", paramname, adminname, reason);
        pWarns[pid]++;
        SendClientMessageToAll(AdminColor, string);
        Kick(pid);
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected Or Is Yourself.");
    return 1;
}
Reply


Messages In This Thread
CMD Help [DINI][sscanf] - by DanyelKing - 09.03.2013, 16:54
Re: CMD Help [DINI][sscanf] - by Denying - 09.03.2013, 17:10
Re: CMD Help [DINI][sscanf] - by DanyelKing - 09.03.2013, 17:22
Re: CMD Help [DINI][sscanf] - by Squirrel - 09.03.2013, 17:26
Re: CMD Help [DINI][sscanf] - by DanyelKing - 09.03.2013, 17:36
Re: CMD Help [DINI][sscanf] - by Squirrel - 09.03.2013, 17:40
Re: CMD Help [DINI][sscanf] - by DanyelKing - 09.03.2013, 17:43
Re: CMD Help [DINI][sscanf] - by DanyelKing - 11.03.2013, 20:31

Forum Jump:


Users browsing this thread: 2 Guest(s)