if player in vehicle scripts - 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: if player in vehicle scripts (
/showthread.php?tid=182752)
if player in vehicle scripts -
nejc001 - 12.10.2010
Well, i want script that it would say like:
Код:
public OnPlayerInVehicle(playerid) // this doesnt exist in pawno
{
if(IsPlayerInVehicle(playerid, 150))
SetTimer("fltdrunktimer",3000,true); // this does set players drunk level at 4000 every third second
}
return 1;
}
And i have no idea how to make that one, where should i put:
Код:
if(IsPlayerInVehicle(playerid, 150))
SetTimer("fltdrunktimer",3000,true);
Re: if player in vehicle scripts -
Jeffry - 12.10.2010
You want to start the timer when he enters a vehicle, and stop the timer when he exits it?
Re: if player in vehicle scripts -
nejc001 - 14.10.2010
seriously, you realy think i will read what you wrote, if you have signature like that... xD ill try... :P
back to topic:
uhm, kinda, ok or lets say, how to make, that if you are in vehicle id 150, every 3 second it will automaticly set drunk level to 4000?
Re: if player in vehicle scripts -
Biesmen - 14.10.2010
Use OnPlayerStateChange (public OnPlayerStateChange(playerid, newstate, oldstate). I wanted to create something similair to that, he told me to use OnPlayerStateChange and it worked fine.
Script:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(vehicleid)==150)
{
SetTimer("fltdrunktimer",3000,true);
}
return 1;
}
Re: if player in vehicle scripts -
Jeffry - 14.10.2010
Just for info: Vehicle IDs are from 400 => 611, which means that ID 150 does not exist.
But the code of Biesem seems to be good, you have just to change the 150 to an existing ModelID.