SA-MP Forums Archive
I need help with this fuction - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help with this fuction (/showthread.php?tid=659290)



I need help with this fuction - eduarditociudadela - 29.09.2018

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!


Re: I need help with this fuction - Electrifying - 29.09.2018

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


Re: I need help with this fuction - eduarditociudadela - 29.09.2018

Код:
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


Re: I need help with this fuction - Electrifying - 29.09.2018

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


Re: I need help with this fuction - eduarditociudadela - 29.09.2018

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

Anyway, it does not work either