Raised This Month: $ Target: $400
 0% 

plz help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 08-14-2009 , 20:51   Re: plz help
Reply With Quote #2

learn coding & define ur kills

PHP Code:
#include <amxmodx>
#include <fakemeta_util>
#include <cstrike>
#include <fun>
#define PLUGIN_NAME "Team Selection"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Zapdos1"

// default names
new const TeamT[] = "Soviets"        // Terrorists
new const TeamCT[] = "Allied"    // Counter-Terrorists

// default round end sounds
new const SoundT[] = "music/downed_intro.mp3"
new const SoundCT[] = "music/motor_intro.mp3"
new camouflagetime
// Some useful code (thx to arkshine)
enum
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T,
    
CS_TEAM_CT,
    
CS_TEAM_SPECTATOR
}

#define OFFSET_TEAM  114 
#define cs_get_user_team(%1)     get_pdata_int( %1, OFFSET_TEAM ) 

#define OFFSET_DEATHS  444
#define cs_get_user_deaths(%1)     get_pdata_int( %1, OFFSET_DEATHS )
#define cs_set_user_deaths(%1,%2)  set_pdata_int( %1, OFFSET_DEATHS, %2 )

// Some variables
new mChooseTeam
new showMsg 0
new camouflagecost
new pcTeamTpcTeamCTpcSoundTpcSoundCTpcUseSounds

public plugin_init() {
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);

    
register_message(get_user_msgid("ShowMenu"), "message_show_menu");
    
register_event("ResetHUD""set_hud""be");

    
// change round end message / sounds
    
register_message(get_user_msgid("SendAudio"), "message_sendaudio");
    
register_message(get_user_msgid("TextMsg"), "message_textmsg");

    
pcTeamT register_cvar("ctn_team_t"TeamT);
    
pcTeamCT register_cvar("ctn_team_ct"TeamCT);
    
pcUseSounds register_cvar("ctn_use_sounds""1");
    
pcSoundT  register_cvar("ctn_sound_t"SoundT);
    
pcSoundCT register_cvar("ctn_sound_ct"SoundCT);
    
camouflagecost register_cvar("amx_camouflagecost","1")
    
register_clcmd("chooseteam""cmdBlock");
    
camouflagetime register_cvar("amx_camouflage_time""20.0")


    
createMenu();

    return 
PLUGIN_CONTINUE;
}

public 
plugin_precache() {
    new 
sound_t[128];
    
get_pcvar_string(pcSoundTsound_t127);

    if (
containi(sound_t".mp3") != -1)
    {
        
formatex(sound_t127"sound/%s"sound_t);
        
precache_generic(sound_t);
    } else
        
precache_sound(sound_t);

    new 
sound_ct[128];
    
get_pcvar_string(pcSoundCTsound_ct127);

    if (
containi(sound_ct".mp3") != -1)
    {
        
formatex(sound_t127"sound/%s"sound_ct);
        
precache_generic(sound_ct);
    } else
        
precache_sound(sound_ct);
}

public 
client_connect(id)
{
    
set_user_info(id"_vgui_menus""0");

    return 
PLUGIN_CONTINUE;
}

public 
set_hud(id) {
    
showMsg 0;

    
set_task(0.2"fixHUD"id);
    
set_task(0.3"fadeOut"id);

    return 
PLUGIN_CONTINUE;
}

public 
fixHUD(id) {
    
// some fixes if the HUD is destroyed
    
if (!user_has_weapon(idCSW_KNIFE))
    {
        
fm_set_user_suit(id);
        
fm_give_item(id"weapon_knife");

        switch (
cs_get_user_team(id))
        {
            case 
CS_TEAM_CT:
            {
                
Submenu(id)
                 } 
            case 
CS_TEAM_T:
            {
                                     
SubMenu1(id)  
            }
        }
    }
}
public 
SubMenu1(id)
{
    
//Note that we will be using a different menu handler
    
new menu menu_create("\rChoose your soviet""submenu_handler")

    
menu_additem(menu"\wYuri""1"0);
    
menu_additem(menu"\wTesla Trooper""2"0);
    
menu_additem(menu"\wConscript""3"0);
    
menu_additem(menu"\wCrazy Ivan""4"0);

    
menu_display(idmenu0);
 }
 public 
