IsPlayerNearVehicle(playerid, vehicleid, Float:distance) - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) (
/showthread.php?tid=275728)
IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
Riddick94 - 10.08.2011
Okey so i helped alot people so maybe now someone help me?
I need to make a function what i wrote above. IsPlayerNearVehicle(playerid, vehicleid, Float:distance). I made alot of this functions but it doesn't works because vehicle is not streamed. How to stream them in OnVehicleStreamIn?
Re: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
Sascha - 10.08.2011
try this..
pawn Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:distance)
{
new m = GetVehicleModel(vehicleid);
if(m == 0) return 0;
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
if(!IsPlayerInRangeOfPoint(playerid, distance, x, y, z)) return 0;
return 1;
}
not tested it yet though
Re: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
Jefff - 10.08.2011
http://forum.sa-mp.com/search.php?searchid=2852162
Re: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
AustinJ - 10.08.2011
Should be as simple as this shouldn't it?
Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:range)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
return 1;
}
return 0;
}
Re: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
Riddick94 - 10.08.2011
Wow, wow, wow! chill all! i fixed it already
pawn Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:range)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vehicleid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, range, X, Y, Z))return true;
else return false;
}
Re: IsPlayerNearVehicle(playerid, vehicleid, Float:distance) -
Jefff - 10.08.2011
You can use that
pawn Код:
native Float:GetVehicleDistanceFromPoint(vehicleid, Float:X, Float:Y, Float:Z);
Quote:
Originally Posted by AustinJ
Should be as simple as this shouldn't it?
Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:range)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
return 1;
}
return 0;
}
|
simply
pawn Код:
stock IsPlayerNearVehicle(playerid, vehicleid, Float:range)
{
if(!GetVehicleModel(vehicleid)) return 0;
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
return IsPlayerInRangeOfPoint(playerid, range, x, y, z);
}