Jobs.
#3

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
pawn Код:
if(GunoierJob[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, 2741.6865,-1504.8694,30.9064, 5.0);
        GivePlayerMoney(playerid, 5043);
        SendClientMessage(playerid, -1, "{FFCC33}Ai primit {FF0000}5043 $ {FFCC33}pentru primul transport al gunoiului!");
        GunoierJob[playerid] = 2;
        return 1; // Add this in all if-statements
    }
The problem is that the first if-statement is executed, the next job-step is set (value 2), and the next if-statement is executed as well, because the second if-condition becomes true.
This is done all the way until the end.

Putting "return 1;" in all if-statements skips them all.

Or convert it to a switch-case structure, then only 1 condition is executed, like this:
pawn Код:
switch (GunoierJob[playerid])
{
    case 1:
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, 2741.6865,-1504.8694,30.9064, 5.0);
        GivePlayerMoney(playerid, 5043);
        SendClientMessage(playerid, -1, "{FFCC33}Ai primit {FF0000}5043 $ {FFCC33}pentru primul transport al gunoiului!");
        GunoierJob[playerid] = 2;
    }
    case 2:
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, 2703.7903,-1065.6555,69.8232, 5.0);
        GivePlayerMoney(playerid, 4321);
        SendClientMessage(playerid, -1, "{FFCC33}Ai primit {FF0000}4321 $ {FFCC33}pentru al doilea transport al gunoiului!");
        GunoierJob[playerid] = 3;
    }
    ...
}
Love u man.

-
-
-
-
-
-
Just joke man, thank you. +rep.
Reply


Messages In This Thread
Jobs. - by HY - 28.11.2014, 18:25
Re: Jobs. - by PowerPC603 - 28.11.2014, 18:29
Re: Jobs. - by HY - 28.11.2014, 18:39

Forum Jump:


Users browsing this thread: 2 Guest(s)