Posts: 111
Threads: 6
Joined: Feb 2016
Reputation:
0
I am searching for a stock or just functions; when a player is near a vehicle, and that vehicle near him is owned by this near player, nearanownvehicle[playerid]=1;
and when the player obviously go away it back to [playerid]=0;
Thanks to all that will think on that.
Regards,
Rodri.
Posts: 455
Threads: 29
Joined: Apr 2014
It all depends, what type of vehicle system you have there, good or bad.
PHP Code:
#define max_cars 50
IsPlyNearOwnVeh(pid){
new Float:p[3];
GetPlayerPos(pid,p[0],p[1],p[2]);
for(new i; i < max_cars; i++){
if( !Veh[i][slot] || Veh[i][Owner]!=User[pid][sid] || GetVehicleDistanceFromPoint(Veh[i][slot],p[0],p[1],p[2]) > 5 )continue;
return 1
}
return 0;
}
Posts: 341
Threads: 59
Joined: Jul 2010
Reputation:
0
Apologies, I meant IsPlayerInRangeOfPoint in my above message.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
First use GetVehiclePoolSize() to determine the highest vehicle id to cut down on iterations. Then also use IsVehicleStreamedIn() to weed out any non-streamed vehicles.