Help with IsPlayerNearAnyVehicle (rep+)
#1

Not work IsPlayerNearAnyVehicle

Код:
if(strcmp("/elegy", cmdtext, true, 10) == 0)
{
    if(IsPlayerNearAnyVehicle(playerid, 35))
    {
        new Float:X,Float:Y,Float:Z,Float:Angle, carid;
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);
        carid = GetPlayerVehicleID(playerid);
        carid = CreateVehicle(562,X,Y,Z,Angle,-1,-1,600);
        PutPlayerInVehicle(playerid,carid,0);
        TogglePlayerControllable(playerid, true);
        return SendClientMessage(playerid, COLOR_GREY, "Elegy was spawned!");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Not spawned, 35 distance!");
    }
    return 1;
}
stock IsPlayerNearAnyVehicle(playerid, Float:distance)
{
    new Float:x, Float:y, Float:z;
    for(new i; i < MAX_VEHICLES; i++)
    {
        if(GetVehicleModel(i))
        {
            GetVehiclePos(i, x, y, z);
            if(GetPlayerDistanceFromPoint(playerid, x, y, z) <= distance) return 1;
        }
    }
    return 0;
}
Reply
#2

pawn Код:
if(GetVehicleModel(i))
        {
            GetVehiclePos(i, x, y, z);
            if(GetPlayerDistanceFromPoint(playerid, x, y, z) <= distance) return 1;
        }
I hope you know that GetVehicleModel() returns the MODEL ID of the vehicle, not the vehicle ID?
Reply
#3

Well this applies to all model ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)