Raised This Month: $ Target: $400
 0% 

[Q] Help With Class Menu Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-01-2013 , 16:43   [Q] Help With Class Menu Plugin
Reply With Quote #1

I have a problem with this plugin:

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

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <colorchat>
#include <fun>
#include <hamsandwich>

#define PLUGIN "Guard Classes"
#define VERSION "1.0"
#define AUTHOR "oxygen"

new menu;
new bool:g_connected[33];
new bool:used[33]

public plugin_init() 
{
	register_clcmd( "say /class","guardclass", 0);
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)	
}

public guardclass(id)
{
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
		ColorChat(id, GREEN, "You must be CT to use this Menu")
	}
	else
	{
		guardclass1(id);
	}
	return PLUGIN_CONTINUE;
}
public guardclass1(id)
{	menu = menu_create("\r[\wGaming\r-\wPower\r]\yCT Class Menu By \rO\wx\rY\wg\rE\wn","class_handler")
	menu_additem(menu, "Subdivision\r(\wM4A1,USP\r)","1",0);
	menu_additem(menu, "FBI\r(\wAk47,GLOCK\r)","2",0);
	menu_additem(menu, "Israel Police\r(\wAWP,DEAGLE\r)","3",0);
	menu_additem(menu, "Guardia\r(\wUMP,USP\r)","4",0);
	menu_additem(menu, "SWAT\r(\wM3,P228\r)","5",0);
	menu_additem(menu, "Policia\r(\wMAC10,DEAGLE\r)","6",0);
	menu_additem(menu, "[ADMIN]Commandant\r(\wDUAL KRISS,ELITES,DEAGLE\r)","7",0);
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, menu, 0)
	return PLUGIN_HANDLED
}
public class_handler(id, menu, item)
{
	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
	new key = str_to_num(data);
	switch(key)
	{
		case 1:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_m4a1" );
				cs_set_user_bpammo( id, CSW_M4A1, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_usp"), 12);
				cs_set_user_bpammo( id, CSW_USP, 100 );
				
			}
				
		}
		case 2:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_ak47" );
				cs_set_user_bpammo( id, CSW_AK47, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_deagle"), 14);
				cs_set_user_bpammo( id, CSW_DEAGLE, 100 );
			}
				
		}
		case 3:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_awp" );
				cs_set_user_bpammo( id, CSW_AWP, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_deagle"), 7);
				cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
			}
				
		}
		case 4:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_ump45" );
				cs_set_user_bpammo( id, CSW_UMP45, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_usp"), 12);
				cs_set_user_bpammo( id, CSW_USP, 100 );
			}	
		}
		case 5:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_m3" );
				cs_set_user_bpammo( id, CSW_M3, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_p228"), 12);
				cs_set_user_bpammo( id, CSW_P228, 100 );
			}	
		}
		case 6:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				give_item( id, "weapon_ump45" );
				cs_set_user_bpammo( id, CSW_UMP45, 90 );
				cs_set_weapon_ammo( give_item(id, "weapon_p228"), 12);
				cs_set_user_bpammo( id, CSW_P228, 100 );
			}	
		}
		case 7:
		{
			if(used[id])
			{
				ColorChat(id, BLUE, "You can select an class per round!");
				return PLUGIN_HANDLED
			}
			else
			{
				used[id] = true
				jb_adminclass(id)
			}	
		}
	}
	return PLUGIN_HANDLED;
}

public jb_adminclass(id)
{
	if (get_user_flags(id) & ADMIN_CHAT)
	{
		give_item( id, "weapon_elite" );
		cs_set_user_bpammo( id, CSW_ELITE, 90 );
		cs_set_weapon_ammo( give_item(id, "weapon_deagle"), 7);
		cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
	}
	else
	{
		client_print(id, print_chat, "You Must Be Admin To Select This Class")
	}
}
public player_spawn(id)
{
	if( is_user_alive( id ) && is_user_connected( id ) )
	{
		strip_user_weapons( id );
		give_item( id, "weapon_knife" );
	}
	if( cs_get_user_team( id ) == CS_TEAM_CT )
	{
		give_item( id, "weapon_deagle" );
		cs_set_user_bpammo( id, CSW_DEAGLE, 35 );
		menu_display(id, menu, 0);
	}
	used[id] = false
}

public client_putinserver(client)
{
	g_connected[client] = true;
}

public client_disconnect(client)
{
	g_connected[client] = false;
}
i want to create a new class only for admins. but i want to set a new model for this weapon. This model is the dual kriss (search in google, this weapon replaces the P90) so i want some help and how to do this...

PS.: i'm new with the AMXX scripting!
PS2.:I also attached the colorchat.inc for those who don't found it!
Attached Files
File Type: inc colorchat.inc (2.5 KB, 140 views)
oxygen935 is offline
Send a message via Skype™ to oxygen935
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 02-02-2013 , 00:11   Re: [Q] Help With Class Menu Plugin
Reply With Quote #2

ive added the models to show in the players Hands....

im not to sure howto add them to the other views without errors / bugs...

and ive also fixed up the used[33]; variable.
Attached Files
File Type: sma Get Plugin or Get Source (oxygen_guardclass.sma - 573 views - 4.2 KB)
File Type: zip kriss.zip (995.9 KB, 55 views)

Last edited by Blizzard_87; 02-02-2013 at 00:11.
Blizzard_87 is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 02-02-2013 , 03:44   Re: [Q] Help With Class Menu Plugin
Reply With Quote #3

okey... thanks a lot, but there is a little bug, when you select the admin class you can see the kriss model but when you press Q and select the deagle and again back to the kriss it shows you the p90 model and not the kriss.
oxygen935 is offline
Send a message via Skype™ to oxygen935
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 20:38.


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