Command doesn't work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command doesn't work (
/showthread.php?tid=436255)
Command doesn't work -
Red_Dragon. - 10.05.2013
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.
AW: Command doesn't work -
Blackazur - 10.05.2013
You try to remading zombie apocalypse? xD. The cmd should work, what work exactly not?
Re: Command doesn't work -
Red_Dragon. - 10.05.2013
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.
Re: Command doesn't work -
Red_Dragon. - 17.05.2013
Bump.
Re: Command doesn't work -
Red_Dragon. - 19.05.2013
Bump.
Re: Command doesn't work -
Red_Dragon. - 30.05.2013
Bump :/
Re: Command doesn't work -
GiamPy. - 30.05.2013
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;
}