Raised This Month: $51 Target: $400
 12% 

[CSS] GetPlayerTeamAlive ??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 01-08-2015 , 06:36   [CSS] GetPlayerTeamAlive ??
Reply With Quote #1

Hello,

I need help for my plugin.
I want GetPlayerTeamAlive, for exemple, in a HUD :

Code:
Client_PrintKeyHintText(client, "Terrorist alive : 4/12 \n CounterTerrorist alive : 1/15");
It's juste a exemple

How i can take a player alive in a different team ?

Sorry for my english
Thank you
NeXoU is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-08-2015 , 11:05   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #2

something like:
Code:
new totalcount, alivecount;
for(new i=1; i<=MaxClients; i++) {
    if(IsClientInGame(i) && GetClientTeam(i) == TEAM_NUM_HERE) {
        totalcount++;
        if(IsPlayerAlive(i)) alivecount++;
    }
}
Mitchell is offline
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 01-09-2015 , 10:22   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #3

Thank you, but my code don't work... I need help ^^

Code:
#pragma semicolon 1

#include <sourcemod>
#include <smlib>

new Handle:H_TIMER_HUD[MAXPLAYERS+1];


public OnClientPutInServer(client)
{
	H_TIMER_HUD[client] = CreateTimer(1.0, TIMER_HUD_CL, client, TIMER_REPEAT);
}

public OnClientDisconnect(client)
{
	if (H_TIMER_HUD[client] != INVALID_HANDLE)
	{
		KillTimer(H_TIMER_HUD[client]);
		H_TIMER_HUD[client] = INVALID_HANDLE;
	}
}

public Action:TIMER_HUD_CL(Handle:timer, any:client)
{
	new totalcount2;
        new	alivecount2;
	for(new i=1; i<=MaxClients; i++) 
	{
                if(IsClientInGame(i) && GetClientTeam(i) == 2) 
		{
			totalcount2++;
			if(IsPlayerAlive(i))
			{
			alivecount2++;
			}
		}
	}
	new totalcount3; 
	new alivecount3;
	for(new i=1; i<=MaxClients; i++) 
	{
		if(IsClientInGame(i) && GetClientTeam(i) == 3) 
		{
			totalcount3++;
			if(IsPlayerAlive(i))
			{
			alivecount3++;
			}
		}
	}

	Client_PrintKeyHintText(client, "Terrorist alive : %s/%s \n CounterTerrorist alive : %s/%s", alivecount2, totalcount2, alivecount3, totalcount3);
}
Thank

Last edited by NeXoU; 01-09-2015 at 10:52.
NeXoU is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-09-2015 , 12:58   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #4

What do you mean by "don't work"?
Mitchell is offline
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 01-09-2015 , 13:39   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #5

Look,

With the plugin :
http://image.noelshack.com/fichiers/...28767-work.png

and i want this :
http://image.noelshack.com/fichiers/...8766-work2.png

Thank you in advance :-)
NeXoU is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-09-2015 , 13:52   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #6

First what i see Client_PrintKeyHintText(client, "Terrorist alive : %s/%s \n CounterTerrorist alive : %s/%s", alivecount2, totalcount2, alivecount3, totalcount3); fix: %s -> %d

EDIT:
You can remove that space after new line.

Last edited by KissLick; 01-09-2015 at 13:58.
KissLick is offline
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 01-09-2015 , 14:08   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #7

It's OK, thank you :-) !
NeXoU is offline
NeXoU
Junior Member
Join Date: Jan 2014
Location: France
Old 01-09-2015 , 19:24   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #8

I want to teleport all team T, how i can use the fonction TeleportEntity for all team T ? (exemple : TeleportEntity(@t, .....); )
Thank you in advance

Last edited by NeXoU; 01-09-2015 at 19:25.
NeXoU is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 01-09-2015 , 20:48   Re: [CSS] GetPlayerTeamAlive ??
Reply With Quote #9

Quote:
Originally Posted by NeXoU View Post
I want to teleport all team T, how i can use the fonction TeleportEntity for all team T ? (exemple : TeleportEntity(@t, .....); )
Thank you in advance
Code:
for(new i = 1; i <= MaxClients; i++)
{
	if(IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i))
	{
		TeleportEntity(i, ...);
	}
}
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.

Last edited by Bara; 01-09-2015 at 20:49.
Bara is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode