GetVehicleWithinDistance 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: GetVehicleWithinDistance problem. (
/showthread.php?tid=279832)
GetVehicleWithinDistance problem. -
Darnell - 29.08.2011
Well, I posted before a noobie question, and here's another one.
I'm keep getting an error that symbol "x" is undefined, on GetVehicleWithinDistance.
pawn Код:
GetVehicleWithinDistance( playerid, Float:x1, Float:y1, Float:z1, Float:dist, &veh){//It should be in script other wise the GetVehicleWithInDistance will not work
for(new i = 1; i < MAX_VEHICLES; i++){
if(GetVehicleModel(i) > 0){
if(GetPlayerVehicleID(playerid) != i ){
new Float:x, Float:y, Float:z;
new Float:x2, Float:y2, Float:z2;
GetVehiclePos(i, x, y, z);
x2 = x1 - x; y2 = y1 - y; z2 = z1 - z;
new Float:vDist = (x2*x2+y2*y2+z2*z2);
if( vDist < dist){
veh = i;
dist = vDist;
}
}
}
}
}
& The line with the error :
pawn Код:
GetVehicleWithinDistance(playerid, x, y, z, 8.0, veh);
Any idea ?
Re: GetVehicleWithinDistance problem. -
Darnell - 29.08.2011
Fixed.