Wrong value seen?
#1

Hello,

I'm making something, but at some if/elseif statement there seems to be a little problem.

First the player types a command and "pGambleProgress" is set to 1. After some other dialogs he comes to a point where a draw is done, and one extra pGameProgress is added. That's in this code:

pawn Код:
PlayerInfo[playerid][pGambleProgress] += 1;
            if(PlayerInfo[playerid][pGambleProgress] < 4)
            {
                format(add, sizeof(add), "{DEF7E4}Slot 1: %s\n{DEF7E4}Slot 2: %s\n{DEF7E4}Slot 3: %s\n{DEF7E4}Slot 4: %s", slot1, slot2, slot3, slot4);
                strcat(dialog, add);
                ShowPlayerDialog(playerid, GAMBLE_LOCK, DIALOG_STYLE_LIST, "Slot Machine", dialog, "Lock", "Don't lock");
            }
            else //END OF GAMBLE
            {
                SendClientMessageEx(playerid, COLOR_YELLOW, "else statement triggered");
            }

Now 1 + 1 = 2, but in the script it's seen as "above 4" as the else statement is triggered. How...?
Reply
#2

Well, you need to set the PlayerInfo[playerid][pGambleProgress] variable to 0 somewhere... You just add + 1 to it ... but I can't see where you set it to 0.
Reply
#3

Upon entering the command /gamble:
pawn Код:
PlayerInfo[playerid][pGambleProgress] = 0;
And then at the next dialog it's
pawn Код:
PlayerInfo[playerid][pGambleProgress] = 1;
Reply
#4

I can't seem to figure out the problem from the code posted by you ... How about posting the 'some other dialogs' too ? Post the whole dialogs please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)