Help me... - 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: Help me... (
/showthread.php?tid=256306)
Help me... -
Tadeo - 20.05.2011
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!
Re: Help me... -
Elka_Blazer - 20.05.2011
Use a loop(for)
Re: Help me... -
Tadeo - 20.05.2011
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; }
Re: Help me... -
Steve M. - 20.05.2011
Give us your GetClosetVeh() function.
Re: Help me... -
Tadeo - 20.05.2011
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; }