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

Players Array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 09-07-2012 , 11:01   Players Array
Reply With Quote #1

Not sure what the topic name should be ...

anyways

PHP Code:
#include <amxmodx>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "EpicMonkey"

new g_Test[32];

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""Test")
    
register_clcmd("say /check""Check")
}

public 
Test(id)
{
    new 
pnum;
    
get_players(g_Testpnum"ae""CT")
}

public 
Check(id)
{
    if(
g_Test[id])
    {
        
client_print(idprint_chat"[AMXX] You are a Test Player")
    }
    else
    {
        
client_print(idprint_chat"[AMXX] You are not a Test Player")
    }

returns You are not a test player when am in CT
No idea ...
EpicMonkey is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-07-2012 , 11:11   Re: Players Array
Reply With Quote #2

get_players() doesn't work that way.
PHP Code:
#include <cstrike>

new g_Test[33]; // Note 33
new MaxPlayers;

public 
plugin_init()
{
    
// ...

    
MaxPlayers get_maxplayers();
}

public 
Test()
{
    for (new 
1<= MaxPlayersi++)
    {
        if (
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT)
        {
            
g_Test[id] = true;
        }
    }

Use arrayset(g_Test, false, sizeof g_Test) to reset the array.

Last edited by hleV; 09-07-2012 at 11:12.
hleV is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 09-07-2012 , 12:33   Re: Players Array
Reply With Quote #3

i see , thank you .... get_players

Last edited by EpicMonkey; 09-07-2012 at 12:33. Reason: typo
EpicMonkey 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 19:40.


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