Change name help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Change name help (
/showthread.php?tid=269113)
Change name help -
OUL - 15.07.2011
I'm making RPG GM and i working on /changename command i use djson for write/load data and ycmd for command processor
My command shoud be like /changename [playerid] [new name]
but if that 'new name' already exist it will not change name for 'playerid'
this is my command:
pawn Код:
YCMD:changename(playerid,params[],help)
{
#pragma unused help
new
id,
name[MAX_PLAYER_NAME],
string[2][128],
iData[64];
if(PlayerInfo[playerid][pAdmin] < 3) return SCM(playerid,""#hex_siva"Moras biti administrator kako bi mogao koristiti ovu komandu!",""#hex_siva"Just administrators can use that command.");
else if(sscanf(params,"us[MAX_PLAYER_NAME]",id,name)) return SCM(playerid, ""#hex_siva"KORISTI: /changename [ID] [Novo Ime]", ""#hex_siva"USAGE: /changename [ID] [New Name]");
else if(id == INVALID_PLAYER_ID) return SCM(playerid,""#hex_siva"SERVER: Igrac nije online.",""#hex_siva"SERVER: Player with that ID is offline.");
else
{
format(iData, sizeof iData, SERVER_DATA, GetName(id));
if(strcmp(iData, name, true)
{
}
}
return true;
}
Can someone help me about that part of job?
Re: Change name help -
PrawkC - 15.07.2011
Well if you look at
https://sampwiki.blast.hk/wiki/SetPlayerName it returns -1 if the name is already in use.. so you could do if(SetPlayerName(playerid, "Name") == -1)
Re: Change name help -
OUL - 15.07.2011
But that check just for 'online' players. I need to check my data base