09.01.2011, 09:57
I have this command:
But is a problem, after relog, or server restart, the new name doesn't save in MySQL. How can i save the new name in MySQL DataBase?
Код:
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; } giveplayerid = ReturnUser(tmp); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); if (PlayerInfo[playerid][pAdmin] >= 4) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { 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; } SetPlayerName(giveplayerid, (result)); return 1; } } } } return 1; }