OnPlayerEnterVehicle - 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: OnPlayerEnterVehicle (
/showthread.php?tid=181480)
OnPlayerEnterVehicle -
FrankC - 05.10.2010
i currently have when i press f to enter a vehicle it shows a message
i want it to show the message ONLY when im in the car not before.
can anybody help me with that maybe some suggestions?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
new string[128];
if(IsBuyableCar[vehicleid]!=0)
{
GetVehicleName(vehicleid);
if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid)))
{
format(string,sizeof(string)," Vehicle ID: %d / Name: %s / Bought by: %s !",VehicleSystem[IsBuyableCar[vehicleid]][CarID],VehicleSystem[IsBuyableCar[vehicleid]][Name],VehicleSystem[IsBuyableCar[vehicleid]][Owner]);
SendClientMessage(playerid,COLOR_GREY,string);
}
Re: OnPlayerEnterVehicle -
Conroy - 05.10.2010
OnPlayerStateChange.
Re: OnPlayerEnterVehicle -
boelie - 05.10.2010
you need the callback OnPlayerStateChange
and function GetPlayerState DRIVER or PASSENGER
that way it will set the message ONLY when your already sitting in the vehicle
Re: OnPlayerEnterVehicle -
[XST]O_x - 05.10.2010
OnPlayerEnterVehicle is called when a player presses 'F'/'enter' near an valid vehicle.
OnPlayerStateChange should help with your case.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new string[128];
if(IsBuyableCar[GetPlayerVehicleID(playerid)]!=0)
....
Re: OnPlayerEnterVehicle -
FrankC - 05.10.2010
Quote:
Originally Posted by Conroy
|
Quote:
Originally Posted by boelie
you need the callback OnPlayerStateChange
and function GetPlayerState DRIVER or PASSENGER
that way it will set the message ONLY when your already sitting in the vehicle
|
Quote:
Originally Posted by [XST]O_x
OnPlayerEnterVehicle is called when a player presses 'F'/'enter' near an valid vehicle.
OnPlayerStateChange should help with your case.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new string[128]; if(IsBuyableCar[vehicleid]!=0) ....
|
Thanks for quick respond working now.