SA-MP Forums Archive
Is there such callback as - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is there such callback as (/showthread.php?tid=122364)



Is there such callback as - JoeDaDude - 21.01.2010

Is there such callback as, OnPlayerExitVehicle,
Or anything simular or what would do the same thing?


Re: Is there such callback as - Doppeyy - 21.01.2010

Why need a other one if you want the exact same thing as OnPlayerExitVehicle ?

[Doppeyy


Re: Is there such callback as - JoeDaDude - 21.01.2010

Quote:
Originally Posted by ๔๏קקєyy
Why need a other one if you want the exact same thing as OnPlayerExitVehicle ?

[Doppeyy
I mean, Im wondering if that callback exists,
If it dosent then one that would do the same thing


Re: Is there such callback as - Doppeyy - 21.01.2010

Quote:
Originally Posted by JoeDaDude
Quote:
Originally Posted by ๔๏קקєyy
Why need a other one if you want the exact same thing as OnPlayerExitVehicle ?

[Doppeyy
I mean, Im wondering if that callback exists,
If it dosent then one that would do the same thing
OnPlayerExitVehicle excist its a standard samp callback.

[Doppeyy


Re: Is there such callback as - Correlli - 21.01.2010

https://sampwiki.blast.hk/wiki/OnPlayerExitVehicle - it's called when player exits the vehicle.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_ONFOOT && (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER))
  {
    // your code.
  }
  return true;
}
This code will work if player's old state was driver/passenger and if new state is on foot.


Re: Is there such callback as - JoeDaDude - 21.01.2010

Ok new question:

How would i do like this:

Engine[vehicleid] = 1;

On a vehicle only,
And not a playerid,
As you can see im kinda making a engine system


Re: Is there such callback as - Correlli - 21.01.2010

I'm afraind i don't understand your wish.

Something like this?
pawn Код:
// array.
new
    Engine[MAX_VEHICLES]; // change it to your own vehicle_define.

// code.
new
    vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;



Re: Is there such callback as - JoeDaDude - 21.01.2010

Erm not sure,

Like a engine system,
They get in and the engine starts
Which would set Engine to 1
But for that car tht they got in, Not the player
And when they exit its still 1,
So when they get back in the engine is still running, Rather than having to start it again


Re: Is there such callback as - Correlli - 21.01.2010

Then i guess you're looking for this:
Quote:
Originally Posted by Don Correlli
pawn Код:
// array.
new
    Engine[MAX_VEHICLES]; // change it to your own vehicle_define.

// code.
new
    vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;
Just put it where you want (example: "/engineon" command in which you would use IsPlayerInAnyVehicle function to check if player is in any vehicle).
That code will get the ID of the vehicle in which the player is in currently and set its Engine variable to 1.


Re: Is there such callback as - JoeDaDude - 21.01.2010

Quote:
Originally Posted by Don Correlli
Then i guess you're looking for this:
Quote:
Originally Posted by Don Correlli
pawn Код:
// array.
new
    Engine[MAX_VEHICLES]; // change it to your own vehicle_define.

// code.
new
    vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;
Just put it where you want (example: "/engineon" command in which you would use IsPlayerInAnyVehicle function to check if player is in any vehicle).
That code will get the ID of the vehicle in which the player is in currently and set its Engine variable to 1.
Ok whatcha mean by this: // change it to your own vehicle_define.


Re: Is there such callback as - Correlli - 21.01.2010

Quote:
Originally Posted by JoeDaDude
Ok whatcha mean by this: // change it to your own vehicle_define.
SA:MP standard define for maximum amount of vehicles is 2000 and that's too big if don't have 2000 vehicles in your gamemode, so change it to your own value (how much vehicles you're using in your gamemode).


Re: Is there such callback as - JoeDaDude - 21.01.2010

So

pawn Код:
Engine[12];
Or

pawn Код:
Engine[MAX_VEHICLES_12];
Or what?

Sorry never done anything like this before


Re: Is there such callback as - Correlli - 21.01.2010

Quote:
Originally Posted by JoeDaDude
pawn Код:
Engine[12];
is the correct example if you have 12 vehicles in your gamemode.