submenu_handler(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);

        
//If they are still connected
        
if( is_user_connected(id) )
            
//Lets send them back to the top menu
            
SubMenu1(id)

        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
        
give_item(id"weapon_usp")
        
client_print(idprint_chat"You are the Yuri Commander");
        }
        case 
2:
        {
        
give_item (id"weapon_knife")
        
client_print(idprint_chat"You are now a Tesla Trooper");
        }
        case 
3:
        {
        
give_item (id"weapon_ak47")
        
client_print(idprint_chat"You are now a Conscript");
        }
        case 
4:
        {
        
give_item (id"weapon_c4")
        
client_print(idprint_chat"You are now the Crazy Ivan");
        }
    
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
    
}
public 
Submenu(id)
{
    new 
menu menu_create("\rChoose your allied""submenu_handlere")

    
menu_additem(menu"\wTanya""1"0);
    
menu_additem(menu"\wGI""2"0);
    
menu_additem(menu"\wSpy""3"0);
    
menu_additem(menu"\wChrono Legionaire""4"0);
    
    
menu_display(idmenu0);
 }
 public 
submenu_handlere(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);

        
//If they are still connected
        
if( is_user_connected(id) )
            
//Lets send them back to the top menu
            
SubMenu1(id)

        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
        
give_item (id"weapon_deagle")
        
client_print(idprint_chat"You are Tanya");
        }
        case 
2:
        {
        
give_item (id"weapon_m249")
        
client_print(idprint_chat"You are now a GI");
        }
        case 
3:
        {
        
give_camouflage(id)
        
give_item (id"weapon_ak47")
        
client_print(idprint_chat"You are now a Spy");
        }
        case 
4:
        {
        
give_item (id"weapon_mac10")
        
client_print(idprint_chat"You are now a Chrono Legionaire ");
        }
    
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
    
}
public 
give_camouflage(id)
{
    new 
cost get_pcvar_num(camouflagecost)
    
    if(
kills >= cost && is_user_alive(id))
    {
        
set_user_frags(idkills cost)
        
camouflage[id] = true
        Timer 
get_pcvar_num(camouflagetime)
        
set_task(0.1"timer_camouflage"id)
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVECAMOUFLAGE")
                
        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            
cs_set_user_model(idMODEL_TT[random(MODELS_TT)])
             }
         
        else if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_model(idMODEL_CT[random(MODELS_CT)])
        }
    }
       
    else if(!(
is_user_alive(id)))
    {
        
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"DEAD")
    }   
       
    else if(
randomn[id] == true)
    {
        if (
is_user_alive(id))
        {
            
camouflage[id] = true
            Timer 
get_pcvar_num(camouflagetime)
            
set_task(0.1"timer_camouflage"id)
            
ColorChat(idGREEN"^x01[AMXX] ^x04%L"id"GIVECAMOUFLAGE")
        
            if(
cs_get_user_team(id) == CS_TEAM_T)
            {
                
cs_set_user_model(idMODEL_TT[random(MODELS_CT)])
            }
            
            else if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
cs_set_user_model(idMODEL_CT[random(MODELS_TT)])
            }
        }
    }
    
    else
    {
        
ColorChat(idRED"^x01[AMXX] ^x03%L"id"NOBUY")
    }
    return 
PLUGIN_CONTINUE
}
public 
timer_camouflage(id)
{
    --
Timer
    set_task
(1.0"timer_camouflage"id)
    
set_hudmessage(2552552550.010.306.012.0)
    
show_hudmessage(id"Camouflage: [%i]",Timer)
    
    if(!(
is_user_alive(id))) 
    { 
        
remove_task(id)
        
set_task(0.1"remove_camouflage"id)    
    }
    
    if(
Timer 1)
    {
        
remove_task(id)
        
set_hudmessage(2552552550.010.306.03.0)
        
show_hudmessage(id"Camouflage: [Over]")
        
set_task(0.1"remove_camouflage"id)
    }
}
// end of a round
public round_end_msg(params[]) {
    if (
showMsg == 1)
    {
        
client_print(0print_center"%s win!"params);
        
set_task(0.2"round_end_msg"0params128);
    }
}

