Textdraw problem
#1

So whenever the player spawns as team 1 or team 2 , it adds the count to team 1 ALWAYS.
Code:
new Text:AliveInfo;
Код:
	AliveInfo = TextDrawCreate(23.000000, 169.000000, "team 1 ALIVE: 0~n~team2 ALIVE: 0~n~~r~~W~");
	TextDrawBackgroundColor(AliveInfo, 255);
	TextDrawFont(AliveInfo, 1);
	TextDrawLetterSize(AliveInfo, 0.200000, 1.400000);
	TextDrawColor(AliveInfo, -1);
	TextDrawSetOutline(AliveInfo, 0);
	TextDrawSetProportional(AliveInfo, 1);
	TextDrawSetShadow(AliveInfo, 1);
	function OnServerUpdate()
{
		UpdateAliveInfo();

	return 1;
}
stock UpdateAliveInfo()
{
	new string[128];
	format(string,sizeof(string),"~r~Team1: %d~n~~g~Team2: %d~n~~p~FORUMS: WWW.xwy",GetTeamPlayersAlive(TEAM_ZOMBIE),GetTeamPlayersAlive(TEAM_HUMAN));
	TextDrawSetString(AliveInfo,string);
	return 1;
}
public OnPlayerSpawn(playerid)
{
 playersAliveCount++; 
// rest of code dont want to publish.
public OnPlayerDeath(playerid)
{
playersAliveCount--;
//rest of code
GetTeamPlayersAlive(teamid)
{
    new count;
    for(new i; i < playersAliveCount; i++)
    {
        if(IsPlayerConnected(i) && team[i] == teamid) count++;
    }
    return count;
}
Whats the problem here?
Reply
#2

did u get it fix yet?
Reply
#3

Quote:
Originally Posted by Joron
Посмотреть сообщение
did u get it fix yet?
I just posted this so no i still need a fix.
Reply
#4

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
I just posted this so no i still need a fix.
Lol sorry am on my phone...ok ill look over it
Reply
#5

Can you show how you define the teams please.
Reply
#6

It's simple as this:
pawn Код:
new PlayersAliveOnTeam[2];

public OnPlayerDisconnect(playerid, reason)
{
    if(IsPlayerAlive(playerid))
    {
        PlayersAliveOnTeam[player's team] --;
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    PlayersAliveOnTeam[player'
s team] ++;
    return 1;
}

public OnPlayerDeath(playerid)
{
    PlayersAliveOnTeam[player's team] --;
    return 1;
}
Replace "player's team" for the ID of the team a player is in.

0 = Team A
1 = Team B
2 = Total Amount of Teams
Reply
#7

Tried SickAttack , doesn't even count now
Код:
new PlayersAliveOnTeam[2];

public OnPlayerDisconnect(playerid, reason)
{
	if(GetTeamPlayersAlive(playerid))
	{
		PlayersAliveOnTeam[player's team] --;
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
	PlayersAliveOnTeam[player's team] ++;
	return 1;
}

public OnPlayerDeath(playerid)
{
	PlayersAliveOnTeam[player's team] --;
	return 1;
}
GetTeamPlayersAlive(teamid)
{
    new count;
    for(new i; i < playersAliveCount; i++)
    {
        if(IsPlayerConnected(i) && team[i] == teamid) count++;
    }
    return count;
}
Reply
#8

Show us how you set someone in a team. team[playerid]=....
Reply
#9

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Tried SickAttack , doesn't even count now
Код:
new PlayersAliveOnTeam[2];

public OnPlayerDisconnect(playerid, reason)
{
	if(GetTeamPlayersAlive(playerid))
	{
		PlayersAliveOnTeam[player's team] --;
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
	PlayersAliveOnTeam[player's team] ++;
	return 1;
}

public OnPlayerDeath(playerid)
{
	PlayersAliveOnTeam[player's team] --;
	return 1;
}
GetTeamPlayersAlive(teamid)
{
    new count;
    for(new i; i < playersAliveCount; i++)
    {
        if(IsPlayerConnected(i) && team[i] == teamid) count++;
    }
    return count;
}
It was just an example...
Reply
#10

Quote:
Originally Posted by justinnater
Посмотреть сообщение
Show us how you set someone in a team. team[playerid]=....
Код:
OnGameModeInit
     AddPlayerClass(287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); //Team1
      AddPlayerClass(115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); // Team2
public OnPlayerSpawn(playerid)
{
Spawned[playerid] = true;
{
    if(GetPlayerTeam(playerid) == Team1)
    {
            SetPlayerPos(playerid,2081.1968,1232.8430,10.8203);
            GivePlayerWeapon(playerid, 4, 1000);
            SetPlayerRandomTeam1Spawn(playerid);

    }
    if(GetPlayerTeam(playerid) == Team2)
    {
       SetPlayerPos(playerid,2081.1968,1232.8430,10.8203);
      Team2(playerid);
       {
       firstSpawn[playerid] += 1;
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerSkin(playerid) == 287
    {
       SetPlayerTeam(playerid, Team1
       SetPlayerColor(playerid, Team1Col);
    }
    if(GetPlayerSkin(playerid) == 115)
    {
       SetPlayerTeam(playerid, Team2); 
       SetPlayerColor(playerid, Team2Col); 
    }
    {
new Team1x, Team2x;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
            if(gTeam[i] ==  Team1) Team1x++;
            else if(gTeam[i] == Team2) Team2x++;
            }
            }
            }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)