I need help with this fuction
#1

Hi everybody, my problem is with this function, i don't know why don't work. I copied this exactly of the wiki


Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
    // Check if it moved far	
    if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 50.0)
    {
        // Reject the update
        return 0;
    }
 
    return 1;
}
It is assumed that if the vehicle moves 50 meters it would have to return value 0, but not, Thanks!
Reply
#2

the code work but it is returning a value 0, there's nothing there for the code to do, the only thing it does is check if the car went away then returns zero
Reply
#3

Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
    // Check if it moved far	
    if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 50.0)
    {
         SendClientMessage(playerid, COLOR_RED, "Works");
    }
 
    return 1;
}
It does not work either
Reply
#4

Quote:
Originally Posted by eduarditociudadela
Посмотреть сообщение
Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
{
    // Check if it moved far	
    if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 50.0)
    {
         SendClientMessage(playerid, COLOR_RED, "Works");
    }
 
    return 1;
}
It does not work either
"This callback is called when a player's client updates/syncs the position of a vehicle they're not driving. This can happen outside of the vehicle or when the player is a passenger of a vehicle that has no driver."

use GetPlayerVehicleID(playerid); on if
Reply
#5

If I use GetPlayerVehicleID (playerid) the condition only works if someone is a passenger in the vehicle.

Anyway, it does not work either
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)