04.04.2012, 15:47
Hello!
I have a question,
i have a changenick command,
When i change my nickname, i get a new file. it will not destroy the other file,
So here is an example:
I join server with name: Rofl.
I change my nick in LMAO.
When i reconnect with LMAO, and change my nickname into lol. it makes the file: lol.user. but it does not destroy LMAO.
Here is my script code. Hope yall can help me
Add me on xfire: Jeroenhulshof
- Jeroen
I have a question,
i have a changenick command,
When i change my nickname, i get a new file. it will not destroy the other file,
So here is an example:
I join server with name: Rofl.
I change my nick in LMAO.
When i reconnect with LMAO, and change my nickname into lol. it makes the file: lol.user. but it does not destroy LMAO.
Here is my script code. Hope yall can help me

Код:
if (strcmp(cmd, "/changenick", true) == 0) { tmp = strtok(cmdtext, idx); if(ChangenickAllowed[playerid] != 1 && PlayerInfo[playerid][pAdmin] == 0) { SendClientMessage(playerid, COLOR_GREY, "u bent niet bemachtigd om deze commando uit te voeren!"); return 1; } if (PlayerLoggedIn[playerid] == 0) { SendClientMessage(playerid, COLOR_RED, "Truelife-RPG: U bent niet ingelogd! gebruik {CC0000}/login{FFFFFF} om in te loggen!"); return 1; } if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "GEBRUIK: /changenick om uw naam te veranderen!"); return 1; } if (strlen(tmp) > 20 || strlen(tmp) < 3) { SendClientMessage(playerid, COLOR_RED, "Truelife-RPG: Gebruik niet meer dan 32 tekens."); return 1; } if(!InvalidNickCharacters(tmp)) { SendClientMessage(playerid, COLOR_RED, "Truelife-RPG: U gebruikt illigale tekens."); return 1; } format(string, sizeof(string), "/userfiles/%s.user", tmp); if(fexist(string)) { SendClientMessage(playerid, COLOR_RED, "Truelife-RPG: Deze naam is al geregistreerd! kies een andere naam!"); return 1; } format(string, sizeof(string),"Truelife-RPG: %s heeft zijn/haar naam veranderd in: %s", PlayerName[playerid], tmp); SendClientMessageToAll(COLOR_YELLOW, string); ChangenickAllowed[playerid] = 0; format(string, sizeof(string), "/userfiles/%s.user", PlayerName[playerid]); fremove(string); SetPlayerName(playerid, tmp); GetPlayerName(playerid, PlayerName[playerid], MAX_PLAYER_NAME); format(string, sizeof(string), "/userfiles/%s.user", PlayerName[playerid]); PlayerInfo[playerid][pPocket] = GetPlayerMoney(playerid); strmid(PlayerName[playerid], tmp, false, strlen(tmp), MAX_PLAYER_NAME); new File: hFile; hFile = fopen(string, io_append); new var[323]; format(var, 35, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var); format(var, 35, "%d pLevel\n", PlayerInfo[playerid][pLevel]);fwrite(hFile, var); format(var, 35, "%d pGps\n", PlayerInfo[playerid][pGps]);fwrite(hFile, var); format(var, 35, "%d pJerry\n", PlayerInfo[playerid][pJerry]);fwrite(hFile, var); format(var, 35, "%d pExp\n", PlayerInfo[playerid][pExp]);fwrite(hFile, var); format(var, 35, "%d pHouseOwner\n", PlayerInfo[playerid][pHouseOwner]);fwrite(hFile, var); format(var, 35, "%d pBank\n", PlayerInfo[playerid][pBank]);fwrite(hFile, var); format(var, 35, "%d pPocket\n", PlayerInfo[playerid][pPocket]);fwrite(hFile, var); format(var, 35, "%d pHouseKey\n", PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var); format(var, 35, "%d pPerMute\n", PlayerInfo[playerid][pPerMute]);fwrite(hFile, var); format(var, 35, "%d pJailedSec\n", PlayerInfo[playerid][pJailedSec]);fwrite(hFile, var); format(var, 35, "%d pLicenseA\n", PlayerInfo[playerid][pLicenseA]);fwrite(hFile, var); format(var, 35, "%d pLicenseB\n", PlayerInfo[playerid][pLicenseB]);fwrite(hFile, var); format(var, 35, "%d pLicenseC\n", PlayerInfo[playerid][pLicenseC]);fwrite(hFile, var); format(var, 35, "%d pLicenseH\n", PlayerInfo[playerid][pLicenseH]);fwrite(hFile, var); format(var, 35, "%.4f pPosX\n", PlayerInfo[playerid][pPosX]);fwrite(hFile, var); format(var, 35, "%.4f pPosY\n", PlayerInfo[playerid][pPosY]);fwrite(hFile, var); format(var, 35, "%.4f pPosZ\n", PlayerInfo[playerid][pPosZ]);fwrite(hFile, var); format(var, 35, "%d pInt\n", PlayerInfo[playerid][pInt]);fwrite(hFile, var); format(var, 35, "%d pVir\n", PlayerInfo[playerid][pVir]);fwrite(hFile, var); format(var, 35, "%d pSkin\n", PlayerInfo[playerid][pSkin]);fwrite(hFile, var); format(var, 35, "%d pTeam\n", PlayerInfo[playerid][pTeam]);fwrite(hFile, var); format(var, 35, "%d pWeapon1\n", PlayerInfo[playerid][pWeapon1]);fwrite(hFile, var); format(var, 35, "%d pAmmo1\n", PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var); format(var, 35, "%d pWeapon2\n", PlayerInfo[playerid][pWeapon3]);fwrite(hFile, var); format(var, 35, "%d pAmmo2\n", PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var); format(var, 35, "%d pWeapon3\n", PlayerInfo[playerid][pWeapon3]);fwrite(hFile, var); format(var, 35, "%d pAmmo3\n", PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var); format(var, 35, "%d pRank\n", PlayerInfo[playerid][pRank]);fwrite(hFile, var); format(var, 35, "%.2f pArmour\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var); format(var, 35, "%.2f pHealth\n", PlayerInfo[playerid][pHealth]);fwrite(hFile, var); format(var, 35, "%d pBusinessKey\n", PlayerInfo[playerid][pBusinessKey]);fwrite(hFile, var); format(var, 35, "%d pVip\n", PlayerInfo[playerid][pVip]);fwrite(hFile, var); format(var, 35, "%d pWarnings\n", PlayerInfo[playerid][pWarnings]);fwrite(hFile, var); format(var, 35, "%d pDrugs\n", PlayerInfo[playerid][pDrugs]);fwrite(hFile, var); format(var, 35, "%s pIP\n", PlayerInfo[playerid][pIP]);fwrite(hFile, var); fclose(hFile); new houseid = PlayerInfo[playerid][pHouseKey]; if(PlayerInfo[playerid][pHouseKey] != INVALID_HOUSE_ID && PlayerInfo[playerid][pHouseOwner] == 1) { strmid(HouseInfo[houseid][hOwner], PlayerName[playerid], false, strlen(PlayerName[playerid]), 25); OnHouseUpdate(); } new businessid = PlayerInfo[playerid][pBusinessKey]; if(PlayerInfo[playerid][pBusinessKey] != INVALID_BUSINESS_ID) { strmid(BusinessInfo[businessid][bOwner], PlayerName[playerid], false, strlen(PlayerName[playerid]), 25); OnBusinessUpdate(); } return 1; }
- Jeroen