AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Players Array (https://forums.alliedmods.net/showthread.php?t=195418)

EpicMonkey 09-07-2012 11:01

Players Array
 
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 ... :3

hleV 09-07-2012 11:11

Re: Players Array
 
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.

EpicMonkey 09-07-2012 12:33

Re: Players Array
 
i see , thank you .... get_players :3


All times are GMT -4. The time now is 08:16.

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