anti bike fall off
#1

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;
}
Reply
#2

BikeTimer[playerid] = SetTimerEx etc etc etc

KillTimer(BikeTimer[playerid]);
Reply
#3

ty kaisersouse its working now ^^
Reply
#4

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

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

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??
Reply
#7

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.
Reply
#8

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


EDIT: typo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)