Crash system
#1

Can someone give me a crash system.
when player crashing he will back to last place and one more
how can i make that player won't crash and he will be back to his last place
saving x z y.
Reply
#2

You don't have a position coordinates saving system at all, do you? Anyways, a simple one with dini

pawn Код:
enum pinfo // Anywhere, not in function or callback and such as.
{
    Float: X, Float: Y, Float: X, Float: FA
}
new PlayerInfo[MAX_PLAYERS][pinfo];

stock SavePlayerLocation(playerid) // OnPlayerDisconnect.
{
    new savefile[100], Name[MAX_PLAYER_NAME];
    GetPlayerPos(PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
    GetPlayerFacingAngle(PlayerInfo[playerid][FA]);
    GetPlayerName(playerid, Name, sizeof(Name));
    format(savefile, sizeof(savefile),"%s's file.ini", Name);
    if(!dini_Exists(savefile)) return dini_Create(savefile);
    dini_FloatSet(savefile,"X", PlayerInfo[target][X]);
    dini_FloatSet(savefile,"Y", PlayerInfo[target][Y]);
    dini_FloatSet(savefile,"Z", PlayerInfo[target][Z]);
    dini_FloatSet(savefile,"Facing Angle", PlayerInfo[target][FA]);
    return 1;
}

stock LoadPlayerLocation(playerid) // OnPlayerConnect or wherever you load the stats from.
{
    new loadfile[100], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(loadfile, sizeof(loadfile),"%s's file.ini", Name);
    if(dini_Exists(loadfile))
    {
        PlayerInfo[playerid][X] = dini_Float(loadfile,"X");
        PlayerInfo[playerid][Y] = dini_Float(loadfile,"Y");
        PlayerInfo[playerid][Z] = dini_Float(loadfile,"Z");
        PlayerInfo[playerid][FA] = dini_Float(loadfile,"Facing Angle");
        SetPlayerPos(playerid, PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
        SetPlayerFacingAngle(playerid, PlayerInfo[playerid][FA]);
    }
    else SavePlayerLocation(playerid);
    return 1;
}
Reply
#3

thanks so just put the stocks inside each public?
and i have a saving coordinates but when i crash it doesnt spawnme

this is what saving to ini file after crash
Pos_x=1114.9
Pos_y=-956.4
Pos_z=42.6

how i make the player to spawn if crash?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)