09.12.2012, 23:14
(
Последний раз редактировалось Fernado Samuel; 04.10.2013 в 18:11.
)
Removed
Originally Posted by The Forum Rules
You may only bump your thread after 24 hours has passed since the last reply.
|
CMD:changename(playerid,params[])
{
new targetid,newname[24],reason[105];
if(sscanf(params, "ds[24]s[105]",targetid,newname,reason)) return SendClientMessage(playerid,-1," /changename [ID] [New Name] [Reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1," Player is not online");
new escapename[24], Query[128];
mysql_real_escape_string(newname, escapename);
format(Query, sizeof(Query), "SELECT `user` FROM `yourdatabase` WHERE `user` = '%s' LIMIT 1", escapename);
mysql_query(Query);
mysql_store_result();
new rows = mysql_num_rows();
if(!rows)
{
format(Query, sizeof(Query), "UPDATE `yourdatabase` SET `user`= '%s' WHERE `user` ='%s'",escapename,PlayerName(targetid));
mysql_query(Query);
SetPlayerName(targetid,escapename);
format(zmstring,sizeof(zmstring)," Admin %s changed your name to %s [Reason: %s]",PlayerName(playerid),newname, reason);
SendClientMessage(targetid,-1,zmstring);
format(zmstring,sizeof(zmstring)," You've changed ID %d name to %s [Reason: %s]",targetid, PlayerName(targetid), reason);
SendClientMessage(playerid,-1,zmstring);
}
else if(rows == 1)
{
SendClientMessage(playerid, -1, " This name already exists!");
}
mysql_free_result();
return 1;
}