need some help..
#1

i have this bit of code :

Код:
public FallingChecker()
{
   new Float:x,Float:y,Float:z,Float:d;
   for(new i =0; i<MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i))
	 {
	    GetPlayerPos(i,x,y,z);
	    d = floatsqroot((x-LastX[i] * x-LastX[i]) + (y-LastY[i] * y-LastY[i]));
	    if(d < 10 && (LastZ[i] - z) > 5)
	    {
	      OnPlayerFall(i);
	    }
	    LastX[i] = x;
	    LastY[i] = y;
	    LastZ[i] = z;
	 }
   }
   return 1;
}

public OnPlayerFall(playerid)
{
	SendClientMessage(playerid,0x000000FF,"You are falling! A parachute has been equipped.");
	SendClientMessage(playerid,0x000000FF,"Open your parachute NOW!!!");
	GivePlayerWeapon(playerid,46,1);
	return 1;
}
the problem is: i dont get a parachute whilst im in air and the messages dont appear at all.. so please if you could help me , and explain allitle more on how to exactly do this
Reply
#2

Do you run a timer for FallingChecker() ?
Reply
#3

no , no timer , do i have to?
Reply
#4

Obviously.

Put under OnGameModeInit:
pawn Код:
SetTimer("FallingChecker", 500, true);
Note that 500 may not be the correct delay for your calculation (if(d < 10 && (LastZ[ i] - z) > 5)). I mean, if you set the delay to 10 milliseconds, the player won't fall 5 units during this time and thus your code will not work.
Reply
#5

yep but its not my code its backwards man , anyway il give it a try
Reply
#6

Yep its working PERFECTLY, thanks a MIL man !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)