26.10.2009, 03:04
Hm. So, my /setname removes old player accounts and replaces them with the new name. It works perfectly on my home server, but when I upload it to the official server, it starts to clone accounts. Is this something with the host or is it just something wrong with the code?
Don't say anything about the efficiency of the code, I'll bother with that. I care if it works or not. I'm hosted on samp-servers.com by the way, if that matters. I'm just guessing it's the host because it works fine on my test server. Anybody know?
Код:
zcmd(setname, playerid, params[]) { if(!IsPlayerConnected(playerid)) return 1; if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD1, NO_AUTH_MSG); new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], newname[MAX_PLAYER_NAME], string[128], string2[40]; if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD1, BAD_ID_MSG); if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, BAD_ID_MSG); if(sscanf(params, "us", giveplayerid, newname)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setname [playerid/PartOfName] [new nick]"); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string2, sizeof(string2), "Players/%s.ini", newname); if(fexist(string2)) return SendClientMessage(playerid, COLOR_YELLOW, "That name is already registered, please try another."); format(string, sizeof(string), "Players/%s.ini", giveplayer); SetPlayerName(giveplayerid,newname); fremove(string); format(string, sizeof(string), "AdmCmd: %s has changed ID %s's name to %s",sendername, giveplayer, newname); ABroadCast(COLOR_YELLOW, string, 1); SaveAccount(giveplayerid); return 1; }