Need Help
#1

how to make when player have wantedstar more than 6 the curfew will turn off and when he have less than 6 the curfew will turn off

pawn Код:
forward AutoCurfew();
public AutoCurfew()
{
    for(new i=0; i < MAX_PLAYERS; i++)
     {
        if(IsPlayerConnected(i))
        {
            if(WantedLevel[i] >= 6)
            {
                acurfew = 1;
                    SendClientMessageToAll(0x00F600AA, "Curfew turn on");
            }
            if(WantedLevel[i] <= 5)
            {
                acurfew = 0;
                    SendClientMessageToAll(0x00F600AA, "Curfew turn off");
            }
        }
    }
    return 1;
}
i just make it by myself but it cann't use
Reply
#2

You would need to set up a timer to make the function be called, like under OnGamemodeInit.
Reply
#3

pawn Код:
public OnGameModeInit()
{
    SetTimer("AutoCurfew", 1000, 1);
    return 1;
}
i already add in gamemode but when connect to server it flood the message curfew turn off
Reply
#4

Because you have the SendClientMessageToAll under the loop. It is going to loop through all payers every second, and because the wanted level is less than 5 it will send a message every second. You need to move the messages out of the loop.
Reply
#5

i just want to make if player have more than 6 star send message to everybody for a once so everybody will know this is a curfew time and if there is no player have more than 6 star it will turn off and send the message again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)