Need help - DJson
#4

Create a restart command, RCON GMX's are completely bugged.

Here's mine, feel free to mess around with it, it's obviously not going to work for you at the moment.

pawn Код:
COMMAND:restart(playerid, params[])
{
    new
        File[50],
        string[128];

    if(PVar[playerid][AuthLvl] <= 4) return AuthError(playerid, 5);

    print("[PROCESS: RESTART - STARTING]");
    printf("[-] Saving %d player file(s)", global_ConnectedPlayers);
    for(new i = 0; i < global_ConnectedPlayers; i++)
    {
        if(IsPlayerConnected(i))
        {
            format(File, sizeof(File), PFiles, GetTheirName(i));
            GetPlayerPos(i, PVar[i][LastX], PVar[i][LastY], PVar[i][LastZ]);
            GetPlayerFacingAngle(playerid, PVar[playerid][LastRot]);
            GetPlayerHealth(playerid, PVar[playerid][LastHealth]);
            GetPlayerArmour(playerid, PVar[playerid][LastArmour]);
            PVar[playerid][Interior] = GetPlayerInterior(playerid);
            PVar[playerid][Cash] = GetPlayerMoney(playerid);
            djSetInt        (File, "Interior",  PVar[playerid][Interior]);
            djSetInt        (File, "Kills",     PVar[i][Kills]);
            djSetInt        (File, "Deaths",    PVar[i][Deaths]);
            djSetInt        (File, "Authorization",     PVar[i][AuthLvl]);
            djSetInt        (File, "Cash",     PVar[i][Cash]);
            djSetInt        (File, "BankMoney",     PVar[i][BankMoney]);
            djSetInt        (File, "BankAccount",     PVar[i][BankAccount]);
            djSetInt        (File, "BankSavings",     PVar[i][BankSavings]);
            djSetInt        (File, "BankPIN",     PVar[i][BankPIN]);
            djSetInt        (File, "Skin",      PVar[i][Skin]);
            djSetInt        (File, "Age",       PVar[i][Age]);
            djSetInt        (File, "PhoneNumber", PVar[i][PhoneNumber]);
            djSetInt        (File, "Faction",   PVar[i][Faction]);
            djSetInt        (File, "FactionRank", PVar[i][FRank]);
            djSetInt        (File, "VIPLevel", PVar[i][VIPLevel]);
            djSetInt        (File, "Job", PVar[i][Job]);
            djSetInt        (File, "Materials", PVar[i][Materials]);
            djSetInt        (File, "Drugs", PVar[i][Drugs]);
            djSetInt        (File, "JoinLeaveDisplay", PVar[i][JoinLeaveDisplay]);
            djSetInt        (File, "DeathDisplay", PVar[i][DeathDisplay]);
            djSetFloat      (File, "LastX",     PVar[i][LastX]);
            djSetFloat      (File, "LastY",     PVar[i][LastY]);
            djSetFloat      (File, "LastZ",     PVar[i][LastZ]);
            djSetFloat      (File, "LastRot",   PVar[playerid][LastRot]);
            djSetFloat      (File, "LastArmour", PVar[playerid][LastArmour]);
            djSetFloat      (File, "LastHealth", PVar[playerid][LastHealth]);
            djSetInt        (File, "Player_Record_Kicks", PVar[playerid][PRecord_Kicks]);
            djSetInt        (File, "Player_Record_Bans", PVar[playerid][PRecord_Bans]);
            djSetInt        (File, "Player_Record_Jails", PVar[playerid][PRecord_Jails]);
            djSetInt        (File, "Player_Record_Mutes", PVar[playerid][PRecord_Mutes]);
            djSetInt        (File, "Level", PVar[i][Level]);
            djSetInt        (File, "Experience", PVar[i][Experience]);
            djSetInt        (File, "PlayingHours", PVar[i][PlayingHours]);
            //printf("[save] %s position: %f, %f, %f", GetTheirName(playerid), PVar[playerid][LastX], PVar[playerid][LastY], PVar[playerid][LastZ]);
            printf("[%d] %s has been saved.", i, GetTheirName(i));
            Delete3DTextLabel(NameTag[i]);
        }
    }
    format(string, sizeof(string), "{0FA0D1}Server: {FFFFFF}Successfully saved {0FA0D1}%d {FFFFFF}user file(s).", global_ConnectedPlayers);
    SendClientMessageToAll(-1, string);
    ServerHasJustBeenRestarted = 1;
    print("[PROCESS: RESTART - COMPLETE]");
    GameModeExit();
    return 1;
}
Reply


Messages In This Thread
Need help - DJson - by sim_sima - 30.05.2011, 20:49
Re: Need help - DJson - by MBX97 - 31.05.2011, 00:03
Re: Need help - DJson - by leong124 - 31.05.2011, 02:46
Re: Need help - DJson - by Skylar Paul - 31.05.2011, 02:49
Re: Need help - DJson - by sim_sima - 31.05.2011, 11:29
Re: Need help - DJson - by sim_sima - 31.05.2011, 17:39
Re: Need help - DJson - by sim_sima - 01.06.2011, 10:12
Re: Need help - DJson - by sim_sima - 03.06.2011, 15:45
Re: Need help - DJson - by sim_sima - 08.06.2011, 13:00
Re: Need help - DJson - by DRIFT_HUNTER - 08.06.2011, 13:35

Forum Jump:


Users browsing this thread: 1 Guest(s)