all vehicles off default help - 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: all vehicles off default help (
/showthread.php?tid=338127)
all vehicles off default help -
TheDiscussionCafe - 29.04.2012
how do I make all my vehicles off when i enter a vehicle
here is my /engine code:
pawn Код:
cmd(engine, playerid, params[]) // Engine on/off
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_CYAN, "[VEHICLE] You have turned off your vehicle");
return 1;
}
SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_CYAN, "[VEHICLE] You have turned on your vehicle");
return 1;
}
return SendClientMessage(playerid, COLOR_ERROR, "You must be in a vehicle to use this command.");
}
but when i enter vehicle it is already automatically on. i want it automatically off. how?
Re: all vehicles off default help -
Jonny5 - 29.04.2012
something like this in OnGameModeInit()
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
for(new i=1;i!=MAX_VEHICLES;i++)
{
GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(i, 0, lights, alarm, doors, bonnet, boot, objective);
}
edit sorry actually you should do
pawn Код:
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
}
either will work but the second is better i think,
but will cause the lights to need a command also.
Re: all vehicles off default help -
TheDiscussionCafe - 29.04.2012
Quote:
Originally Posted by Jonny5
something like this in OnGameModeInit()
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective; for(new i=1;i!=MAX_VEHICLES;i++) { GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(i, 0, lights, alarm, doors, bonnet, boot, objective); }
edit sorry actually you should do
pawn Код:
public OnGameModeInit() { ManualVehicleEngineAndLights(); }
either will work but the second is better i think,
but will cause the lights to need a command also.
|
both work perfect! thx!