SA-MP Forums Archive
Freezing players when cw finishes - 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: Freezing players when cw finishes (/showthread.php?tid=168631)



Freezing players when cw finishes - RedFusion - 16.08.2010

Код:
			if(PlayerInfo[playerid][pCW] == 1)
			{
		    	TogglePlayerControllable(playerid, 0);
			SetTimer("Control", 6000,1);
		    	TogglePlayerControllable(playerid, 1);
			}
			if(PlayerInfo[playerid][pCW] == 2)
			{
		    	TogglePlayerControllable(playerid, 0);
			SetTimer("Control", 6000,1);
		    	TogglePlayerControllable(playerid, 1);
I have this stuff on when a team kills the other team 15 times, i got some test and reset stuff, What i try to do here is freeze the fighters for 6 seconds when this kills reach to 15, what do i need to change in this codepiece?


Re: Freezing players when cw finishes - HuRRiCaNe - 16.08.2010

Hi [V]Fuse, xD, that wont work since you have to activate the Player controllable back again only when the timer has passed right?
This shoud be like this
pawn Код:
if(PlayerInfo[playerid][pCW] == 1)
            {
                TogglePlayerControllable(playerid, 0);
            SetTimer("Control", 6000,1);
            }
            if(PlayerInfo[playerid][pCW] == 2)
            {
                TogglePlayerControllable(playerid, 0);
            SetTimer("Control", 6000,1);
public Control()
{
if(PlayerInfo[playerid][pCW] == 2 ||  PlayerInfo[playerid][pCW] == 1 )
{
TogglePlayerControllable(playerid,1);
}
And your Timer should be only once not repetitive (instead of that "1" put a "0"


Re: Freezing players when cw finishes - RedFusion - 17.08.2010

Nobody freezes when the round is over, i don't get what i do wrong, i did put that stuff in.


Re: Freezing players when cw finishes - RedFusion - 17.08.2010

Do i need a return somewhere in there?


Re: Freezing players when cw finishes - Claude - 17.08.2010

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(PlayerInfo[i][pCW] == 1)
    {
        TogglePlayerControllable(i, 0);
        SetTimer("Control", 6000, false);
    }
}
 
for(new i; i < MAX_PLAYERS; i++)
{
    if(PlayerInfo[i][pCW] == 2)
    {
        TogglePlayerControllable(i, 0);
        SetTimer("Control", 6000, false);
    }
}

public Control()
{
    for(new i; i < MAX_PLAYERS; i++)
    TogglePlayerControllable(i, 1); // 1 to allow them to move, 0 to disallow it
}
pawn Код:
if(PlayerInfo[playerid][pCW] == 2 ||  PlayerInfo[playerid][pCW] == 1 )
Why are you using this? It is completely useless as you can make a loop that unfreezes all players


Re: Freezing players when cw finishes - RedFusion - 17.08.2010

Thanks it works now