cmd:changeplayername -
KillerStrike23 - 14.05.2014
@sup,
Can anyone teach me how to create a cmd that allow admins to change players acc name but without deleting his old acc file or remove anyting of it, am using dini files. I have a problem that when player wanted to change his name he need to call admins and sell all of his stuff and relog bla bla..... a deep shit so help!
Thanks in advanced/ Dudb k! Bump)
Re: cmd:changeplayername -
KillerStrike23 - 19.05.2014
Bump*
Re: cmd:changeplayername -
sl!x - 19.05.2014
try this i just took it from my script but it should work
PHP код:
if(strcmp(cmd, "/changename", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new tmpp[256];
tmpp = strtok(cmdtext, idx);
if(!strlen(tmpp))
{
SendClientMessage(playerid, COLOR_DBLUE, "Correct SYNTAX: /changename [playerid] [new nick]");
return 1;
}
giveplayerid = strval(tmpp);
tmp = strtok(cmdtext, idx);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(giveplayerid))
{
SetPlayerName(giveplayerid, tmp);
format(string, sizeof(string), "AdmCMD: %s(%i) you changed the name to %s", sendername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "("COL_RED"C.Life{FFFFFF}!) You have changed ID %i's name to %s", giveplayerid, tmp);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 256, "("COL_RED"C.Life{FFFFFF}!) "COL_RED"%s {FFFFFF}je promjenuo ime "COL_RED"%s{FFFFFF}-a u "COL_RED"%s.", sendername,giveplayer, tmp);
ABroadCast(WHITE,string,1);
}
else
{
format(string, sizeof(string), "%d nije aktivan igrac.", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Nemate dozovolu za koristenje te komande!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Morate se prijaviti da biste koristili tu komandu!");
}
return 1;
}
Re: cmd:changeplayername -
KillerStrike23 - 19.05.2014
dude, it don't change player acc name it just set its name
I need to change account name and I had already tried that code its not your script.
Re : cmd:changeplayername -
yusei - 19.05.2014
PHP код:
CMD:changename(playerid, params[])
{
new id, newname[MAX_PLAYER_NAME];
if(sscanf(params, "us[24]", id, newname)) return SendClientMessage(playerid, -1, "USAGE: /changename [playerid] [new name]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!"); //Change it to your admin enum or whatever
if(IsPlayerConnected(id))
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(id, pname, MAX_PLAYER_NAME);
if(strcmp(pname, newname))
{
SetPlayerName(id, newname);
new string[64];
format(string, sizeof(string), "users/%s.ini", pname); // Your user data folder
fremove(string);
//Then re-save the player
}
else return SendClientMessage(playerid, -1, "Oldname & Newname cannot same!");
}
else return SendClientMessage(playerid, -1, "Player not connected!");
return 1;
}
Re: cmd:changeplayername -
KillerStrike23 - 19.05.2014
dude? a question do that change the user name without deleting its acc or it delet its acc and create a new one ? !