21.01.2013, 13:54
Код:
public OnPlayerCommandText( playerid, cmdtext[ ] ) { if (strcmp("/changename", cmdtext, true, 10) == 0) { new name[MAX_PLAYER_NAME], newname[16]; GetPlayerName(playerid, name, sizeof(name)); if(sscanf(params,"s", newname)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /changename [new name]"); if(dini_Exists(newname)) return SendClientMessage(playerid, COLOUR_RED, "That name has already been taken!"); if(strlen(params) >= 3) { format(file, sizeof(file), "users/%s.txt", name); dini_Set(file, "users/%s.txt", newname); SendClientMessage(playerid, COLOUR_GREEN, "Your name has been successfully been changed"); SetPlayerName(playerid, newname); } else { SendClientMessage(playerid, COLOUR_YELLOW, "That name is too short, pick something else!"); } return 1; }