AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Storing and Moving via Global Var (https://forums.alliedmods.net/showthread.php?t=189435)

EpicMonkey 07-07-2012 08:44

Storing and Moving via Global Var
 
Here's the Code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

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

new StoredP

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /store""Store")
    
register_clcmd("say /move""Move")
}

public 
Store(id)
{
    static 
Players[32], Pnum;
    
get_players(PlayersPnum"ae""TERRORIST")
    
    for(new 
0Pnumi++)
    {
        
StoredP Players[i]
        
cs_set_user_team(StoredPCS_TEAM_CT)
        
client_print(StoredPprint_chat"[AMXX] T's stored")
    }
}

public 
Move(id)
{
    if(
is_user_connected(StoredP))
    {
        
cs_set_user_team(StoredPCS_TEAM_T)
    }


Quote:

Trying to do:

Store all the terrorist in the global var and move them to CT and then move them back to T.
Quote:

Whats Happening:

Store's all the terrorists in the global var and moves them all to CT and only moves the last terrorist stored back to T.
Do i have to use a 2d array for this?

any help would be appreciated :3

Kreation 07-07-2012 08:48

Re: Storing and Moving via Global Var
 
You'd have to loop through the players again.

YamiKaitou 07-07-2012 08:48

Re: Storing and Moving via Global Var
 
You must us an array

ConnorMcLeod 07-07-2012 09:26

Re: Storing and Moving via Global Var
 
Store :

get_players(g_GlobalPlayersArray


And loop in Move function

EpicMonkey 07-07-2012 11:11

Re: Storing and Moving via Global Var
 
k , thank you

EpicMonkey 08-27-2012 04:30

Re: Storing and Moving via Global Var
 
Ive tried something similar like this

PHP Code:

#include <amxmodx>
#include <fun>

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

new g_Test[32];

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("CurWeapon""current_weapon""be""1=1")
}

public 
current_weapon(id
{
    if(
g_Test[id])
    {
        
engclient_cmd(g_Test[id], "weapon_knife");
    }
}

public 
Test(id)
{
    new 
pnumi;
    
get_players(g_Testpnum"ae""TERRORIST")
    
    for(
0pnumi++)
    {
        
StripandHealth(g_Test[i])
    }


if a Test player gets another weapon or switches to another weapon, it doesn't switch back to knife.


All times are GMT -4. The time now is 15:17.

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