13.05.2014, 11:57
This succeeds at changing their name but doesn't save it in the sqlite database. Help Please
Код:
if(strcmp(cmd, "/setnamea3", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/PartOfName] [name]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerNPC(giveplayerid)) return 1; if(PlayerInfo[playerid][pAdmin] >=4) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/PartOfName] [name]"); return 1; } if(SQL_AccountExists(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, " That name is already registered !"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); SetPlayerName(giveplayerid, tmp); OnPlayerSave(giveplayerid); // save player (in case server has a restart and fucks up their name) format(string, sizeof(string), " You have renamed %s to %s !", giveplayer, tmp); SendClientMessage(playerid, COLOR_GREY, string); format(string, sizeof(string), "Your name has been changed from %s to %s.", giveplayer, tmp); SendClientMessage(giveplayerid, COLOR_YELLOW, string); format(string, sizeof(string), "%s has renamed %s to %s.", sendername, giveplayer, tmp); return 1; } } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); } } return 1; }