SA-MP Forums Archive
GetVehiclePos problem - 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: GetVehiclePos problem (/showthread.php?tid=665526)



GetVehiclePos problem - bosmania - 07.04.2019

I have this command and for some reason it gives me that error,"You aren't near your rented vehicle",even though im in the vehicle,and yes i checked,RentedVehicle[playerid] is the vehicle that im in range of,not other vehicle,and it still says im not in range,help./




CMD:lockrented(playerid, params[])
{

if(Rented[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have a rented car");

new rx,ry,rz;
GetVehiclePos(RentedVehicle[playerid], rx, ry, rz);

if(IsPlayerInRangeOfPoint(playerid, 5, rx, ry ,rz))
{
if(LockedVeh[GetPlayerVehicleID(playerid)] == 0)
{
LockedVeh[GetPlayerVehicleID(playerid)] = 1;
}
else
{
LockedVeh[GetPlayerVehicleID(playerid)] = 0;
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You aren't near your rented vehicle");
return 1;
}


Re: GetVehiclePos problem - justinnater - 07.04.2019

GetVehiclePos returns the float in the given variable.
Meaning, the variable rx ry rz should be a float type.


Re: GetVehiclePos problem - ImTobi - 07.04.2019

You have to put new Float: rx,ry,rz;


Re: GetVehiclePos problem - Yukie - 08.04.2019

change your
Code:
new rx, ry, rz;
to
Code:
new Float:rx, ry, rz;



Re: GetVehiclePos problem - Markski - 08.04.2019

You need to mark all 3 variables as float, not only the first one.

Code:
new Float:rx, Float:ry, Float:rz;



Re: GetVehiclePos problem - bosmania - 08.04.2019

I did that and it still gives me the same error