SA-MP Forums Archive
Need Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Help (/showthread.php?tid=186097)



Need Help - xinix000 - 27.10.2010

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


Re: Need Help - randomkid88 - 27.10.2010

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


Re: Need Help - xinix000 - 27.10.2010

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


Re: Need Help - randomkid88 - 27.10.2010

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.


Re: Need Help - xinix000 - 27.10.2010

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