Errors in /warns
#5

blackdragon1, you have absolutely no idea what you're doing, do you?

How can you check if 'id' is connected, if you haven't even defined what's that 'id' yet?


pawn Код:
CMD:warn(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid, -1, "Only admins can use this command.");

    new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params, "u", pID))
        return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");

    if(!IsPlayerConnected(pID))
        return SendClientMessage(playerid, -1, "Selected player is not connected.");

    playerWarn[pID] ++;
    GetPlayerName(playerid, pName, sizeof pName);
    GetPlayerName(pID, name, sizeof name);
    format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]);
    SendClientMessage(pID, -1, str);
    format(str, sizeof str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]);
    SendClientMessage(playerid, -1, str);
    if(playerWarn[pID] > 2)
    {
         format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name);
         SendClientMessageToAll(-1, str);
         SendClientMessage(pID, -1, "You were warned three (3) times and got kicked.");
         Kick(pID);
    }
    return 1;
}
Try this ... It should work.
Reply


Messages In This Thread
Errors in /warns - by DerickClark - 08.02.2013, 10:50
Re: Errors in /warns - by antonio112 - 08.02.2013, 10:53
Re: Errors in /warns - by DerickClark - 08.02.2013, 10:58
Re: Errors in /warns - by blackdragon1 - 08.02.2013, 11:41
Re: Errors in /warns - by antonio112 - 08.02.2013, 12:41

Forum Jump:


Users browsing this thread: 2 Guest(s)