Raised This Month: $ Target: $400
 0% 

[REQ]Open cvar on clients


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jeremyjohn
BANNED
Join Date: Jun 2009
Location: Malaysia
Old 08-13-2009 , 03:16   [REQ]Open cvar on clients
Reply With Quote #1

Hi, I need a plugin that will execute on every round a custom cvar on every clients but each round 1st on Terrorist than the next round on Counter Terrorist for a helicopter mod: amx_apache (KRoT@L)

Like amx_clientscvar @T say /buyheli than the next round
amx_clientscvar @CT say /buyheli and on and on...

but on auto mod every round that mean the server will automatically execute this commands.

Is it possible so create that?
jeremyjohn is offline
Send a message via MSN to jeremyjohn
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-13-2009 , 03:38   Re: [REQ]Open cvar on clients
Reply With Quote #2

Here you go

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

public plugin_init() {
    
register_plugin("Player Spawn Command""-""VMAN");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
}

public 
fwHamPlayerSpawnPost(id) {
    if(!
is_user_bot(id)) {
        
client_cmd(id"say /buyheli");
    }
    
    return 
PLUGIN_HANDLED;

VMAN is offline
jeremyjohn
BANNED
Join Date: Jun 2009
Location: Malaysia
Old 08-13-2009 , 13:17   Re: [REQ]Open cvar on clients
Reply With Quote #3

Thanks, but i actually want it like the first round for Terrorist than the next round on Counter Terrorist and on and on... each round for different team not both.
jeremyjohn is offline
Send a message via MSN to jeremyjohn
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 08-13-2009 , 13:32   Re: [REQ]Open cvar on clients
Reply With Quote #4

PHP Code:
#include <amxmodx>

new maxPlayers
new bool:CTteam
public plugin_init() 
{
    
register_plugin("Round Start Command""1.0""Biscuit");
    
register_event("HLTV""Roundstart""a""1=0""2=0")
    
maxPlayers get_maxplayers()
}

public 
Roundstart() 
{
    if(
CTteam)
    {
        for (new 
id 1id <= maxPlayersid++)
        {
            if(
get_user_team(id) == 2
            {
                
client_cmd(id"say /buyheli");
            }
        }
        
CTteam false
    
}
    else
    {
        for (new 
id 1id <= maxPlayersid++)
        {
            if(
get_user_team(id) == 1
            {
                
client_cmd(id"say /buyheli");
            }
        }
        
CTteam true
    
}

__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!

Last edited by biscuit628; 08-13-2009 at 13:40.
biscuit628 is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-13-2009 , 15:36   Re: [REQ]Open cvar on clients
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <hamsandwich>

enum _:Teams
{
    
TERRORIST 1,
    
CT
}

new 
bool:g_bTerrorist;

public 
plugin_init()
{
    
register_plugin"1""2""3" );
    
    
register_event"HLTV""eventNewRound""a""1=0""2=0" );
    
    
RegisterHamHam_Spawn"player""fwdPlayerSpawnPost");
}

public 
eventNewRound()
{
    
g_bTerrorist = !g_bTerrorist;
}    

public 
fwdPlayerSpawnPostid )
{
    if( 
is_user_aliveid ) )
    {
        if( 
get_user_teamid ) == TERRORIST && g_bTerrorist )
        {
            
client_cmdid"say /buyheli" );
        }
        
        else if( 
get_user_teamid ) == CT && !g_bTerrorist )
        {
            
client_cmdid"say /buyheli" );
        }
    }

Instead of using client_cmd I would integrate it to the helicopter plugin so you could call the forward that /buyheli leads to.

Last edited by Jon; 08-13-2009 at 16:06.
Jon is offline
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 08-13-2009 , 16:00   Re: [REQ]Open cvar on clients
Reply With Quote #6

what the diffenet with engclient_cmd and client_cmd?
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-13-2009 , 16:02   Re: [REQ]Open cvar on clients
Reply With Quote #7

Quote:
Originally Posted by biscuit628 View Post
what the diffenet with engclient_cmd and client_cmd?
http://www.amxmodx.org/funcwiki.php?go=func&id=231

In this case it probably won't make any difference.


Edit: After reading I corrected my post, it shouldn't be used in this case.

Last edited by Jon; 08-13-2009 at 16:07.
Jon is offline
jeremyjohn
BANNED
Join Date: Jun 2009
Location: Malaysia
Old 08-15-2009 , 02:08   Re: [REQ]Open cvar on clients
Reply With Quote #8

erm.. how do i compile it? compile it both or one by one?
jeremyjohn is offline
Send a message via MSN to jeremyjohn
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:32.


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