SA-MP Forums Archive
[PROBLEM] Engine messange - 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)
+--- Thread: [PROBLEM] Engine messange (/showthread.php?tid=515650)



[PROBLEM] Engine messange - monster010 - 27.05.2014

I put that scrip at OnPlayerStateChange, and when a get in the car which is reserved:

pawn Код:
if(IsAmayorCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pMember] == 7) { }
            else {
                SendClientMessage(playerid,COLOR_GREY,"* You are not a {66FF00}Parliamentary {808080}member !");
                RemovePlayerFromVehicle(playerid);
            }
        }
That script above does not work, but if I delete the script (which is the cause), the gamemode works perfectly:

pawn Код:
if (newstate == PLAYER_STATE_DRIVER)
    {
        if(Engine[vehicle] == 0)
        {
            SendClientMessage(playerid,COLOR_GREY,"* Press {FFCC00}'2'{FFFFFF} to start engine.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREY, "Engine is {66FF00}running...");
        }
    }



Re: [PROBLEM] Engine messange - Parallex - 27.05.2014

Can you describe what is not working more? Also, are you getting any errors/warnings?


Re: [PROBLEM] Engine messange - monster010 - 27.05.2014

When I put:
pawn Код:
if (newstate == PLAYER_STATE_DRIVER)
    {
        if(Engine[vehicle] == 0)
        {
            SendClientMessage(playerid,COLOR_GREY,"* Press {FFCC00}'2'{FFFFFF} to start engine.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREY, "Engine is {66FF00}running...");
        }
    }
Ruin OnPlayerStateChange.


Re: [PROBLEM] Engine messange - Threshold - 27.05.2014

Get rid of the 'return 1;'.
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
        SendClientMessage(playerid, COLOR_GREY, (Engine[vehicle]) ? ("Engine is {66FF00}running...") : ("* Press {FFCC00}'2'{FFFFFF} to start engine."));



Re: [PROBLEM] Engine messange - Lacamora - 27.05.2014

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Get rid of the 'return 1;'.
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
        SendClientMessage(playerid, COLOR_GREY, (Engine[vehicle]) ? ("Engine is {66FF00}running...") : ("* Press {FFCC00}'2'{FFFFFF} to start engine."));
explain us more please what's the diffirance


Re: [PROBLEM] Engine messange - Threshold - 27.05.2014

The difference is that the code is shorter and can be combined into 1 line if preferred, and the code won't stop because there is no 'return' breaking the callback at any point in that code.


Re: [PROBLEM] Engine messange - Rittik - 27.05.2014

Код:
if(IsAmayorCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] != 7 || PlayerInfo[playerid][pMember] != 7) 
{
                SendClientMessage(playerid,COLOR_GREY,"* You are not a {66FF00}Parliamentary {808080}member !");
                RemovePlayerFromVehicle(playerid);
            }
        }



Re: [PROBLEM] Engine messange - Threshold - 27.05.2014

Oh I forgot about that bit.

pawn Код:
if(IsAmayorCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] != 7 && PlayerInfo[playerid][pMember] != 7)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You are not a {66FF00}Parliamentary {808080}member !");
                RemovePlayerFromVehicle(playerid);
            }
        }
Nearly had it Rittick.


Re: [PROBLEM] Engine messange - monster010 - 27.05.2014

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Get rid of the 'return 1;'.
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
        SendClientMessage(playerid, COLOR_GREY, (Engine[vehicle]) ? ("Engine is {66FF00}running...") : ("* Press {FFCC00}'2'{FFFFFF} to start engine."));
SOLVED. Thank's!