23.01.2010, 08:40
Ok i think i know what you want, but you are definitely doing it the wrong way.
OnPlayerEnterVehicle occurs when a player starts to enter a vehicle, before they are actually in the car.
This is why you had to use the timer.
Instead use OnPlayerStateChange https://sampwiki.blast.hk/wiki/OnPlayerStateChange checking for PLAYER_STATE_DRIVER as the new state. This occurs when they are actually in the vehicle. No more need for a timer
You are also getting an error from public CarCheck(playerid, vehicleid); you don't need the ";"
and OnGameModeInIt is a script call back you need to fill out, not something you call(normally). https://sampwiki.blast.hk/wiki/OnGameModeInit
And a few other bugs i fixed up.
For your question about how to get vehicle types, use GetVehicleModel
You might want to read through some tutorials on the samp wiki
Here is a corrected version with OnPlayerStateChange instead
OnPlayerEnterVehicle occurs when a player starts to enter a vehicle, before they are actually in the car.
This is why you had to use the timer.
Instead use OnPlayerStateChange https://sampwiki.blast.hk/wiki/OnPlayerStateChange checking for PLAYER_STATE_DRIVER as the new state. This occurs when they are actually in the vehicle. No more need for a timer
You are also getting an error from public CarCheck(playerid, vehicleid); you don't need the ";"
and OnGameModeInIt is a script call back you need to fill out, not something you call(normally). https://sampwiki.blast.hk/wiki/OnGameModeInit
And a few other bugs i fixed up.
For your question about how to get vehicle types, use GetVehicleModel
You might want to read through some tutorials on the samp wiki
Here is a corrected version with OnPlayerStateChange instead
pawn Код:
new hydra1 ;
public OnGameModeInit()
{
hydra1 = AddStaticVehicleEx(520,317.6323,2052.3049,18.3789,178.9925,86,86,10000);
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate);
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid)==520) //520 is a hydra model
{
SendClientMessage(playerid, rojo_03,"-- Something happens... --");
}
else
{
SendClientMessage(playerid, rojo_03,"||-- Other thing happens... ---");
}
}
}