06.05.2014, 15:39
Don't use OnPlayerCommandText at all if you use ZCMD. The callbacks should be out of any callback.
You get the vehicle's parameter but you never check whether the engine is off or not.
You get the vehicle's parameter but you never check whether the engine is off or not.
pawn Код:
COMMAND:engine(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new str[60], vehicle = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
if (!engine)
{
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;
}