SA-MP Forums Archive
anti bike fall off - 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: anti bike fall off (/showthread.php?tid=77688)



anti bike fall off - per~fectionist - 13.05.2009

hi guys, im trying to script an anit-bike fall off. but i have a problem my script seems te run perfect when only 1 player is on the server but when 2 players are on the last joined player is able to make full use of the anti-bike fall off and player id 0 starts bugging. does anyone know why?

Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
 {
  BikeTimer = SetTimerEx("AntiF",1000,1,"i",playerid);
  BikeVid[playerid]=vehicleid;
	return 1;
 }

 public AntiF(playerid)
{

  PutPlayerInVehicle(playerid,BikeVid[playerid],0);
	return 1;
 }

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys == 16)
	{
   if(IsPlayerInAnyVehicle(playerid))
	 {
	  KillTimer(BikeTimer);
	  RemovePlayerFromVehicle(playerid);
   }
  }
return 1;
}



Re: anti bike fall off - kaisersouse - 13.05.2009

BikeTimer[playerid] = SetTimerEx etc etc etc

KillTimer(BikeTimer[playerid]);


Re: anti bike fall off - per~fectionist - 13.05.2009

ty kaisersouse its working now ^^


Re: anti bike fall off - NeRoSiS - 13.05.2009

Thanks aswell, I always wondered why that happened to me :P


Re: anti bike fall off - Joe Staff - 13.05.2009

Why not use, OnPlayerStateChange, if newstate==PLAYER_STATE_ON_FOOT ? so there's no timers


Re: anti bike fall off - per~fectionist - 13.05.2009

Quote:
Originally Posted by SilentHuntR
Why not use, OnPlayerStateChange, if newstate==PLAYER_STATE_ON_FOOT ? so there's no timers
wont there always be a timer needed to put the player in the vehicle??


Re: anti bike fall off - kaisersouse - 13.05.2009

Quote:
Originally Posted by per~fectionist
Quote:
Originally Posted by SilentHuntR
Why not use, OnPlayerStateChange, if newstate==PLAYER_STATE_ON_FOOT ? so there's no timers
wont there always be a timer needed to put the player in the vehicle??
Not really, but you'll need a way to prevent the script from putting ppl back on bikes they are trying to dismount (gracefully) from. I use the bikes current speed at the time of state-change...which ends up using a timer.


Re: anti bike fall off - per~fectionist - 13.05.2009

well this is what i have now http://pastebin.com/f78a321e5 its the most stable i am able to script i think


EDIT: typo