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

Drop and Limit In menu [CTF]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AstRoid
Junior Member
Join Date: May 2020
Location: Cordoba, Argentina
Old 05-19-2020 , 22:34   Drop and Limit In menu [CTF]
Reply With Quote #1

Hello, people. I'm here to give you a consultation...
Edit a basic buymenu for a CTF and this half bug. What I want is that when you buy a gun, you drop the one I have equipped, because if not, there are guns that run and bug.


Menu Code:

PHP Code:
Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <ColorChat>
#include <cstrike>
#include <Armas>

#define gPlugin "SHOP"
#define Prefix "[CTF-SHOP]"

enum _:DATA_TIENDA {
    
NOMBRE[20], 
    
PRECIO
}

new const 
ItemsTienda[][DATA_TIENDA] = {
    {
"Skull-4"0},
    {
"DualUzi"0},
    {
"Railcannon"0},
    {
"PlasmaGun [A]"0},
    {
"BrickPiece-M4A1"0},
    {
"Janus-5"0},
    {
"Newcome \r+6"0},
    {
"Laser Minigun"0},
    {
"Vulcanus-5"0},
    {
"Spas-12"0},
    {
"Ak47 Paladin"0},
    {
"Thunderbolt"0},
    {
"Aeolis"0},
    {
"Maverick Crowbar"0},
    {
"Avalanche"0},
    {
"Magnum Drill \r+6"0},
    {
"M249 Phoenix"0},
    {
"Balrog-3"0},
    {
"Red Dragon Cannon"0},
    {
"Mosin Galaxy"0},
    {
"Leviathan"0}
}


#define PLUGIN "Weapon Menu Simple"
#define VERSION "1.2"
#define AUTHOR ""


public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
// Add your code here...
 
register_plugin(gPlugin"1.0""")
 
/* = Clcmd = */
    
}

public 
menu_tienda(id) {
    new 
imenutext[100]
    
menu menu_create("\r[CTF] \wSpecial Weapons Menu""handler_tienda")
    
    for(
0sizeof(ItemsTienda); i++) {
        if(
cs_get_user_money(id) < ItemsTienda[i][PRECIO]) {
            
formatex(textcharsmax(text), "\d%s \r[ $%d ]"ItemsTienda[i][NOMBRE], ItemsTienda[i][PRECIO])
        } else {
            
formatex(textcharsmax(text), "\w%s \y[ $%d ]"ItemsTienda[i][NOMBRE], ItemsTienda[i][PRECIO])
        }
        
menu_additem(menutext__menu_makecallback("tienda_callback"))
    }
    
menu_display(idmenu)
}
public 
plugin_natives ()
{
 
register_native("armasricas""menu_tienda"1)
}
 
public 
tienda_callback(idmenuitem) {
    if(
cs_get_user_money(id) < ItemsTienda[item][PRECIO])
        return 
ITEM_DISABLED;
        
    return 
ITEM_ENABLED;
}

public 
handler_tienda(idmenuitem) {
    if(
item == MENU_EXIT)
        return 
PLUGIN_HANDLED;
        
    switch(
item) {
        case 
0give_weapon_skull4(id)
        case 
1native_adduzi(id)
        case 
2give_weapon_railcannon(id)
        case 
3give_weapon_Plasmagun(id)
        case 
4give_weapon_Brickpiecev2(id)
        case 
5give_weapon_JanusV(id)
        case 
6give_weapon_new(id)
        case 
7give_weapon_LaserMinigun(id)
        case 
8give_weapon_Vulcanus5(id)
        case 
9give_weapon_Spas12(id)
        case 
10give_weapon_buffAk(id)
        case 
11give_weapon_Rayo(id)
        case 
12give_weapon_Areolis(id)
        case 
13give_weapon_Crowbar(id)
        case 
14give_weapon_m4a1dragon(id)
        case 
15Get_MGDC(id)
        case 
16give_weapon_MP(id)
        case 
17give_weapon_b3(id)
        case 
18give_weapon_cx(id)
        case 
19give_weapon_mosin(id)
        case 
20give_weapon_lv(id)
    }
    
    
cs_set_user_money(idcs_get_user_money(id) - ItemsTienda[item][PRECIO], 1)
    
ColorChat(idGREEN"%s^1 BUYED:^4 %s."PrefixItemsTienda[item][NOMBRE])
    return 
PLUGIN_HANDLED;

Credits for SkyLar.


and the other thing I needed, was how to limit the acquisition of an item and put a counter on it ( [0/1] After obtaining -> [1/1]
this with some special weapons I have on the CTF admin menu.


Here's the code:
PHP Code:
#include <amxmodx> 
#include <fun> 
#include <AdminMenu>
#include <fakemeta>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <amxmisc>

#define PLUGIN "MenuCtf"
#define AUTHOR ""
#define VERSION "1.0"


new cvar_vida

public plugin_init() 

 
register_plugin(PLUGINVERSIONAUTHOR
}
public 
plugin_natives ()
{
 
register_native("menuad""menuadmin"1)
}
 
 

public 
menuadmin(id

 if(!
is_user_admin(id))
        return 
1

 new 
Menu menu_create("\r[CTF] \wAdmin Menu""mostrar_menu"
 
menu_additem(Menu"\wAmxmodmenu""1"0
 
menu_additem(Menu"\y|Take|\wWeapon Gungnir Quimera""2"0)
 
menu_additem(Menu"\y|Take|\wWeapon M3 Black Dragon""3"0)
 
menu_additem(Menu"\y|Take|\wWeapon M95 Tiger""4"0)
   
 
menu_setprop(Menu,MPROP_EXITNAME,"Exit""0")
 
 
 
menu_display(idMenu0


public 
mostrar_menu(idMenuitem

 if (
item == MENU_EXIT
 { 
 
menu_destroy(Menu
 return 
PLUGIN_HANDLED 
 

 
 new 
iData[6]; 
 new 
iAccess
 new 
iCallback
 new 
iName[64]; 
 
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback
 
 switch (
str_to_num(iData)) 
 { 
 case 
1
 {
 
client_cmd(id"amxmodmenu")
 } 
 case 
2:
 {
 
give_weapon_gugnir(id)
 }
 case 
3:
 {
 
give_weapon_m3dragon(id)
 }
 case 
4
 {
 
give_weapon_m95(id)
 }
 }
 
 return 
PLUGIN_HANDLED 

Si me pueden responder en espaņol joya.

AstRoid.-

Last edited by AstRoid; 05-19-2020 at 22:42. Reason: Nothing xd
AstRoid 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 08:20.


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