Lights command -
Timeless - 06.07.2014
PHP код:
CMD:lights(playerid, params[])
{
new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "Error: You are not in a vehicle.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid, COLOR_RED, "Error: You are not in the drivers seat.");
if(lights == 0)
{
SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
}
else
{
SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
}
return 1;
}
errm well i created a /lights command it worked 100% when i tested it but after i went to sleep got up restarted the server.. if u do /lights the lights only come on when the player exits the vehicle O.o
whats up with that?
i also have a /engine command that works 100% so whats wrong
Re: Lights command -
Vanter - 06.07.2014
https://sampforum.blast.hk/showthread.php?tid=456791
Re: Lights command -
nmader - 06.07.2014
Quote:
Originally Posted by Vanter
|
Can't you actually post something to help him?
pawn Код:
ManualVehicleEngineAndLights();
Put that under OnGameModeInit. Your situation seems to be that they're controlled by your player's status, like how it is in single player.
Re: Lights command -
Timeless - 07.07.2014
Quote:
Originally Posted by nmader
Can't you actually post something to help him?
pawn Код:
ManualVehicleEngineAndLights();
Put that under OnGameModeInit. Your situation seems to be that they're controlled by your player's status, like how it is in single player.
|
@vanter isn't that some form of advertising? lool and i looked at your code and it isn't different from mine
@nmader errm is there a way to turn on your lights and engine free at will? but still keep the engine automatically on so when a player enters it he doesn't have to type /engine to turn it on
Re: Lights command -
Vanter - 07.07.2014
then freaking when player enters vehicle, get vehicle Id and set vehicle params ex
Re: Lights command -
Timeless - 07.07.2014
Quote:
Originally Posted by nmader
Can't you actually post something to help him?
pawn Код:
ManualVehicleEngineAndLights();
Put that under OnGameModeInit. Your situation seems to be that they're controlled by your player's status, like how it is in single player.
|
Quote:
Originally Posted by Vanter
then freaking when player enters vehicle, get vehicle Id and set vehicle params ex
|
Wow and your attitude is gonna help me how? nice example.Thanks for your "help"
Re: Lights command -
Threshold - 07.07.2014
Vehicles are on by default. As long as you aren't using SetVehicleParamsEx under OnPlayerStateChange or OnPlayerEnterVehicle, you shouldn't have a problem with the engine being disabled.
pawn Код:
CMD:lights(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "Error: You are not in the drivers seat of any vehicle.");
new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, (lights) ? (0) : (1), alarm, doors, bonnet, boot, objective);
return 1;
}
Re: Lights command -
Timeless - 07.07.2014
my internet chipped sorry for that double post
Re: Lights command -
Timeless - 07.07.2014
Quote:
Originally Posted by Threshold
Vehicles are on by default. As long as you aren't using SetVehicleParamsEx under OnPlayerStateChange or OnPlayerEnterVehicle, you shouldn't have a problem with the engine being disabled.
pawn Код:
CMD:lights(playerid, params[]) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "Error: You are not in the drivers seat of any vehicle."); new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, engine, (lights) ? (0) : (1), alarm, doors, bonnet, boot, objective); return 1; }
|
thanks for your effort in helping me thres but with your code the lights come on for about 2 seconds then comes back off and when i'm on foot :S
i checked back the two callbacks u mentioned and i don't have SetVehicleParamsEx or anything of that sort under them /:
and i find it weird cause the /engine command works and its formatted the same as the lights command ._.
Re: Lights command -
Threshold - 07.07.2014
Are you sure you don't have SetVehicleParamsEx anywhere else in your code that might be affecting this?
(CTRL + F, "SetVehicleParams")