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

Auto save choose CSDM gunstyle?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lucky888
Senior Member
Join Date: Nov 2011
Location: Paradise
Old 12-09-2013 , 02:45   Auto save choose CSDM gunstyle?
Reply With Quote #1

How do I set auto save choose with this menu?

My menu mean :

1.Choose gun

2.Auto choose your gun (In round before choose)


or easy way

How to save(remember) my page in menu?

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

#define PLUGIN "MainMenu"
#define VERSION "2.0"
#define AUTHOR "DHH"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say menu""show_menu_game")
    
register_clcmd("say /menu""show_menu_game")

}

    
public 
show_menu_game(id)
{        
    
    new 
menu menu_create("Main Menu""menu_main_handler");
    
menu_additem(menu"choose 1""1"0);
    
menu_additem(menu"choose 2""2"0);
    
menu_additem(menu"choose 3""3"0);
    
menu_additem(menu"choose 4""4"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);    
}

public 
menu_main_handler(idmenuitem)
{
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;    
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,2iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
client_cmd(id"bal")
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
        case 
2:
        {
            
client_cmd(id"bababab")
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
        case 
3:
        {
            
client_cmd(id"sadadasda")
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
        case 
4:
        {
            
client_cmd(id"daeasf")
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
    
    
}
// End Menu Main 
Thanks
__________________

Last edited by Lucky888; 12-09-2013 at 03:33.
Lucky888 is offline
Send a message via Yahoo to Lucky888
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 12-09-2013 , 03:06   Re: Auto save choose CSDM gunstyle?
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

new iMaxAmmo[33] = { -25209013211009011201001009090901001203012020032901209023590900100, -1, -};

new 
bool:weapons_menu[33][2];
new 
weapons_bitsum[33][2];
new 
player_weapons[33][2];
new 
bool:time_weapons;
new 
maxPlayers;

public 
plugin_init() {
    
register_plugin("Menu Weapons""1.0""OnePL");

    
register_clcmd("say /guns""MenuWeapon");

    
register_cvar("amx_time_choose""60"); //time for a choice of weapons

    
RegisterHam(Ham_Spawn"player""Spawned"1);

    
register_logevent("RoundEnd"2"1=Round_End");
    
register_logevent("RoundStart"2"1=Round_Start");

    
maxPlayers get_maxplayers();
}

public 
RoundStart() set_task(get_cvar_float("amx_time_choose"), "end_time"444);
public 
end_time() time_weapons true;

public 
RoundEnd() {
    
remove_task(444);
    
time_weapons false;
    for(new 
1<= maxPlayersi++) {
        
weapons_menu[i][0] = false;
        
weapons_menu[i][1] = false;
    }
}

public 
MenuWeapon(id) {
    if(!
is_user_alive(id) || time_weapons) return 1;

    
SetMenuWeapon(idtruetrue00);
    return 
1;
}

public 
Spawned(id) {
    if(!
is_user_alive(id)) return;

    if(
player_weapons[id][0] && player_weapons[id][1]) {
        for(new 
02i++) {
            new 
weaponname[24];
            
get_weaponname(player_weapons[id][i], weaponname23);
            
give_item(idweaponname);
            
cs_set_user_bpammo(idplayer_weapons[id][i], iMaxAmmo[player_weapons[id][i]]);
        }
    }
    else if(!
time_weaponsSetMenuWeapon(idtruetrue00);
}

public 
SetMenuWeapon(idbool:weaponsbool:gunsbitsum_weaponsbitsum_guns) {
    if(!
weapons && !guns) return;

    
weapons_menu[id][0] = weapons;
    
weapons_menu[id][1] = guns;

    
weapons_bitsum[id][0] = bitsum_weapons;
    
weapons_bitsum[id][1] = bitsum_guns;

    
MenuWeapons(id);
}

public 
MenuWeapons(id) {
    if(!
weapons_menu[id][0] && weapons_menu[id][1]) {
        
MenuGuns(id);
        return;
    }
    if(!
weapons_menu[id][0]) return;

    new 
menu menu_create("\rChoose a\w Primary Weapon""HandleWeapons");
    if(!(
weapons_bitsum[id][0] & (1<<28))) menu_additem(menu"AK47""28");
    if(!(
weapons_bitsum[id][0] & (1<<22))) menu_additem(menu"M4A1""22");
    if(!(
weapons_bitsum[id][0] & (1<<14))) menu_additem(menu"Galil""14");
    if(!(
weapons_bitsum[id][0] & (1<<15))) menu_additem(menu"Famas""15");
    if(!(
weapons_bitsum[id][0] & (1<<18))) menu_additem(menu"AWP""18");

    
menu_setprop(menu4"Exit");
    
menu_display(idmenu);
}

public 
HandleWeapons(idmenuitem) {
    if(
item == -|| !is_user_alive(id) || !weapons_menu[id][0]) return;

    new 
weaponname[24], data[3], weaponcallback;
    
menu_item_getinfo(menuitemweapondata2__callback);

    if((
callback WhatGun(id)) > 0ham_strip_weapon(idcallback);

    
weapon str_to_num(data);
    
get_weaponname(weaponweaponname23);

    
give_item(idweaponname);
    
cs_set_user_bpammo(idweaponiMaxAmmo[weapon]);
    
player_weapons[id][0] = weapon;

    if(
weapons_menu[id][1]) MenuGuns(id);
}

public 
MenuGuns(id) {
    if(!
weapons_menu[id][1]) return;

    new 
menu menu_create("\rChoose a\w Secondary Weapon""HandleGuns");
    if(!(
weapons_bitsum[id][1] & (1<<26))) menu_additem(menu"Deagle""26");
    if(!(
weapons_bitsum[id][1] & (1<<16))) menu_additem(menu"USP""16");
    if(!(
weapons_bitsum[id][1] & (1<<17))) menu_additem(menu"Glock""17");
    if(!(
weapons_bitsum[id][1] & (1<<10))) menu_additem(menu"Elites""10");

    
menu_setprop(menu4"Exit");
    
menu_display(idmenu);
}

public 
HandleGuns(idmenuitem) {
    if(
item == -|| !is_user_alive(id) || !weapons_menu[id][1]) return;

    new 
weaponname[24], data[3], weaponcallback;
    
menu_item_getinfo(menuitemweapondata2__callback);

    
weapon str_to_num(data);
    
get_weaponname(weaponweaponname23);
    
give_item(idweaponname);
    
cs_set_user_bpammo(idweaponiMaxAmmo[weapon]);

    
player_weapons[id][1] = weapon;
}

public 
client_disconnect(id) {
    
player_weapons[id][0] = 0;
    
player_weapons[id][1] = 0;
}

stock WhatGun(id) {
    if(!
is_user_alive(id)) return 0;

    new 
weapons[32], numweapons;
    
get_user_weapons(idweaponsnumweapons);

    for(new 
0numweaponsi++)
        if((
1<<weapons[i]) & 0x50FCF1A8) return weapons[i];

    return 
0;
}

stock ham_strip_weapon(idwid) {
    if(!
wid) return 0;

    new 
szName[24]; get_weaponname(widszName23);

    new 
ent;
    while((
ent engfunc(EngFunc_FindEntityByStringent"classname"szName)) && pev(entpev_owner) != id) {}
    if(!
ent) return 0;

    if(
get_user_weapon(id) == widExecuteHam(Ham_Weapon_RetireWeaponent);

    if(
ExecuteHam(Ham_RemovePlayerItemident)) {
        
ExecuteHam(Ham_Item_Killent);
        
set_pev(idpev_weaponspev(idpev_weapons) & ~(1<<wid));
    }
    return 
1;

OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Lucky888
Senior Member
Join Date: Nov 2011
Location: Paradise
Old 12-09-2013 , 03:24   Re: Auto save choose CSDM gunstyle?
Reply With Quote #3

^
Thank so much. But I can't understand your code. I'm amateur coder. Please help me with simple way. Thanks
__________________
Lucky888 is offline
Send a message via Yahoo to Lucky888
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 12-09-2013 , 03:30   Re: Auto save choose CSDM gunstyle?
Reply With Quote #4

After selecting weapons, each round will give these weapons what's chosen from the menu until you disconnect from the server. After writing /guns you can select the new weapons.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Lucky888
Senior Member
Join Date: Nov 2011
Location: Paradise
Old 12-09-2013 , 03:32   Re: Auto save choose CSDM gunstyle?
Reply With Quote #5

I understood. Maybe save choose with menu too hard with me. I have some change simple:
How to save my page in menu?
__________________
Lucky888 is offline
Send a message via Yahoo to Lucky888
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 03:17.


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