Vehicle radius - 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: Vehicle radius (
/showthread.php?tid=575018)
Vehicle radius -
Shazwan - 23.05.2015
How to make like a radius that must be near the vehicle.
Example vehicle that i want is shamal.
Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 519) //shamal
The message send to client is "You are not near the shamal!".
Any ideas? I did try it on my own but failed, and i really need help.
Re: Vehicle radius -
Alpay0098 - 23.05.2015
Can you edit your post (language problems).
No one can't understand what you're sayin
Re: Vehicle radius -
Shazwan - 23.05.2015
Example,
They must be near the shamal to use /gunstorage, If they wasn't near the shamal it will tell the player that "you are not near the shamal!".
Re: Vehicle radius -
Alpay0098 - 23.05.2015
You can use like below in /gunstroage scripts :
PHP код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(GetVehicleModel(i) == 519)
{
new Float:shax, Float:shay, Float:shaz;
GetVehiclePos(i, shax, shay, shaz);
if(IsPlayerInRangeOfPoint(playerid,8.0,shax,shay,shaz))
{
// Any code that you wanna put.
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not near a Shamal!");
return 1;
}
}
}
Re: Vehicle radius -
dominik523 - 23.05.2015
Are you looking for something like this?
pawn Код:
CMD:gunstorage(playerid, params[])
{
new vehicleid
if(ssanf(params, "d", vehicleid))
return 1;
if(GetVehicleModel(vehicleid) != 519)
return 1;
new Float:Pos[3];
GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2]))
{
// do something here
}
return 1;
}
This is an example where you have to enter vehicle's ID in the command. You could run a loop to find out is player standing near any shamal.
Re: Vehicle radius -
Shazwan - 23.05.2015
Thanks again, rep+