Posts: 15
Threads: 2
Joined: Mar 2011
Reputation:
0
Hello Guys!
How i can usa this function without enter in a Vehicle?
I need a script for Start the Function whit a Vehicle nearest a Player...
SetVehicleParamsEx
Please, Thanks!
Posts: 15
Threads: 2
Joined: Mar 2011
Reputation:
0
Mmmh...?
Please give me an example...
This is my Script, but don't work:
if(strcmp(cmd, "/OpenBon",true) == 0)
{
new AVEH = GetClosestVeh(MAX_VEHICLES);
// This Work
if(IsPlayerInAnyVehicle(playerid))
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid, Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
SetVehicleParamsEx(vid, Engine, Lights, Alarm, Doors, ON, Boot, Objective);
}
}
// This DON'T Work
if(!IsPlayerInAnyVehicle(playerid))
{
if(AVEH != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(AUTO, Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
SetVehicleParamsEx(AUTO, Engine, Lights, Alarm, Doors, ON, Boot, Objective);
}
}
return 1; }
Posts: 93
Threads: 15
Joined: Dec 2010
Reputation:
0
Give us your GetClosetVeh() function.
Posts: 15
Threads: 2
Joined: Mar 2011
Reputation:
0
forward GetClosestVeh(v1);
public GetClosestVeh(v1) {
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x = 0; x < MAX_VEHICLES; x++) {
if(x != v1) {
dis2 = GetDistanceBetweenPV(x,v1);
if(dis2 < dis && dis2 != -1.00) {
dis = dis2; player = x; } } } return player; }