PDA

View Full Version : help guyz setname


MBilal
20/03/2014, 03:00 PM
CMD:setname(playerid, params[])
{
new targetid,aname[128];
if(Player[playerid][pAdmin] < 2 || !IsPlayerAdmin(playerid)) return 0;
else if (sscanf(params,"us",targetid,aname))SendClientMessage(playerid,COLOR_ ORANGE,"Usage: /setname [Playerid] [New name]");
else if(!IsPlayerConnected(targetid))SendClientMessage( playerid,COLOR_ORANGE,"Error: Player is not connected!");
else {
new string[128],n[MAX_PLAYER_NAME];
GetPlayerName(targetid,n,sizeof(n));
SetPlayerName(targetid,aname);
format(string,sizeof(string),"Admin %s [ID:%d] Has set %s [ID:%d] name to %s",GetName(playerid),playerid,n,targetid,aname);
SendClientMessageToAll(COLOR_ORANGE,string);
format(string,sizeof(string),"Your Name has been set to %s by Admin %s[ID:%d]",aname,n,playerid);
SendClientMessage(playerid,COLOR_ORANGE,string);
SetTimer("setname",9000,0);
}
return 1;
}
forward setname(targetid);
public setname(targetid)
{
ShowPlayerDialog(targetid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"{00CED1} Welcome to Server \n{FFFFFF} Type your password below to register a new account.","Register","Quit");
}
i want to ask it Work Fine?

ThaCrypte
20/03/2014, 03:09 PM
Nope, that wont work, you have to get the whole register code at setname.... And remove the old file.

MBilal
20/03/2014, 03:10 PM
i am working it so that why i am asking !!

vassilis
20/03/2014, 03:11 PM
Test it. It will work though why you really need this little snippet with the timer? to me seems useless..

MBilal
20/03/2014, 03:16 PM
i put the timer because i want when admin change name then it show Target id Register Dailogs with to register with new Name

vassilis
20/03/2014, 03:21 PM
i put the timer because i want when admin change name then it show Target id Register Dailogs with to register with new Name

Why don't you test if it works actualy?