SA-MP Forums Archive
Show Number of players on a team on bottom left corner? - 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: Show Number of players on a team on bottom left corner? (/showthread.php?tid=167783)



Show Number of players on a team on bottom left corner? - lSCARl - 13.08.2010

how do i make it show the ammount of players on TEAM_HUNTER 1 in the bottom left corner for example if theres 1 player in team hunter it should say Hunters: 1 please help someone


Re: Show Number of players on a team on bottom left corner? - Claude - 13.08.2010

You MUST forward this
pawn Код:
forward THplayers();
Add at public OnFilterScriptInIt:
pawn Код:
SetTimer("THplayers", 1000, true); // true makes it repeat all the time

Now we need to public it
pawn Код:
public THplayers()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new teamcount = 0, string[100];
        if(GetPlayerTeam(i) == TEAM_HUNTER) teamcount++;
        format(string, sizeof(string),"~n~ ~n~ ~n~ ~n~ ~g~Team Hunter Players: %d", teamcount); // the ~n~ makes it go to the bottom
        GameTextForAll(1000, 3);
        return 1;
    }
    return 1;
}
Try this


Re: Show Number of players on a team on bottom left corner? - Claude - 13.08.2010

Quote:
Originally Posted by Aztecking
Посмотреть сообщение
pawn Код:
SetTimer("THplayers", 1000, true); // false doesn't stop timer, gametext gets updated every 1 second
false stops it ._. false makes it will only happen 1 time.. true will be a repeating interval
Mistake.. I forgot that the 3rd param is repeating..


Re: Show Number of players on a team on bottom left corner? - lSCARl - 13.08.2010

Quote:
Originally Posted by Claude
Посмотреть сообщение
You MUST forward this
pawn Код:
forward THplayers();
Add at public OnFilterScriptInIt:
pawn Код:
SetTimer("THplayers", 1000, false); // false doesn't stop timer, gametext gets updated every 1 second

Now we need to public it
pawn Код:
public THplayers()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new teamcount = 0, string[100];
        if(GetPlayerTeam(i) == TEAM_HUNTER) teamcount++;
        format(string, sizeof(string),"~n~ ~n~ ~n~ ~n~ ~g~Team Hunter Players: %d", teamcount); // the ~n~ makes it go to the bottom
        GameTextForAll(1000, 3);
        return 1;
    }
    return 1;
}
Try this
bad ass but its not in the corner and its too big how can i put it in the bottom right corner


Re: Show Number of players on a team on bottom left corner? - lSCARl - 13.08.2010

Quote:
Originally Posted by Aztecking
Посмотреть сообщение
TEXTDRAW
well can you teach me how to make a textdraw properly?


Re: Show Number of players on a team on bottom left corner? - Claude - 13.08.2010

Quote:
Originally Posted by Aztecking
Посмотреть сообщение
TEXTDRAW
Somewhere at the top new thplayers;
At OnFilterScriptInIt or OnGameModeInIt
pawn Код:
thplayers = TextDrawCreate(..);
Change the
pawn Код:
format(string, sizeof(string),"~n~ ~n~ ~n~ ~n~ ~g~Team Hunter Players: %d", teamcount); // the ~n~ makes it go to the bottom
        GameTextForAll(1000, 3);
to
pawn Код:
format(string, sizeof(string), "Team Hunter players: %d", teamcount);
TextDrawSetString(thplayers, string);
Textdraw: Make yourself one using Textdraw creator


Re: Show Number of players on a team on bottom left corner? - lSCARl - 13.08.2010

Quote:
Originally Posted by Claude
Посмотреть сообщение
Somewhere at the top new thplayers;
At OnFilterScriptInIt or OnGameModeInIt
pawn Код:
thplayers = TextDrawCreate(..);
Change the
pawn Код:
format(string, sizeof(string),"~n~ ~n~ ~n~ ~n~ ~g~Team Hunter Players: %d", teamcount); // the ~n~ makes it go to the bottom
        GameTextForAll(1000, 3);
to
pawn Код:
format(string, sizeof(string), "Team Hunter players: %d", teamcount);
TextDrawSetString(thplayers, string);
Textdraw: Make yourself one using Textdraw creator
i get this
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(105) : error 029: invalid expression, assumed zero
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(105) : warning 213: tag mismatch
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(337) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

line 105
Код:
thplayers = TextDrawCreate(..);
line 337
Код:
TextDrawSetString(thplayers, string);



Re: Show Number of players on a team on bottom left corner? - Claude - 13.08.2010

Quote:
Originally Posted by lSCARl
Посмотреть сообщение
i get this
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(105) : error 029: invalid expression, assumed zero
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(105) : warning 213: tag mismatch
C:\Users\Brandon\Desktop\GTA SAN ANDREAS\GTA San Andreas\samp\gamemodes\HnK.pwn(337) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

line 105
Код:
thplayers = TextDrawCreate(..);
line 337
Код:
TextDrawSetString(thplayers, string);
The ..(dots) at TextDrawCreate are supposed to be your textdraw coordinates..


Re: Show Number of players on a team on bottom left corner? - s0nic - 13.08.2010

Here you go?..its a example fs:
Код:
http://pastebin.com/ijFmSCiE
Modify to your needs..if you need any help or w/e, just contact me.


Re: Show Number of players on a team on bottom left corner? - lSCARl - 14.08.2010

Quote:
Originally Posted by s0nic
Посмотреть сообщение
Here you go?..its a example fs:
Modify to your needs..if you need any help or w/e, just contact me.
ftw!!!!!!!!!!!!