06.05.2014, 15:21
I created the command / engine to adjust the switching on and off of each individual vehicle. The problem is one. As soon as I get in the vehicle, the engine is off, but if I type the command / engine, it gives me the message "engine shutdown" - as if it was on, even if in reality it is not.
I think I need to set a variable that identifies each vehicle that spawns as off.. the problem is that I do not know where to put this variable.
code:
I think I need to set a variable that identifies each vehicle that spawns as off.. the problem is that I do not know where to put this variable.
code:
PHP код:
public OnGameModeInit()
{
ManualVehicleEngineAndLights();
public OnPlayerCommandText(playerid, cmdtext[])
{
COMMAND:engine(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new str[128];
new vehicle = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
{
SetVehicleParamsEx(vehicle,1,1,alarm,doors,bonnet,boot,objective);
format(str, sizeof(str), "* %s accende il motore del veicolo", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 10);
}
else
{
SetVehicleParamsEx(vehicle,0,0,alarm,doors,bonnet,boot,objective);
format(str, sizeof(str), "* %s spegne il motore del veicolo", GetICName(playerid)); /// this is the message that appears the first time I type /engine, even if the vehicle is turned off
SendNearByMessage(playerid, ACTION_COLOR, str, 10);
}
}
return 1;
}