Bug in Warn command
#1

i get a bug when i do /warn

pawn Код:
CMD:warn(playerid, params[])
{
    new str[128], id, reason[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    {
        //if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid,-1, "PHT-BOT:"lgreen" /warn (playerid) (reason)")
        if(sscanf(params,"us[128]",id,reason)) return SendClientMessage(playerid,lightgreen,"USAGE: "lyellow2"/warn (id) (reason)");
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,red,error2);
        format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s]", GetPName(playerid), playerid, GetPName(playerid), playerid, reason);
        SendClientMessageToAll(yellow, str);
        format(str, sizeof(str), "» You warned %s(%d) [Reason: %s]",GetPName(playerid), playerid, reason);
        SendClientMessage(playerid, green, str);
        format(str, sizeof(str), "» You've been warned by Administrator%s(%d) [Reason: %s]",GetPName(playerid), playerid, reason);
        SendClientMessage(id, red, str);
        }
    return 1;
}
when i /warn 1 somereason then i press enter it warn different Player like id 2 or 3 and not the id 1 and when i warn a not connected player id it giving warn to myself any idea to those?
Reply
#2

"id" holds the player's ID but you used the "playerid" instead so you checked if the player who typed the command is not connected and also in the messages.

pawn Код:
CMD:warn(playerid, params[])
{
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    new id, reason[64];
    if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,lightgreen,"USAGE: "lyellow2"/warn (id) (reason)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,error2);
    new str[128];
    format(str, sizeof(str), "» Administrator %s(%d) warns %s(%d) [Reason: %s]", GetPName(playerid), playerid, GetPName(id), id, reason);
    SendClientMessageToAll(yellow, str);
    format(str, sizeof(str), "» You warned %s(%d) [Reason: %s]",GetPName(id), id, reason);
    SendClientMessage(playerid, green, str);
    format(str, sizeof(str), "» You've been warned by Administrator%s(%d) [Reason: %s]",GetPName(playerid), playerid, reason);
    SendClientMessage(id, red, str);
    return 1;
}
Reply
#3

how can i make /ask command with same so it will not incompatible?
and /spec(tate) and /endspec

+

how can i put a maximum warning to 3? to /warn command
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)