CMD:warn issue
#1

pawn Код:
CMD:warn(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64], sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SCM(playerid, COLOR_GREY, "USAGE: /warn [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            PlayerInfo[giveplayerid][pWarned] += 1;
            if(PlayerInfo[giveplayerid][pWarned] >= 3)
            {
                format(string, sizeof(string), "Warning Kicked: %s (3rd Warn)", reason);
                SCM(giveplayerid, COLOR_LIGHTRED, string);
                Kick(giveplayerid);
                return 1;
            }
            new year, month, day;
            getdate(year, month, day);
            format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s", giveplayer, sendername, reason);
            ABroadCast(COLOR_LIGHTRED,string, 5);
            format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, reason);
            SCM(giveplayerid, COLOR_LIGHTRED, string);
            return 1;

        }
    }
    else SCM(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
It says Myname was slapped by Myname.

What have I done wrong? It should say that I warned the name i warned?
Reply
#2

You are storing the name into "giveplayer" before actually getting an accurate ID from "giveplayerid".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)