SA-MP Forums Archive
Only id 0 unfreezes. - 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: Only id 0 unfreezes. (/showthread.php?tid=146630)



Only id 0 unfreezes. - juuleman - 08.05.2010

Hey Guys,

I got a problem. Ive made a race and at the start everyone is freezed then it says 3 2 1 and at GO everyone should be unfreezed. But only id 0 gets unfreezed...

Plz help.

Code:
pawn Код:
public racestart3()
for(new i,g=GetMaxPlayers(); i < g; i ++)
{
    GameTextForAll("GO",1000,5);
    TogglePlayerControllable(i,1);
    return 1;
}



Re: Only id 0 unfreezes. - 0ne - 08.05.2010

Quote:
Originally Posted by [ECR
SancheZ ]
Hey Guys,

I got a problem. Ive made a race and at the start everyone is freezed then it says 3 2 1 and at GO everyone should be unfreezed. But only id 0 gets unfreezed...

Plz help.

Code:
pawn Код:
public racestart3()
for(new i,g=GetMaxPlayers(); i < g; i ++)
{
    GameTextForAll("GO",1000,5);
    TogglePlayerControllable(i,1);
    return 1;
}
try:

pawn Код:
public racestart3()
for(new i=0;i<MAX_PLAYERS; i++)
{
    GameTextForAll("GO",1000,5);
    TogglePlayerControllable(i,1);
    return 1;
}




Re: Only id 0 unfreezes. - juuleman - 08.05.2010

Quote:
Originally Posted by 0ne
Quote:
Originally Posted by [ECR
SancheZ ]
Hey Guys,

I got a problem. Ive made a race and at the start everyone is freezed then it says 3 2 1 and at GO everyone should be unfreezed. But only id 0 gets unfreezed...

Plz help.

Code:
pawn Код:
public racestart3()
for(new i,g=GetMaxPlayers(); i < g; i ++)
{
    GameTextForAll("GO",1000,5);
    TogglePlayerControllable(i,1);
    return 1;
}
try:

pawn Код:
public racestart3()
for(new i=0;i<MAX_PLAYERS; i++)
{
    GameTextForAll("GO",1000,5);
    TogglePlayerControllable(i,1);
    return 1;
}

Nah still not...


Re: Only id 0 unfreezes. - 0ne - 08.05.2010

do a command like:

new InRace[MAX_PLAYERS];

when he joins race

InRace[playerid] = 1; and then on the callback


pawn Код:
public racestart3()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
      if(InRace[i] == 1)
      {
        GameTextForAll("GO",1000,5);
        TogglePlayerControllable(i,1);
      }
    }
}



Re: Only id 0 unfreezes. - Jefff - 08.05.2010

Код:
public racestart3()
{
	for(new i,g=GetMaxPlayers(); i < g; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i))
	{
		GameTextForPlayer(i,"GO",1000,5);
		TogglePlayerControllable(i,1);
		// return 1; it stops the loop so only works on id 0
	}
	return 1;
}



Re: Only id 0 unfreezes. - juuleman - 08.05.2010

Quote:
Originally Posted by 0ne
do a command like:

new InRace[MAX_PLAYERS];

when he joins race

InRace[playerid] = 1; and then on the callback


pawn Код:
public racestart3()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
      if(InRace[i] == 1)
      {
        GameTextForAll("GO",1000,5);
        TogglePlayerControllable(i,1);
      }
    }
}
Thanks, works

Sorry Jeff, didnt tested yours cause the one from 0ne already worked.