It's not working
#1

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/engine", true) == 0)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"{FF6A22}INFO: {FFFFFF}You need to be in vehicle to start engine.");
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"{FF6A22}INFO: {FFFFFF}You need to be driver to use this command.");
        SendClientMessage(playerid, COLOR_PURPLE,"{00FF00}INFO: {FFFFFF}You twist the key, and wait 4 seconds.");
        //if(Eng[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"{FF6A22}INFO: {FFFFFF}You already turned engine on.");
        SetTimerEx("EngStart", 4000, false, "d", playerid);
        if(engine == 1)
        {
            SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
            SendClientMessage(playerid, COLOR_PURPLE,"{00FF00}INFO: {FFFFFF}Engine turned off.");
            return 1;
        }
        return 1;
    }
Well above is my code.. this code works only to turn on engine, but I want to detect if engine is already turned on it will shut it down...

I tried with
pawn Код:
if(engine[vehicle] == 1)
but I get these errors if I use this if statement above..
nvalid subscript (not an array or too many subscripts): "engine"
expression has no effect
expected token: ";", but found "]"
invalid expression, assumed zero
too many error messages on one line[/pawn]

if you need more code let me know thanks for help in advance
Reply


Messages In This Thread
It's not working - by Lajko1 - 20.11.2013, 21:09
Re: It's not working - by InglewoodRoleplay - 20.11.2013, 21:19
Re: It's not working - by Lajko1 - 20.11.2013, 21:31
Re: It's not working - by InglewoodRoleplay - 20.11.2013, 21:42
Re: It's not working - by Lajko1 - 20.11.2013, 21:43

Forum Jump:


Users browsing this thread: 1 Guest(s)