What's wrong with my if statement?
#1

Hello, I got a little weird problem/bug

I'm making a minigame, and now I'm busy with the 'stock LeaveGame' function.

Here's the code:

pawn Код:
stock LeaveCaveGame(playerid)
{
    SInfo[CaveCount] --;
    PInfo[playerid][CaveGame] = 0;
   
    printf("%d leavecavegame called", SInfo[CaveCount]);
   
    if(SInfo[CaveCount] == 0)
    {
        new string [256], PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName,sizeof PlayerName);
        format (string, sizeof string, "[CAVE]The Game has ended, %s stayed alive for %s, server record: lala, typer /cave to try it yourself", PlayerName, ReturnSToM(SInfo[CaveUpdateCount]));
        SendClientMessageToAll(COLOR_ORANGE, string);
        SendClientMessage(playerid,COLOR_ORANGE ,"[CAVE]You won in blabla, your best: blabla");
       
        SInfo[CaveRunning] = 0;
        SInfo[CaveJoining] = 0;
       
        KillTimer(SInfo[CaveUpdateTimer]);
    }
   
    else if(SInfo[CaveCount] > 0)
    {
        SendClientMessage(playerid,COLOR_ORANGE ,"[CAVE]... has dropped out blabla");
    }
    return 1;
}
and this:
pawn Код:
LeaveCaveGame(playerid);//OnPlayerDeath
Well, so I go ingame, in the game, die, and then the function should be called, so normally it should give me the messages
pawn Код:
SendClientMessageToAll(COLOR_ORANGE, string);
        SendClientMessage(playerid,COLOR_ORANGE ,"[CAVE]You won in blabla, your best: blabla");
But it doesn't do that... So I thought, okay there's something wrong with:
pawn Код:
SInfo[CaveCount]
But when I added the print line, and I looked in the server log I saw that the array was 0, however the messages weren't called...

Do you know what could be wrong?
Thanks in advance
Reply


Messages In This Thread
What's wrong with my if statement? - by knackworst - 10.09.2013, 11:08
Re: What's wrong with my if statement? - by knackworst - 10.09.2013, 11:24
Re: What's wrong with my if statement? - by Konstantinos - 10.09.2013, 11:26
Re: What's wrong with my if statement? - by knackworst - 10.09.2013, 11:37
Re: What's wrong with my if statement? - by Konstantinos - 10.09.2013, 12:02

Forum Jump:


Users browsing this thread: 2 Guest(s)