IsPlayerNearVehicle
#1

why this doesn't work :O?

pawn Код:
stock IsPlayerNearVehicle(playerid,vehicleid)
{
    new Float:VX,Float:VY,Float:VZ;
    GetVehiclePos(vehicleid,VX,VY,VZ);
    if(IsPlayerInRangeOfPoint(playerid,1.0,VX,VY,VZ)) return 1;
    else return 0;
}
Reply
#2

I think vehicle positions are synced by players being in them. Or maybe you need to try changing the radius to something higher than 1.0 because you would need to be like right at the vehicle for it to work.
Reply
#3

I doubt this would work in anything because onplayerentervehicle is the only callback that returns a vehicleid.

And you can't use GetPlayerVehicleID because you're supposed to be near it not in it.
Reply
#4

what about if i replace the IsPlayerNearVehicle with IsPlayerNearObject would that work?
Reply
#5

Vehicle should be streamed in for that player as Backwardsman97 said try changing the radius.
Reply
#6

Quote:
Originally Posted by Schurman
Посмотреть сообщение
I doubt this would work in anything because onplayerentervehicle is the only callback that returns a vehicleid.

And you can't use GetPlayerVehicleID because you're supposed to be near it not in it.
lol?

try like 7 raduis, 1.0 is like, you'd have to be almost exactly in the middle of the car
Reply
#7

you can try my stock it never gave me problems
pawn Код:
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid,PX,PY,PZ);
        GetVehiclePos(vehicleid, X,Y,Z);
        new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
        if(Distance <= radi*radi)
        {
            return true;
        }
    }
    return false;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)