Command doesn't work
#1

I have this command and when I try to use it in-game it doesn't respond with anything. In other words, it doesn't work, so what's the problem ? Here is the code
pawn Код:
CMD:changename(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 4)
    {
        new targetid,newname[24],reason[105],string[256];
        if(sscanf(params, "ds[24]s[105]",targetid,newname,reason)) return SendClientMessage(playerid,-1,""chat" /changename [ID] [New Name] [Reason]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

        new escapename[24], Query[128];
        mysql_real_escape_string(newname, escapename);
        format(Query, sizeof(Query), "SELECT `user` FROM `playerinfo` WHERE `user` = '%s' LIMIT 1", escapename);
        mysql_query(Query);
        mysql_store_result();
        new rows = mysql_num_rows();
        if(!rows)
        {
            format(Query, sizeof(Query), "UPDATE `playerinfo` SET `user`= '%s' WHERE `user` ='%s'",escapename,PlayerName(targetid));
            mysql_query(Query);
            SetPlayerName(targetid,escapename);
            format(string,sizeof(string),""chat""COL_LIGHTBLUE" %s %s changed your name to %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),newname, reason);
            SendClientMessage(targetid,-1,string);
            format(string,sizeof(string),""chat" You've changed ID %d name to %s [Reason: %s]",targetid, PlayerName(targetid), reason);
            SendClientMessage(playerid,-1,string);
        }
        else if(rows == 1)
        {
            SendClientMessage(playerid, -1, ""chat" This name already exists!");
        }
        mysql_free_result();
    }
    else {
        SendClientMessage(playerid,-1,""chat""COL_GREY" You are not authorized to use this command");
    }
    return 1;
}
Thanks in advance.
Reply
#2

You try to remading zombie apocalypse? xD. The cmd should work, what work exactly not?
Reply
#3

Yeah, just something between me and some guys, for fun and as I said, command doesn't do anything like if I wrote /changen it redirects me to say /changename [ID] blah blah blah, but when I do /changename nothing happens and in an easy way, I can't change names. Thanks for the reply.
Reply
#4

Bump.
Reply
#5

Bump.
Reply
#6

Bump :/
Reply
#7

Could you please make some debug prints to see when the code stops executing? Something like this:

pawn Код:
CMD:youknow(playerid, params[])
{
    print("debug 0");  
    SendClientMessage([...]);
   
    print("debug 1");
    SendClientMessage([...]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)