Check this thread: https://sampforum.blast.hk/showthread.php?tid=453546
I think this impossible, What do you want to do? |
There is a SA:MP bug when you teleport to random location and players that are standing on your vehicle will teleport with you.
|
Alternatively, you can use the SAMap plugin to retrieve the Z position (if the player is on the ground) and do it like that?
|
Maybe this method will help, I have no other idea.
1) Check if the player is in the vehicle. 2) If he is in a vehicle, save the model and coordinates then destroy the vehicle. 3) Create the vehicle after the player is teleported. 4) Put the player in the vehicle as driver. That way, players are standing on vehicle won't teleport with driver. |
#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;
}
You have to use MapAndreas include by Ryder to get this in the working state..
EDIT:I didnt test it or compile, if it's not working tell me |
stock IsPlayerOnVehicle(playerid) // By GameOvr, just made for you :D
{
if(IsPlayerInAnyVehicle(playerid)) return INVALID_VEHICLE_ID;
new Float:x, Float:y, Float:z, Float:px, Float:py, Float:pz, Float:Zval;
GetPlayerPos(playerid, px, py, pz);
foreach(new i : Vehicle)
{
GetVehiclePos(i, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z) && jumping[playerid] == 0)
{
MapAndreas_FindZ_For2DCoord(px, py, Zval);
if(pz > Zval) return i;
}
}
return INVALID_VEHICLE_ID;
}