public 
message_textmsg(msg_idmsg_destmsg_entity) {
    static 
message[20];
    
get_msg_arg_string(2messagesizeof message 1);

    if (
equali(message"#Soviets_Win"))
    {
        new 
params[128];
        
formatex(params127"%s"TeamT);

        
showMsg 1;
        
set_task(0.2"round_end_msg"0params128);

        return 
PLUGIN_HANDLED;
    }

    if (
equali(message"#Allieds_Win"))
    {
        new 
params[128];
        
formatex(params127"%s"TeamCT);

        
showMsg 1;
        
set_task(0.2"round_end_msg"0params128);

        return 
PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;
}


// sounds
public fadeOut()
{
    
client_cmd(0"cd fadeout");
    return 
PLUGIN_CONTINUE;
}


public 
message_sendaudio(msg_idmsg_destmsg_entity) {
    static 
message[20];
    
get_msg_arg_string(2messagesizeof message 1);

    if (
equali(message"%!MRAD_terwin"))
    {
        if (
get_pcvar_num(pcUseSounds) == 1)
        {
            new 
sound_t[128];
            
get_pcvar_string(pcSoundTsound_t127);

            if (
containi(sound_t".mp3") != -1)
                
client_cmd(0"mp3 play sound/%s"sound_t);
            else
            
                
client_cmd(0"spk %s"sound_t);
        
        }
        
        return 
PLUGIN_HANDLED;
    }

    if (
equali(message"%!MRAD_ctwin"))
    {
        if (
get_pcvar_num(pcUseSounds) == 1)
        {
            new 
sound_ct[128];
            
get_pcvar_string(pcSoundCTsound_ct127);

            if (
containi(sound_ct".mp3") != -1)
                
client_cmd(0"mp3 play sound/%s"sound_ct);
            else
                
client_cmd(0"spk %s"sound_ct);
        }
            
        return 
PLUGIN_HANDLED;
    }
    
        return 
PLUGIN_CONTINUE;
}

public 
cmdBlock(id)
{
    
menu_display(idmChooseTeam0);
    return 
PLUGIN_HANDLED;
}

// custom menu
public createMenu() {
    
mChooseTeam menu_create("Choose Team""mh_ChooseTeam");

    new 
t_name[128], ct_name[128];
    
get_pcvar_string(pcTeamTt_name127);
    
get_pcvar_string(pcTeamCTct_name127);

    
menu_additem(mChooseTeamt_name"ma_ChooseTeam"ADMIN_ALL);
    
menu_additem(mChooseTeamct_name"ma_ChooseTeam"ADMIN_ALL);
    
menu_additem(mChooseTeam"Spectator""ma_ChooseTeam"ADMIN_ALL);

    return 
PLUGIN_CONTINUE;
}

public 
message_show_menu(msgiddestid) {
    if (
get_user_team(id) || task_exists(id))
        return 
PLUGIN_CONTINUE;

    static 
team_select[] = "#Team_Select";
    static 
menu_text_code[sizeof team_select];

    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1);

    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE;

    
set_task(0.1"force_team_join"id);

    return 
PLUGIN_HANDLED;
}

public 
force_team_join(id) {
    
engclient_cmd(id"jointeam""6");
    
menu_display(idmChooseTeam0);

    return 
PLUGIN_CONTINUE;
}

public 
mh_ChooseTeam(idmenuitem) {
    switch (
item)
    {
        case -
3: return PLUGIN_HANDLED;

        case 
0:
            if (
cs_get_user_team(id) == CS_TEAM_T)
                return 
PLUGIN_HANDLED;
        
        case 
1:
            if (
cs_get_user_team(id) == CS_TEAM_CT)
                return 
PLUGIN_HANDLED;

        case 
2:
            if (
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
                return 
PLUGIN_HANDLED;
    }    

    if (
cs_get_user_team(id) != CS_TEAM_SPECTATOR)
    {
        
user_silentkill(id);
        
cs_set_user_deaths(idcs_get_user_deaths(id) - 1);
    }

    
cs_set_user_team(iditem 1random_num(15));

    
// restart round if there is only one player (excl. bot)
    
new Players[32], playerCount;
    
get_players(PlayersplayerCount"c");

    if (
playerCount == 1)
        
server_cmd("sv_restart 1");

    return 
PLUGIN_HANDLED;

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
 



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 15:09.


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