SA-MP Forums Archive
Problems again( :( )!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems again( :( )!!! (/showthread.php?tid=250780)



Problems again( :( )!!! - Cjgogo - 24.04.2011

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?


Re: Problems again(:()!!! - Cjgogo - 24.04.2011

somebody please?


Re: Problems again( :( )!!! - Jeffry - 24.04.2011

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