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


Messages In This Thread
Command doesn't work - by Red_Dragon. - 10.05.2013, 18:04
AW: Command doesn't work - by Blackazur - 10.05.2013, 18:07
Re: Command doesn't work - by Red_Dragon. - 10.05.2013, 18:11
Re: Command doesn't work - by Red_Dragon. - 17.05.2013, 17:01
Re: Command doesn't work - by Red_Dragon. - 19.05.2013, 12:12
Re: Command doesn't work - by Red_Dragon. - 30.05.2013, 11:52
Re: Command doesn't work - by GiamPy. - 30.05.2013, 11:58

Forum Jump:


Users browsing this thread: 2 Guest(s)