11.05.2008, 17:28
pawn Код:
if(strcmp(cmd, "/changename", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "[USAGE]: /changename [id] [newname]");
return 1;
}
new player[24];
giveplayerid = ReturnUser(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string4, sizeof(string4), "/Accounts/%s.ini", player);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
/*if(!fexist(string4))
{
SendClientMessage(playerid, COLOR_YELLOW, "Info: That name is allready registered with the server.");
return 1;
}*/
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "[USAGE]: /changename [id] [newname]");
return 1;
}
GetPlayerName(playerid, player, 50);
SetPlayerName(giveplayerid, (result));
format(string, sizeof(string), "%s changed %s name to %s",sendername,giveplayer,(result));
ChangeNameLog(string);
return 1;
}
}
}
}
return 1;
}