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

Class Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
caked
Member
Join Date: Dec 2012
Old 12-24-2012 , 00:02   Class Menu
Reply With Quote #1

Class Menu

v2.6

By Caked

I wanted to release my Class Menu ive made took me forever ! im sorry if wrong section. Enjoy anyways bugs just tell me. My first coding ive ever done so please dont get me wrong!

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <colorchat>
 
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
 
public plugin_init() {
 
 
register_plugin(PLUGINVERSIONAUTHOR)
register_clcmd"say /class""ClassMenu" );
}
public 
ClassMenu(id)
{
new 
menu 
menu_create("\rClass Menu :""menu_handler");
 
 
menu_additem(menu"\wLeone""1"0);
menu_additem(menu"\wCommando""2"0);
menu_additem(menu"\wMachine Gun""3"0);
menu_additem(menu"\wRambo""4"0);
menu_additem(menu"\wSchmidt""5"0);
menu_additem(menu"\wKrieg""6"0);
menu_additem(menu"\wIDF Defender""7"0);
menu_additem(menu"\wRifle""8"0);
menu_additem(menu"\wMaverick""9"0);
menu_additem(menu"\wClarion""10"0);
menu_additem(menu"\wBullpup""11"0);
 
 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
menu_display(idmenu0);
 
 
}
public 
menu_handler(idmenuitem)
{
if( 
item == MENU_EXIT 
)
{
menu_destroy(menu);
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:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Leone^x03 ^x04[Shotgun][Deagle][HE Grenade]^x04");
give_item(id"weapon_xm1014");
give_item(id"weapon_deagle");
give_item(id"weapon_hegrenade");
cs_set_user_bpammoidCSW_XM1014200 );
cs_set_user_bpammoidCSW_DEAGLE200 );
}
case 
2:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class^x03 Commando^x03 ^x04[Dak Dak][Usp][HE Grenade]^x04");
give_item(id"weapon_sg550");
give_item(id"weapon_usp");
give_item(id"weapon_flashbang");
cs_set_user_bpammoidCSW_SG550200 );
cs_set_user_bpammoidCSW_USP200 );
}
case 
3
 
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Machine Gun^x03 ^x04[Mp5][Glock][Smoke Grenade]^x04");
give_item(id"weapon_mp5navy");
give_item(id"weapon_glock18");
give_item(id"weapon_smokegrenade");
cs_set_user_bpammoidCSW_MP5NAVY200 );
cs_set_user_bpammoidCSW_GLOCK18200 );
}
case 
4:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Rambo^x03 ^x04[Ak47][Five-Seven][HE Grenade]^x04");
give_item(id"weapon_ak47");
give_item(id"weapon_fiveseven");
give_item(id"weapon_hegrenade");
cs_set_user_bpammoidCSW_AK47200 );
cs_set_user_bpammoidCSW_FIVESEVEN200 );
}
case 
5:

 
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Schmidt^x03 ^x04[Scout][Deagle][Flash Bang]^x04");
give_item(id"weapon_scout");
give_item(id"weapon_deagle");
give_item(id"weapon_flashbang");
cs_set_user_bpammoidCSW_SCOUT200 );
cs_set_user_bpammoidCSW_DEAGLE200 );
}
case 
6:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Krieg^x03 ^x04[Krieg 552][Usp][Smoke Grenade]^x04");
give_item(id"weapon_sg552");
give_item(id"weapon_usp");
give_item(id"weapon_smokegrenade");
cs_set_user_bpammoidCSW_SG552200 );
cs_set_user_bpammoidCSW_USP200 );
}
case 
7:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03IDF Defender^x03 ^x04[Galil][Glock][He Grenade]^x04");
give_item(id"weapon_galil");
give_item(id"weapon_glock18");
give_item(id"weapon_hegrenade");
cs_set_user_bpammoidCSW_GALIL200 );
cs_set_user_bpammoidCSW_GLOCK18200 );
}
case 
8:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Rifle^x03 ^x04[Sniper][Five-Seven][Flash Bang]^x04");
give_item(id"weapon_awp");
give_item(id"weapon_fiveseven");
give_item(id"weapon_flashbang");
cs_set_user_bpammoidCSW_AWP200 );
cs_set_user_bpammoidCSW_FIVESEVEN200 );
}
case 
9:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class ^x03Maverick^x03 ^x04[M4a1][Deagle][Smoke Grenade]^x04");
give_item(id"weapon_m4a1");
give_item(id"weapon_deagle");
give_item(id"weapon_smokegrenade");
cs_set_user_bpammoidCSW_M4A1200 );
cs_set_user_bpammoidCSW_DEAGLE200 );
}
case 
10:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class^x03 Clarion^x03 ^x04[Famas][Usp][He Grenade]^x04");
give_item(id"weapon_famas");
give_item(id"weapon_usp");
give_item(id"weapon_hegrenade");
cs_set_user_bpammoidCSW_FAMAS200 );
cs_set_user_bpammoidCSW_USP200 );
}
case 
11:
{
ColorChat(idRED,"^x04[ Class ]^x01 You Have Chosen The Class^x03 Bullpup^x03 ^x04[Aug][Glock][Flash Bang]^x04");
give_item(id"weapon_aug");
give_item(id"weapon_glock18");
give_item(id"weapon_flashbang");
cs_set_user_bpammoidCSW_AUG200 );
cs_set_user_bpammoidCSW_GLOCK18200 );
}
}


