Raised This Month: $ Target: $400
 0% 

need example code "shop weapon unlock mode"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neko3in1
Member
Join Date: Dec 2013
Location: Indonesia
Old 12-31-2013 , 06:47   need example code "shop weapon unlock mode"
Reply With Quote #1

Hellooo, i want to make shop menu but it like Gun xp mod, if you buy weapon you can use weapon for 1 map.. anyone can make example code ?

Last edited by Neko3in1; 12-31-2013 at 06:50.
Neko3in1 is offline
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-01-2014 , 09:54   Re: need example code "shop weapon unlock mode"
Reply With Quote #2

Take this its shuld to work:

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

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

#define PLUGIN "Gun's Menu"
#define VERSION "1.0"
#define AUTHOR "Asafmazon."

new bool:gHasM4A1[33], gHasAK47[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
    
register_clcmd("say /shop""ShopMenu")
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawn"1);
}

public 
client_putinserver(id)
{
    
gHasAK47[id] = false
    gHasM4A1
[id] = false
}

public  
ShopMenu(id)
{
    new 
szItem[25], szHasM4A1[47], szHasAK47[47];
    
    
formatex(szItemcharsmax(szItem), "\rGun's Menu:");
    new 
menu menu_create(szItem"ShopMenu_Handler");
    
    
formatex(szHasM4A1charsmax(szHasM4A1),"%s"gHasM4A1[id] ? "\wAlready purchase in this map." "\wM4A1 \r(\y16000$\r)");
    
formatex(szHasAK47charsmax(szHasAK47),"%s"gHasAK47[id] ? "\wAlready purchase in this map." "\wAK47 \r(\y15500$\r)");
    
    
menu_additem(menuszHasM4A1""gHasM4A1[id] ? 0);
    
menu_additem(menuszHasAK47""gHasAK47[id] ? 0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
ShopMenu_Handler(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
money cs_get_user_money(id);
    new 
m4a1cost 16000
    
new ak47cost 15500
    
    
switch(item)
    {
        case 
0:
        {
            
            if(
money m4a1cost || money == m4a1cost) {
                
cs_set_user_money(idmoney m4a1cost);
                
client_print(idprint_chat"You purchase M4A1.");
                
give_item(id"weapon_m4a1");
                
cs_set_user_bpammo(idCSW_M4A190);
                
gHasM4A1[id] = true;
                } else {
                
client_print(idprint_chat"You dont have enough money.");
            }
        }
        case 
1:
        {
            if(
money ak47cost || money == ak47cost) {
                
cs_set_user_money(idmoney ak47cost);
                
client_print(idprint_chat"You purchase AK47.");
                
give_item(id"weapon_ak47");
                
cs_set_user_bpammo(idCSW_AK4790);
                
gHasAK47[id] = true;
                } else {
                
client_print(idprint_chat"You dont have enough money.");
            }
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
FwdPlayerSpawn(id)
{
    if(
gHasM4A1[id])
    {
        
give_item(id"weapon_m4a1");
        
cs_set_user_bpammo(idCSW_M4A190);
    }
    
    if(
gHasAK47[id])
    {
        
give_item(id"weapon_ak47");
        
cs_set_user_bpammo(idCSW_AK4790);
    }


Last edited by ShLuMieL; 01-01-2014 at 10:06.
ShLuMieL 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 20:42.


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