Vehicle is turned off via script
#2

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.
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;
}
Reply


Messages In This Thread
Vehicle is turned off via script - by uTorrent - 06.05.2014, 15:21
Re: Vehicle is turned off via script - by Konstantinos - 06.05.2014, 15:39
Re: Vehicle is turned off via script - by uTorrent - 06.05.2014, 15:45
Re: Vehicle is turned off via script - by Konstantinos - 06.05.2014, 15:47
Re: Vehicle is turned off via script - by Vince - 06.05.2014, 15:56
Re: Vehicle is turned off via script - by uTorrent - 06.05.2014, 16:00

Forum Jump:


Users browsing this thread: 2 Guest(s)