Not Showing up
#1

Solved
Reply
#2

How are you calling that function? With a timer? If so let me see the timer code.

Also does the money part of the script work? That will tell you if it's the if statement that's causing the problem.
Reply
#3

Solved
Reply
#4

Use SetTimerEx ( Wiki ), or loop through all players on your current function.
Reply
#5

Quote:
Originally Posted by Kitten
Посмотреть сообщение
the money part doesnt actually work either

heres the other part of the code that calls the function is on
pawn Код:
OnGameModeInit
which is a timer

pawn Код:
SetTimer("DEFWIN",300000,false); // 5 min
There's your problem, it will only work for a single player, because there is no playerid passed to the callback, therefore it will default to 0 and run all of the code for ID 0. Which basically defeats the purpose of the code!

So what you need to do is take out that playerid parameter, and implement a loop in the code or something along those lines.
Reply
#6

pawn Код:
public DEFWIN()
{
    SendClientMessageToAll(COLOR_WHITE, "SERVER: Defenders won");
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] == TEAM_ATTACKERS)
            {
                GameTextForPlayer(playerid, "~g~ YOUR TEAM LOST ~n~~y~-1000", 6000, 4);
                GivePlayerMoney(playerid, -1000);
            }
            else if(gTeam[playerid] == TEAM_DEFENDERS)
            {
                GameTextForPlayer(playerid, "~r~ YOUR TEAM WON ~n~~y~+5000", 6000, 4);
                GivePlayerMoney(playerid, 5000);
            }
        }
    }
    SetTimer("Finshed", 8000, false);
    return 1;
}
And btw do not set the timer for every single player. Just set it once.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)