[PROBLEM] Engine messange
#1

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...");
        }
    }
Reply
#2

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

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.
Reply
#4

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."));
Reply
#5

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
Reply
#6

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.
Reply
#7

Код:
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);
            }
        }
Reply
#8

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.
Reply
#9

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!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)