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

Choose random CT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 04-02-2012 , 19:29   Choose random CT
Reply With Quote #1

How i put this plugin choosing a random CT:

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < colorchat >

public g_iSimon;

new const 
g_szPrefix[ ] = "^04[Jailbreak]^01";

public 
plugin_init()
{
    
register_plugin"Simon""1.0""H3avY Ra1n" );
    
    
register_event"DeathMsg""Event_DeathMsg""a" );
    
    
register_clcmd"say /simon""CmdSimon" );
    
register_clcmd"say /change""CmdChange" );
    
    
register_logevent"Event_RoundEvent"3"1=Round_Start""2=Round_End" );
    
    
set_task1.0"HudSimon", .flags="b" );
}

public 
Event_RoundEvent()
{
    
g_iSimon 0;
}

public 
CmdChangeid )
{
    if( 
id != g_iSimon )
    {
        
ColorChatidNORMAL"%s Only the ^03simon ^01can use this command."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    new 
hMenu menu_create"New Simon:""ChangeMenu_Handler" );
    
    new 
szName32 ], szData];
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""CT" );
    
    for( new 
0iPlayeriNumi++ )
    {
        
iPlayer iPlayers];
        
        
get_user_nameiPlayerszNamecharsmaxszName ) );
        
num_to_striPlayerszDatacharsmaxszData ) );
        
        
menu_additemhMenuszNameszData );
    }
    
    
menu_displayidhMenu);
    
    return 
PLUGIN_HANDLED;
}

public 
ChangeMenu_HandleridhMenuiItem )
{
    if( 
iItem == MENU_EXIT )
    {
        
menu_destroyhMenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iAccesshCallbackszData], szName32 ];
    
menu_item_getinfohMenuiItemiAccessszDatacharsmaxszData ), szNamecharsmaxszName ), hCallback );
    
    new 
iPlayer str_to_numszData );
    
    if( !
is_user_aliveiPlayer ) )
    {
        
ColorChatidNORMAL"%s That player is no longer available to be ^03simon^01."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon iPlayer;
    
    
ColorChat0NORMAL"%s ^03%s ^01is the new ^03simon^01."g_szPrefixszName );
    return 
PLUGIN_HANDLED;
}
    

public 
CmdSimonid )
{
    if( 
cs_get_user_teamid ) != CS_TEAM_CT )
    {
        
ColorChatidNORMAL"%s ^01You must be a ^03Counter-Terrorist ^01to use this command."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
g_iSimon == id )
    {
        
ColorChatidNORMAL"%s ^01You are already the ^04Simon^01!"g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
is_user_aliveg_iSimon ) )
    {
        
ColorChatidNORMAL"%s ^01Somebody else is currently simon."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon id;
    
    new 
name[32];
    
get_user_nameidname31 );
    
    
ColorChat0NORMAL"%s ^03%s ^01 is now the Simon."g_szPrefixname );
    return 
PLUGIN_CONTINUE;
    
}


public 
HudSimon()
{
    
set_hudmessage02550, -1.00.0500.11.00.10.1);
    
    if( !
is_user_aliveg_iSimon ) )
    {
        
g_iSimon 0;
        
show_hudmessage0"There is currently nobody commanding." );
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[32];
    
get_user_nameg_iSimonname31 );
    
    
show_hudmessage0"%s is the current Simon."name );
    
    return 
PLUGIN_HANDLED;
}

public 
client_disconnectid )
{
    if( 
g_iSimon == id )
    {
        
g_iSimon 0;
        
        
ColorChat0NORMAL"%s ^01The current Simon has left the game."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Event_DeathMsg()
{
    new 
victim read_data);
    
    if( !
is_user_connectedvictim ) )
        return 
PLUGIN_HANDLED;
    
    if( 
victim == g_iSimon )
    {
        
ColorChat0NORMAL"%s ^01The current Simon has died."g_szPrefix );
        
g_iSimon 0;
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;

but the /change command continues ... And when a CT is choosen displays a mensage.

Thanks in advance
demon81 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-03-2012 , 02:22   Re: Choose random CT
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=148269
EpicMonkey is offline
demon81
Member
Join Date: Sep 2010
Location: Portugal
Old 04-03-2012 , 07:06   Re: Choose random CT
Reply With Quote #3

How i put that in that plugin ?
demon81 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 22:08.


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