Quick question
#1

How do you save stuff when a player crashes, and how do you see if a person crashed to save stuff?


And so i dont have to make another thread later, how do i make a like global engine using 0.3c functions? When one player starts the engine, then another person trys driving, its off. And when you get into another car, you gotta do engine twice to make it work, how would i set engines per vehicle, if anyone understands shit i just said
Reply
#2

This explains pretty much everything you need to know about crashes.

OnPlayerDisconnect()

For the engine take a look at:

SetVehicleParamsEx()

Just remember to define ManualVehicleEngineAndLights() first.
Reply
#3

I know how to make the basic engine, the wiki doesnt answer my question thought, ill try some things with onplayerdisconnect
Reply
#4

if you arent saving stuff
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
else
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: // crashed
        }
                  // save stuff here and etc.
        {
        case 1: // disconnected
        }
             // stuff here
        {
        case 2: // kicked or banned
        }
             // stuff
        {
        SendClientMessageToAll(0xFFFFFFAA,string);
        }
    }
    return 1;
}
that's basic (quote if any error)
Reply
#5

Alright, cause when a player crashes, he is spawned to that annoying 0.0 place with no skin, cj. I will try doing this
Reply
#6

Hmm, error, I never understand the switch cases.

pawn Код:
(870 -- 890) : error 010: invalid function or declaration
Lines,
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: // crashed
        {
                  // save stuff here and etc.
        }
        case 1: // disconnected
        {
             // stuff here
        }
        case 2: // kicked or banned
        {
             // stuff
        }
       
        }
    }
    return 1;
}
Reply
#7

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        string[64],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: // crashed
        {
                  // save stuff here and etc.
        }
        case 1: // disconnected
        {
             // stuff here
        }
        case 2: // kicked or banned
        {
             // stuff
        }
    }
    return 1;
}
You had an unneeded bracket.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)