Raised This Month: $ Target: $400
 0% 

[Help] Need script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
airidas338
Member
Join Date: May 2010
Old 09-30-2011 , 07:12   [Help] Need script
Reply With Quote #1

How to get CT count and T count? (what is Code?)
airidas338 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 09-30-2011 , 07:54   Re: [Help] Need script
Reply With Quote #2

IF you press "TAB" you will see the count of the teams.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
airidas338
Member
Join Date: May 2010
Old 09-30-2011 , 07:55   Re: [Help] Need script
Reply With Quote #3

I need a native for scripting...
airidas338 is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 09-30-2011 , 07:57   Re: [Help] Need script
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
IF you press "TAB" you will see the count of the teams.
Hahahaha. Nice one.
I think your searching for this one? http://forums.alliedmods.net/showthread.php?p=193086
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Elusive138
Senior Member
Join Date: Dec 2010
Old 09-30-2011 , 07:58   Re: [Help] Need script
Reply With Quote #5

This was a stock I wrote some time ago
PHP Code:
stock get_player_team_count(&ctnum, &tnum) {
    
ctnum 0;
    
tnum 0;
    new 
maxplayers get_maxplayers();
    for (new 
1<= maxplayersi++) {
        if (!
is_user_connected(i))
            continue;
        
        switch (
cs_get_user_team(i)) {
            case 
CS_TEAM_Ttnum++;
            case 
CS_TEAM_CTctnum++;
        }
    }

Here's another one to get the player ids in a team
PHP Code:
stock get_players_byteam(players[32], &playersnumCsTeams:teamaliveonly=0) {  
    
playersnum 0;
    new 
maxplayers get_maxplayers();
    for (new 
1<= maxplayersi++) {
        if (!
is_user_connected(i))
            continue;
            
        if (
aliveonly && !is_user_alive(i))
            continue;
        
        if (
cs_get_user_team(i) == team) {
            
players[playersnum++] = i;
        }
    }

It's also possible to do both using get_players(), but I preferred to use the CsTeams enum rather than strings I could never remember. If you use them don't forget to #include <cstrike>

Last edited by Elusive138; 09-30-2011 at 22:05.
Elusive138 is offline
airidas338
Member
Join Date: May 2010
Old 09-30-2011 , 07:58   Re: [Help] Need script
Reply With Quote #6

THNX this will be ok
airidas338 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-30-2011 , 08:56   Re: [Help] Need script
Reply With Quote #7

@ Elusive138

Your loops are wrong.
When you use the value of get_maxplayers(), you have to start from 1 & include the maxplayers.

like:
PHP Code:
for(new 1<= maxplayersi++); 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Elusive138
Senior Member
Join Date: Dec 2010
Old 09-30-2011 , 09:45   Re: [Help] Need script
Reply With Quote #8

Quote:
Originally Posted by drekes View Post
@ Elusive138

Your loops are wrong.
When you use the value of get_maxplayers(), you have to start from 1 & include the maxplayers.

like:
PHP Code:
for(new 1<= maxplayersi++); 
Ah... probably not a good thing I never noticed. Thanks for the tip, luckily I haven't used that on anything too important yet... I hope. *goes to check*

Last edited by Elusive138; 09-30-2011 at 09:48.
Elusive138 is offline
maoxianxie
Member
Join Date: Aug 2011
Old 10-01-2011 , 00:20   Re: [Help] Need script
Reply With Quote #9

Whats the meaning of "&" in "get_player_team_count(&ctnum, &tnum)" ?
And how should I use the stock function in my own code if I want to set the T's health to the ctnum*1000?
Sorry for my lack of such knowledge.

Last edited by maoxianxie; 10-01-2011 at 00:25.
maoxianxie is offline
Reply


Thread Tools
Display Modes

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 19:42.


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