16.04.2015, 21:55
(
Последний раз редактировалось Antoniohl; 17.04.2015 в 01:30.
)
i've tried this one, and still,
it doesn't change the account name, it does in game but in Accounts no it only deletes the old name, file,i wish i can fix it , please if you can help me tell me
i'm using Y_INI Save data..
And here the stock of "DoesAccountExist"
it doesn't change the account name, it does in game but in Accounts no it only deletes the old name, file,i wish i can fix it , please if you can help me tell me
i'm using Y_INI Save data..
Код:
CMD:setname(playerid, params[]) { new string[128], giveplayerid, name[MAX_PLAYER_NAME]; new playername[MAX_PLAYER_NAME]; if(sscanf(params, "us[24]", giveplayerid, name)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/partofname] [newname]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[playerid][pAdmin] >= 4) { if(!DoesAccountExist(name)) { new newname[MAX_PLAYER_NAME + 10]; GetPlayerName(giveplayerid, playername, sizeof(playername)); format(newname, sizeof(newname), "Accounts/%s.ini", name); format(string, sizeof(string), " Your name has been changed from %s to %s.", GetPlayerNameEx(giveplayerid), name); SendClientMessage(giveplayerid,COLOR_YELLOW,string); format(string, sizeof(string), " You have changed %s's name to %s.", GetPlayerNameEx(giveplayerid), name); SendClientMessage(playerid,COLOR_YELLOW,string); SetPlayerName(giveplayerid, name); format(newname, sizeof(newname), "Accounts/%s.ini", playername); fremove(newname); if(DoesAccountExist(playername)) // If it doesn't get removed, blank the file with write io and check its length when a player attempts to authenticate (it'll be 0) { new File: BlankTheFile = fopen(newname, io_write); SendClientMessage(playerid, COLOR_GRAD2, "The old account couldn't be removed completely (it's been blanked for future use)."); fclose(BlankTheFile); } } else { SendClientMessage(playerid, COLOR_WHITE, "This name is already registered."); } } else { SendClientMessage(playerid, COLOR_GRAD2, "You're not authorised to use this command."); } } else { SendClientMessage(playerid, COLOR_GRAD2, "No Such Player"); } return 1; }
Код:
stock DoesAccountExist(account_name[]) { new sz_accStr[MAX_PLAYER_NAME + 12], File:f_Handle; format(sz_accStr, sizeof(sz_accStr), "Accounts/%s.ini", account_name); if(fexist(sz_accStr)) { if(!(f_Handle = fopen(sz_accStr, io_read))) { return 1; } if(flength(f_Handle) > 0) { fclose(f_Handle); return 1; } fclose(f_Handle); } return 0; }