16.12.2015, 04:43
Hello, i have a cmd for IRC to change name for players that are online, here's the code:
Real Problem:I wanted to make the same CMD for offline players, like change their names while off, i tried in the following way:
I just wanted to know what do i have to put at that "PlayerName(endid)" in that marked line.
Код:
IRCCMD:changename(botid, channel[], user[], host[], params[]) { if (IRC_IsAdmin(botid, channel, user)) { new endid; new strmessage[128]; new newname[30]; if(sscanf(params, "us[100]", endid,newname)) { format(strmessage,sizeof(strmessage),"USAGE: !remtag (Player Name/ID) (new-name)"); IRC_GroupSay(gGroupID, channel, strmessage); return 1; } if(!IsPlayerConnected(endid)) { format(strmessage,sizeof(strmessage),"12ERROR: \2;%d\2; is not an active ID.", endid); IRC_GroupSay(gGroupID, channel, strmessage); return 1; } if(PLAYERLIST_authed[endid] != 1) { format(strmessage,sizeof(strmessage),"%s(%d) is not logged into to the server. You must wait till they login before you set their administrator level.",PlayerName(endid),endid); IRC_GroupSay(gGroupID, channel, strmessage); return 1; } SendClientMessage(endid,COLOR_ADMIN,"Your name has been changed.Admins usually use it to remove XP's tag.Please relog now."); udb_RenameUser(PlayerName(endid),newname); format(strmessage,sizeof(strmessage),"12Nick name has been changed to: %s",newname); IRC_GroupSay(gGroupID, channel, strmessage); SetPlayerName(endid,newname); } return 1; }
Real Problem:I wanted to make the same CMD for offline players, like change their names while off, i tried in the following way:
Код:
IRCCMD:changeoffname(botid, channel[], user[], host[], params[]) { if (IRC_IsAdmin(botid, channel, user)) { new endid; new strmessage[128]; new newname[30]; if(sscanf(params, "us[100]", endid,newname)) { format(strmessage,sizeof(strmessage),"USAGE: !remtag (Player Name/ID) (new-name)"); IRC_GroupSay(gGroupID, channel, strmessage); return 1; } udb_RenameUser(PlayerName(endid),newname); format(strmessage,sizeof(strmessage),"12Nick name has been changed to: %s",newname); IRC_GroupSay(gGroupID, channel, strmessage); SetPlayerName(endid,newname); } return 1; }