Raised This Month: $ Target: $400
 0% 

bb_weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Avioane Americane
Junior Member
Join Date: Dec 2015
Old 05-01-2020 , 14:38   bb_weapons
Reply With Quote #1

I tried to add menu 3 for grenades but it gave me an error.

PHP Code:
char g_LastPrimaryWeapon[MAXPLAYERS 1][50];
char g_LastSecondaryWeapon[MAXPLAYERS 1][50];

public 
Action CMD_Guns(int clientint args)
{
    if(
GetClientTeam(client) == BUILDERS && !IsPrepTime() && !IsBuildTime())
    {
        
int weapon GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY);
        if(!
IsValidEntity(weapon))
        {
            
ShowWeaponMenu(client);    
        }
    }
}

public 
void Weapons_OnClientPutInServer(int client)
{
    
g_LastPrimaryWeapon[client] = "";
    
g_LastSecondaryWeapon[client] = "";
}

public 
void RemoveAllPlayerWeapons(int client)
{
    
//Removing primary weapon
    
int weapon GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY);
    if(
weapon 0) {
        
RemovePlayerItem(clientweapon);
        
RemoveEdict(weapon);    
    }
    
    
//Removing secondary weapon
    
int weapon2 GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY);
    if(
weapon2 0) {
        
RemovePlayerItem(clientweapon2);
        
RemoveEdict(weapon2);    
    }
    
    
//Removing grenades
    
int weapon3 GetPlayerWeaponSlot(clientCS_SLOT_GRENADE);
    if(
weapon3 0) {
        
RemovePlayerItem(clientweapon3);
        
RemoveEdict(weapon3);    
    }
}


public 
void Weapons_OnPrepTimeStart()
{
    
LoopAllPlayers(i
    {
        if(
GetClientTeam(i) == BUILDERS
        {
            
ShowWeaponMenu(i);
            
            
//Anti cheat stuff
            
CreateTimer(0.2Remove_Knifei);
        }
    }    
}

public 
Action Remove_Knife(Handle tmrany client)
{
    
int knife GetPlayerWeaponSlot(clientCS_SLOT_KNIFE);
    if(
knife > -1)
    {
        
RemovePlayerItem(clientknife);
        
RemoveEdict(knife);    
    }
}

public 
void Weapons_OnPrepTimeEnd()
{
    
LoopAllPlayers(i)
    {
        if(
GetClientTeam(i) == BUILDERS)
        {
            
GivePlayerItem(i"weapon_knife");
            
            if(!
StrEqual(g_LastPrimaryWeapon[i], "") && !StrEqual(g_LastSecondaryWeapon[i], ""))
            {
                
GivePlayerItem(ig_LastSecondaryWeapon[i]);
                
GivePlayerItem(ig_LastPrimaryWeapon[i]);    
            }        
        }
    }
}

void ShowWeaponMenu(int client)
{
    
Menu menu = new Menu(MenuHandlers_PrimaryWeapon);
    
menu.SetTitle("Arme BBGO.WESTCS.RO");
    
    if(!
StrEqual(g_LastPrimaryWeapon[client], "") && !StrEqual(g_LastSecondaryWeapon[client], ""))
        
menu.AddItem("last""Last weapons");
    
    
menu.AddItem("weapon_ak47",             "AK-47");
    
menu.AddItem("weapon_m4a1_silencer",             "M4A1-S");  
       
menu.AddItem("weapon_xm1014",             "XM1014");
    
    
SetMenuExitButton(menufalse);
    
menu.Display(client0);
}

public 
int MenuHandlers_PrimaryWeapon(Menu menuMenuAction actionint clientint item
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            if(
GetClientTeam(client) == BUILDERS && IsPlayerAlive(client) && !IsBuildTime()) 
            {
                
char info[32];
                
GetMenuItem(menuiteminfosizeof(info));
                
                if (
StrEqual(info"last"))
                    return 
false;
                
                
//Set new last weapon
                
g_LastPrimaryWeapon[client] = info;
                
                if(!
IsPrepTime() && StrEqual(g_LastPrimaryWeapon[client], ""))
                    
GivePlayerItem(clientinfo);

                
Menu menu2 = new Menu(MenuHandlers_SecondaryWeapon);
                
menu2.SetTitle("Secondary weapon");
                
menu2.AddItem("weapon_glock",         "glock");
                
menu2.AddItem("weapon_hkp2000",     "USP");
                
SetMenuExitButton(menu2false);
                
menu2.Display(client0);
            }
        }
    }
    return 
false;
}

public 
int MenuHandlers_SecondaryWeapon(Menu menu2MenuAction actionint clientint item
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            if(
GetClientTeam(client) == CS_TEAM_CT && IsPlayerAlive(client)) 
            {
                
char info[32];
                
GetMenuItem(menu2iteminfosizeof(info));
                
                
g_LastSecondaryWeapon[client] = info;
                
                if(!
IsPrepTime() && StrEqual(g_LastSecondaryWeapon[client], ""))
                    
GivePlayerItem(clientinfo);
            }
        }
    }

Avioane Americane 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 03:20.


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