19.05.2014, 19:20
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;
}