Last edited by caked; 12-24-2012 at 00:10.
caked is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-24-2012 , 00:32   Re: Class Menu
Reply With Quote #2

Where is the tutorial or snippet?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
rastafari
Senior Member
Join Date: May 2011
Old 12-24-2012 , 01:51   Re: Class Menu
Reply With Quote #3

Where is the speciality of the code?
I mean it's just a simple menu.
__________________
rastafari is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-24-2012 , 12:12   Re: Class Menu
Reply With Quote #4

Quote:
Originally Posted by YamiKaitou View Post
Where is the tutorial or snippet?
Quote:
Originally Posted by caked View Post
im sorry if wrong section.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 12-26-2012 , 14:26   Re: Class Menu
Reply With Quote #5

you can use enums for optimize this.

and this thread is in a wrong section.

PD: your class menu sucks.
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 12-26-2012 , 16:48   Re: Class Menu
Reply With Quote #6

Quote:
Originally Posted by Roccoxx View Post
you can use enums for optimize this.

and this thread is in a wrong section.

PD: your class menu sucks.
Why are you saying that? He's beginner... if you want to help him show how to improve his code...
__________________

Last edited by Neeeeeeeeeel.-; 12-26-2012 at 16:48.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 12-26-2012 , 22:10   Re: Class Menu
Reply With Quote #7

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Why are you saying that? He's beginner... if you want to help him show how to improve his code...
ok sorry. not tested.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "ClassMenu"
#define VERSION "1.0"
#define AUTHOR "roccoxx"

enum _:miclass{
    
name[40],
    
primary[32],
    
secondary[32],
    
grenade[32],
    
cswp,
    
csws,
    
number
}

new 
g_class[][miclass] = {
    {
"William Smith""weapon_mp5navy""weapon_deagle""weapon_hegrenade"CSW_MP5NAVYCSW_DEAGLE200},
    {
"Leon""weapon_xm1014""weapon_glock18""weapon_flashbang"CSW_XM1014CSW_GLOCK18250},
    {
"Connor""weapon_mac10""weapon_p228""weapon_smokegrenade"CSW_MAC10CSW_P228500}
}

