Raised This Month: $ Target: $400
 0% 

[SOLVED]to combine these plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sabrioz
Senior Member
Join Date: Apr 2009
Old 09-04-2009 , 14:25   [SOLVED]to combine these plugin
Reply With Quote #1

hello all...can someone combine these plugin and make an admin cmd for it

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_plugin("Knife Only Mod""0.1""Amxx Community")
    
register_event("CurWeapon""event_knife_off""be""1=0""2=29")
    
register_cvar("amx_knives_only""1")
}

public 
event_knife_off(id) {
    if (!
get_cvar_num("amx_knives_only"))
        return

    
engclient_cmd(id"weapon_knife")
    
client_print(idprint_center"Knife only mode is on. You can't swith your weapons!")

and this plugin
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <csx>
#include <fun>

const g_GrenadeNum 5;

public 
plugin_init() {
    
register_plugin("HE Only mode""0.1""Amxx Community")
    
register_event("CurWeapon""event_he_off""be""1=0""2=4")
    
register_cvar("amx_he_only""1")
}

public 
event_he_off(id) {
    if (!
get_cvar_num("amx_he_only"))
        return

    
engclient_cmd(id"weapon_hegrenade")
    
client_print(idprint_center"HE only mode is on. You can't swith your weapons!")
}

public 
grenade_throwid greindex wId 
{
    if ( 
wId == CSW_HEGRENADE )
        
cs_set_user_bpammoid CSW_HEGRENADE g_GrenadeNum );

all i want is:
when i (admin) say /arena
the menu will appear like this

Arena mode:
1. Knife only mode
2. HE only mode

if admin choose 1. Knife only mode
so all the players must use knife only

if admin choose 2. HE only mode
so all the players must use HE only

when admin say /arenaoff
so arena mode will be off and all players can play for the normal mode...

can someone help me?

Last edited by sabrioz; 02-12-2010 at 08:16. Reason: Problem Solved
sabrioz is offline
tolsty
Senior Member
Join Date: Feb 2008
Location: Latvia
Old 09-04-2009 , 16:59   Re: [HOW]to combine these plugin
Reply With Quote #2

heres a simple menu using cvars, you dont need to combine the plugins


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


new knife
new he
public plugin_init() {
    
register_plugin("arenamenu""0.1""tolsty")
    
knife register_cvar("amx_knives_only""0")
    
he register_cvar("amx_he_only""0")
    
register_clcmd"say /arena""view_menu",ADMIN_LEVEL_A );
}

public 
view_menu(id,level,cid) {
    if(
cmd_access(id,level,cid,0)) {

    new 
menu menu_create("ARENA MENU:""menu_handler");
    
menu_additem(menu"\w knifes only""1"0);
    
menu_additem(menu"\w grenades only""2"0);
    
menu_additem(menu"\w disable""3"0);

    
menu_addblank(menu0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    }
    return 
1;
}

public 
menu_handler(idmenuitem) {
    if (
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata5__callback);
    
    new 
key str_to_num(data);
    switch (
key
    {
        case 
1
        {
            if (!
get_pcvar_num(knife) ) {
                
set_pcvar_num(knife1)
                
set_pcvar_num(he0)
            }
            else {
                
set_pcvar_num(knife0)
            }             
        }
        case 
2:
        {    
            if (!
get_pcvar_num(he)  ) {
                
set_pcvar_num(knife0)
                
set_pcvar_num(he1)
            }
            else {
                
set_pcvar_num(he0)    
            }         
        }
        case 
3:
        {
            
set_pcvar_num(knife0)
            
set_pcvar_num(he0)
        }
                        
        
    }
    
    
menu_cancel(id);
    return 
PLUGIN_HANDLED;

tolsty is offline
sabrioz
Senior Member
Join Date: Apr 2009
Old 09-04-2009 , 22:44   Re: [HOW]to combine these plugin
Reply With Quote #3

Quote:
Originally Posted by tolsty View Post
heres a simple menu using cvars, you dont need to combine the plugins


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


new knife
new he
public plugin_init() {
    
register_plugin("arenamenu""0.1""tolsty")
    
knife register_cvar("amx_knives_only""0")
    
he register_cvar("amx_he_only""0")
    
register_clcmd"say /arena""view_menu",ADMIN_LEVEL_A );
}

public 
view_menu(id,level,cid) {
    if(
cmd_access(id,level,cid,0)) {

    new 
menu menu_create("ARENA MENU:""menu_handler");
    
menu_additem(menu"\w knifes only""1"0);
    
menu_additem(menu"\w grenades only""2"0);
    
menu_additem(menu"\w disable""3"0);

    
menu_addblank(menu0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    }
    return 
1;
}

public 
menu_handler(idmenuitem) {
    if (
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata5__callback);
    
    new 
key str_to_num(data);
    switch (
key
    {
        case 
1
        {
            if (!
get_pcvar_num(knife) ) {
                
set_pcvar_num(knife1)
                
set_pcvar_num(he0)
            }
            else {
                
set_pcvar_num(knife0)
            }             
        }
        case 
2:
        {    
            if (!
get_pcvar_num(he)  ) {
                
set_pcvar_num(knife0)
                
set_pcvar_num(he1)
            }
            else {
                
set_pcvar_num(he0)    
            }         
        }
        case 
3:
        {
            
set_pcvar_num(knife0)
            
set_pcvar_num(he0)
        }
                        
        
    }
    
    
menu_cancel(id);
    return 
PLUGIN_HANDLED;

should i use your plugin together with my plugin?

or only use your plugin?

sorry for the nooby question...
sabrioz is offline
sabrioz
Senior Member
Join Date: Apr 2009
Old 09-05-2009 , 02:13   Re: [HOW]to combine these plugin
Reply With Quote #4

tolsty
plugin tested..
result ok..no bug found yet..
thanks guy...
sabrioz 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 15:11.


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