OnPlayerUpdate
#1

Hi, I tried to do this function to show a textdraw if a player is within a distance of 7.0 of a vehicle, but, if it moves away from that particular range, hide the textdraw, but when executed, it is only displayed when I get on the vehicle.


PHP код:
public OnPlayerUpdate(playerid)
{
new 
Float:v_Pos[3], Modelo;
Modelo GetPlayerVehicleID(playerid);
GetVehiclePos(Modelov_Pos[0], v_Pos[1], v_Pos[2]);
GetPlayerPos(playeridMostrar[playerid][CercaPos][0], Mostrar[playerid][CercaPos][1], Mostrar[playerid][CercaPos][2]);
Mostrar[playerid][CercaPos][0] = v_Pos[0];
Mostrar[playerid][CercaPos][1] = v_Pos[1];
Mostrar[playerid][CercaPos][2] = v_Pos[2];
if(
IsPlayerInRangeOfPoint(playerid7.0v_Pos[0], v_Pos[1], v_Pos[2]))
{
    
TextDrawShowForPlayer(playeridAutoCerca[playerid]);
} else {
    
TextDrawHideForPlayer(playeridAutoCerca[playerid]);
    return 
true;
}

Reply
#2

Better to use the streamer plugin so you can attach a dynamic circular area to a vehicle. You can then use the enter and leave callbacks so you don't have to rely on OnPlayerUpdate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)