View Single Post
Old 28/05/2020, 10:01 AM   #7
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: trying to do IsPlayerOnVehicle

You have to use MapAndreas include by Ryder to get this in the working state..
pawn Code:
#include <mapandreas>

new jumping[MAX_PLAYERS];

native IsValidVehicle(vehicleid);

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
       if (PRESSED(KEY_JUMP))
       {
              jumping[playerid] = 1;
              SetTimerEx(JumpTimer, 1500, 0, "i", playerid);
       }
       return 1;
}

forward JumpTimer(playerid);
public JumpTimer(playerid)
{
     jumping[playerid] = 0;
     return 1;
}

stock IsPlayerOnVehicle(playerid) // By GameOvr, just made for you :D
{
       if(IsPlayerInAnyVehicle(playerid)) return 0;
       new Float:x, Float:y, Float:z, Float:px, Float:py, Float:pz, Float:Zval;
       GetPlayerPos(playerid, px, py, pz);
       for(new i = 0; i < MAX_VEHICLES; i++)
       {
              if(IsValidVehicle(i))
              {
                       GetVehiclePos(i, x, y, z);
                       if(IsPlayerInRangeOfPoint(playerid, x, y, z, 2) && !jumping[playerid])
                       {
                                GetPointZPos(px, py, Zval);
                                if(pz > Zval) return 1;
                       }
               }
      }
      return 0;
}

EDIT:I didnt test it or compile, if it's not working tell me
__________________
GameOvr is offline   Reply With Quote