Problems again( :( )!!!
#1

So now it's working as it shoudl be working but the problem is that when I stop the car (without turning the engine off it shows me again press 2 to turn engine on it keeps showing me that gametext):

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       ToggleEngine(playerid);
       GameTextForPlayer(playerid,"Press 2 to turn on engine!!!",100,4);
       if (PRESSED( KEY_SUBMISSION ))
       {
        ToggleEngine(playerid);
        GameTextForPlayer(playerid,"Engine is turned on.",500,4);
        return 1;
       }
    }
So,as I said aafter I turn the engine on,when I slow down it shows me again(I ONLY SLOW DOWN I DON'T TURN OFF THE ENGINE ) Press 2 to turn engine on.How to solve this?
Reply
#2

somebody please?
Reply
#3

Hi.

Add this at TOP of your GM:
pawn Код:
new PlayerHasEngineOn[MAX_PLAYERS];
This at OnPlayerDisconnect and OnPlayerExitVehicle:
pawn Код:
PlayerHasEngineOn[playerid] = 0;
Your code:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PlayerHasEngineOn[playerid] == 0)
    {
       ToggleEngine(playerid);
       GameTextForPlayer(playerid,"Press 2 to turn on engine!!!",100,4);
       if (PRESSED( KEY_SUBMISSION ))
       {
        PlayerHasEngineOn[playerid] = 1;
        ToggleEngine(playerid);
        GameTextForPlayer(playerid,"Engine is turned on.",500,4);
        return 1;
       }
    }
Where you set engine off:
pawn Код:
PlayerHasEngoneOn[playerid] = 0;
0 = Off
1 = On

I hope this is what you need, else feel free to ask again. ^^

Happy Easter!


Jeffry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)