Raised This Month: $ Target: $400
 0% 

[CSS] Calculating Team members


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marley
Junior Member
Join Date: Oct 2008
Old 12-04-2008 , 18:02   [CSS] Calculating Team members
Reply With Quote #1

I am currently writing a plugin that gives you set amount of whatever crap I call it later on. When the bomb explodes, when the hostages are all rescued and when the bomb is defused, I need to be able to make all of those find out which team lost, and to Print a message to all those in the losing team.

Any Help will be greatly appreciated
Marley is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 12-04-2008 , 22:02   Re: [CSS] Calculating Team members
Reply With Quote #2

I dont really understand what you are trying to do, but to find all players of a single team (losing team in this case) you would use a for loop to cycle through all of the players, check there team, and if they are on the losing team, print a message to them.

Heres an example...
Code:
#define T_TEAM 2
#define CT_TEAM 3
 
new iMaxPlayers = GetMaxClients();
 
for (new i=1;i<=iMaxPlayers;i++)
{
new iTeam = GetClientTeam(i);
 
if(iTeam == CT_TEAM)
{
PrintToChat(i, "This message only goes to the counter terrorist team");
}
}
This is just an example. Dont copy paste it, but it shows what I mean. You will want to have the team defines at the top (not even sure if those are right, they might be backwards) and have a function like PrintMessageToLosers() and pass the losing team index to it, and then print to them.
CrimsonGT is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-04-2008 , 22:32   Re: [CSS] Calculating Team members
Reply With Quote #3

If you're using r2341 or later, you can just use MaxClients instead of having to use GetMaxClients every map change.

Code:
#define T_TEAM 2
#define CT_TEAM 3
 
for (new i = 1; i <= MaxClients; i++)
{
    new iTeam = GetClientTeam(i);
 
    if(iTeam == CT_TEAM)
    {
        PrintToChat(i, "This message only goes to the counter terrorist team");
    }
}
bl4nk is offline
Marley
Junior Member
Join Date: Oct 2008
Old 12-05-2008 , 03:18   Re: [CSS] Calculating Team members
Reply With Quote #4

Im trying to Print a message saying You lost to the whole of the losing team.

I dont want it to print when everybody is killed, only when the Primary Mission Objective is completed(Defuse the bomb, Blow up the bomb-site, rescue the Hostages etc.)

Say CT's Defuse the bomb, it will print it to T's

Say T's gaurd the bomb and let it explode, it will print it to CT's
Marley is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 12-05-2008 , 04:54   Re: [CSS] Calculating Team members
Reply With Quote #5

So hook "bomb_exploded" and find the userid for that event. (Client that planted the bomb that exploded). Find that clients team, then do the code I mentioned before to print it to everyone thats not on the same team as that client.
CrimsonGT 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 00:15.


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