Function Dosen't return a value.
#1

Код:
stock CountEventPlayersTDM(event, team)
{
	new count = 0;
	foreach(new i : Player)
	{
 		if(gPlayerGamemode[i] == event)
   		{
   		    if(GetPlayerTeam(i) == team) // anything ?
   		    {
     			count++;
     		}
	    }
	}
	return count;
}
//for example this code dosen't work

CountEventPlayersTDM(MODE_TDM, TEAM_ONE);
gPlayerGamemode and SetPlayerTeam are already defined.. for players




------------------------------------------------------------------------------------------------

i am using another function which returns a value.
Код:
stock CountEventPlayers(event)
{
	new count = 0;
	foreach(new i : Player)
	{
 		if(gPlayerGamemode[i] == event)//works perfectly
   		{
     		count++;//add one to the count
	    }
	}
	return count;
}
Reply
#2

Код:
stock CountEventPlayersTDM(event, team)
{
	new count = 0;
	foreach(new i : Player) if(gPlayerGamemode[i] == event && GetPlayerTeam(i) == team) count++;
	return count;
}
Possible problem "GetPlayerTeam"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)