Hello (/setname) problem +REP
#9

pawn Код:
CMD:setname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GRAD1, "   {FF0000}ERROR{FFFFFF}: you do not have sufficient permissions!");
    new giveplayerid, newname[MAX_PLAYER_NAME];
    if(!sscanf(params, "us[24]", giveplayerid, newname)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/PartOfName] [name]");
    if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "   {FF0000}ERROR{FFFFFF}: player is not connected!");
    //Perhaps check if the player is logged in and/or registered here?
    new string[90];
    format(string, sizeof(string), "Accounts/%s.ini", newname);
    if(fexist(string)) return SendClientMessage(playerid, COLOR_GRAD1, "That name is already registered.");
    new string2[40];
    format(string2, sizeof(string2), "Accounts/%s.ini", PlayerName(giveplayerid));
    if(INI_Exist(string2)) fremove(string2);
    else SendClientMessage(playerid, COLOR_NICERED, "There was a problem with saving the account! Reverting changes...");
    //SaveAccounts(); //Wrong. You should be transferring the player's current stats from his current account to the new account
    SetPlayerName(giveplayerid, newname);
    format(string, sizeof(string), "  You have renamed %s to %s !", PlayerName(giveplayerid), newname);
    SendInfoMessage(playerid, 2, "0", string);
    format(string, sizeof(string), "Your name has been changed from %s to %s.", PlayerName(giveplayerid), newname);
    SendInfoMessage(giveplayerid, 2, "0", string);
    return 1;
}
Can you show me your SaveAccounts function?
Reply


Messages In This Thread
Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 03:08
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 04:00
Respuesta: Hello (/setname) problem +REP - by JuanStone - 16.04.2015, 04:16
Re: Hello (/setname) problem +REP - by SickAttack - 16.04.2015, 06:32
Re: Hello (/setname) problem +REP - by iiNzTicTx - 16.04.2015, 09:03
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 16:57
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 21:55
Re: Hello (/setname) problem +REP - by Antoniohl - 17.04.2015, 03:22
Re: Hello (/setname) problem +REP - by Threshold - 17.04.2015, 09:03
Re: Hello (/setname) problem +REP - by Antoniohl - 17.04.2015, 16:50

Forum Jump:


Users browsing this thread: 1 Guest(s)