AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Q] Help With Class Menu Plugin (https://forums.alliedmods.net/showthread.php?t=207359)

oxygen935 02-01-2013 16:43

[Q] Help With Class Menu Plugin
 
1 Attachment(s)
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!

Blizzard_87 02-02-2013 00:11

Re: [Q] Help With Class Menu Plugin
 
2 Attachment(s)
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.

oxygen935 02-02-2013 03:44

Re: [Q] Help With Class Menu Plugin
 
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.


All times are GMT -4. The time now is 20:38.

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