Help me...
#1

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!
Reply
#2

Use a loop(for)
Reply
#3

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; }
Reply
#4

Give us your GetClosetVeh() function.
Reply
#5

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; }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)