public 
plugin_init() {
     
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"say /class""ClassMenu" );
}
public 
ClassMenu(id)
{
    if(
is_user_alive(id)) return
    
    new 
menu menu_create("\rClass Menu :""menu_handler");
    
    new 
len[500] , temp[22
        for(new 
sizeof g_class i++) 
        { 
          
formatex(len charsmax(len) , "\w%s" g_class[i][name]) 

          
num_to_str(i,temp2
          
menu_additem(menu len temp
        } 
     
        
menu_setprop(menu MPROP_BACKNAME,"\wAtras"
        
menu_setprop(menu MPROP_NEXTNAME,"\wSiguiente"
        
menu_setprop(menu MPROP_EXITNAME,"\wSalir"
 
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0); 
}
public 
menu_handler(idmenuitem)
{
    if(
is_user_alive(id)) return PLUGIN_HANDLED
    
if( item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED
    }
    new 
data[6], iName[64];
    new 
accesscallback;
 
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    
client_print(idprint_chat"your class is: %s"g_class[item][name])
    
give_item(idg_class[item][primary]);
    
give_item(idg_class[item][secondary]);
    
give_item(idg_class[item][grenade]);
    
cs_set_user_bpammoidg_class[item][cswp], g_class[item][number] );
    
cs_set_user_bpammoidg_class[item][csws], g_class[item][number] );
    
    return 
PLUGIN_HANDLED

__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"

Last edited by Roccoxx; 12-26-2012 at 22:16.
Roccoxx is offline
Send a message via MSN to Roccoxx
twix_p
Member
Join Date: Jul 2011
Old 12-27-2012 , 00:41   Re: Class Menu
Reply With Quote #8

Quote:
Originally Posted by Roccoxx View Post
ok sorry. not tested.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "ClassMenu"
#define VERSION "1.0"
#define AUTHOR "roccoxx"

enum _:miclass{
    
name[40],
    
primary[32],
    
secondary[32],
    
grenade[32],
    
cswp,
    
csws,
    
number
}

new 
g_class[][miclass] = {
    {
"William Smith""weapon_mp5navy""weapon_deagle""weapon_hegrenade"CSW_MP5NAVYCSW_DEAGLE200},
    {
"Leon""weapon_xm1014""weapon_glock18""weapon_flashbang"CSW_XM1014CSW_GLOCK18250},
    {
"Connor""weapon_mac10""weapon_p228""weapon_smokegrenade"CSW_MAC10CSW_P228500}
}

public 
plugin_init() {
     
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"say /class""ClassMenu" );
}
public 
ClassMenu(id)
{
    if(
is_user_alive(id)) return
    
    new 
menu menu_create("\rClass Menu :""menu_handler");
    
    new 
len[500] , temp[22
        for(new 
sizeof g_class i++) 
        { 
          
formatex(len charsmax(len) , "\w%s" g_class[i][name]) 

          
num_to_str(i,temp2
          
menu_additem(menu len temp
        } 
     
        
menu_setprop(menu MPROP_BACKNAME,"\wAtras"
        
menu_setprop(menu MPROP_NEXTNAME,"\wSiguiente"
        
menu_setprop(menu MPROP_EXITNAME,"\wSalir"
 
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0); 
}
public 
menu_handler(idmenuitem)
{
    if(
is_user_alive(id)) return PLUGIN_HANDLED
    
if( item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED
    }
    new 
data[6], iName[64];
    new 
accesscallback;
 
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    
client_print(idprint_chat"your class is: %s"g_class[item][name])
    
give_item(idg_class[item][primary]);
    
give_item(idg_class[item][secondary]);
    
give_item(idg_class[item][grenade]);
    
cs_set_user_bpammoidg_class[item][cswp], g_class[item][number] );
    
cs_set_user_bpammoidg_class[item][csws], g_class[item][number] );
    
    return 
PLUGIN_HANDLED

Something new and usefull, i didn't saw someone doing that in this way before.
But i have a questions.

PHP Code:
enum _:miclass
    
name[40], 
    
primary[32], 
    
secondary[32], 
    
grenade[32], 
    
cswp
    
csws
    
number 


new 
g_class[][miclass] = { 
    {
"William Smith""weapon_mp5navy""weapon_deagle""weapon_hegrenade"CSW_MP5NAVYCSW_DEAGLE200}, 
    {
"Leon""weapon_xm1014""weapon_glock18""weapon_flashbang"CSW_XM1014CSW_GLOCK18250}, 
    {
"Connor""weapon_mac10""weapon_p228""weapon_smokegrenade"CSW_MAC10CSW_P228500

If i care very much abut performance, is it better to use this way or the old way with a new const for every thing, like:

PHP Code:
new const name[ ][ ] = {"William Smith""Leon""Connor" }
new const 
primary[ ][ ] = { "weapon_mp5navy""weapon_xm1014",  weapon_mac10" }
new const secondary[ ][ ] = { "
weapon_deagle", "weapon_glock18",  "weapon_p228" } ... etc 
Wich way is more recommended and will affect less the server performance?

Last edited by twix_p; 12-28-2012 at 13:07.
twix_p is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 12-27-2012 , 01:26   Re: Class Menu
Reply With Quote #9

Quote:
Originally Posted by twix_p View Post
Something new and usefull, i didn't saw someone doing that in this way before.
But i have a questions.

PHP Code:
enum _:miclass
    
name[40], 
    
primary[32], 
    
secondary[32], 
    
grenade[32], 
    
cswp
    
csws
    
number 


new 
g_class[][miclass] = { 
    {
"William Smith""weapon_mp5navy""weapon_deagle""weapon_hegrenade"CSW_MP5NAVYCSW_DEAGLE200}, 
    {
"Leon""weapon_xm1014""weapon_glock18""weapon_flashbang"CSW_XM1014CSW_GLOCK18250}, 
    {
"Connor""weapon_mac10""weapon_p228""weapon_smokegrenade"CSW_MAC10CSW_P228500

If i care very much abut performance, is it better to use this way or the old way with a new const for every thing, like:

PHP Code:
new const name[ ][ ] = {"William Smith""Leon""Connor" }
new const 
primary[ ][ ] = { "weapon_mp5navy""weapon_xm1014",  weapon_mac10" }
new const primary[ ][ ] = { "
weapon_deagle", "weapon_glock18",  "weapon_p228" } ... etc 
Wich way is more recommended and will affect less the server performance?
You won't see any difference in game.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
caked
Member
Join Date: Dec 2012
Old 12-27-2012 , 20:15   Re: Class Menu
Reply With Quote #10

I did the code this way because i started coding from this website which helped me - https://forums.alliedmods.net/showth...6364#BasicMenu
caked 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 00:32.


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