AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can someone help me ? (https://forums.alliedmods.net/showthread.php?t=170743)

poliisi299 10-28-2011 13:10

Can someone help me ?
 
plzz help me, i need two plugin in one. 1 plugin Grenade Sack. 2 my plugin code are down, can someone help how can get this plugin in one
2 code

#include <cstrike>
#include <fun>
#include <hamsandwich>

new const PLUGIN[] = "grenadeshop"
new const VERSION[] = "0.1"
new const AUTHOR[] = "quark"

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("say /nades", "grenadeshop")
register_clcmd("say nades", "grenadeshop")
}

public grenadeshop(id)
{
if(is_user_alive(id))
{
new ShopMenu = menu_create("Nades Shop", "shop_handler")
menu_additem(ShopMenu, "Blast Nades (500$)", "1", id)
menu_additem(ShopMenu, "Fire Nades (750$)", "2", id)
menu_additem(ShopMenu, "Frost Nades (500$)", "3", id)
menu_setprop(ShopMenu, MPROP_EXIT, MEXIT_ALL);
menu_setprop(ShopMenu, MPROP_NUMBER_COLOR, "\y");
menu_display(id, ShopMenu, 0)
}
return PLUGIN_CONTINUE
}

public shop_handler(id, ShopMenu, item)
{
new money = cs_get_user_money(id)
switch(item)
{
case 0:
{
if(money >= 500)
{
new setmoney = money - 500
cs_set_user_money(id, clamp(setmoney, 0, 50000))
give_item(id, "weapon_hegrenade")
client_print(id, print_chat, "You have Blast Nade")
}
else client_print(id, print_chat, "You Dont Have Now Money")
}
case 1:
{
if(money >= 750)
{
new setmoney = money - 750
cs_set_user_money(id, clamp(setmoney, 0, 50000))
give_item(id, "weapon_flashbang")
client_print(id, print_chat, "You have Fire Nade")
}
else client_print(id, print_chat, "You Dont Have Now Money")
}
case 2:
{
if(money >= 500)
{
new setmoney = money - 500
cs_set_user_money(id, clamp(setmoney, 0, 50000))
give_item(id, "weapon_smokegrenade")
client_print(id, print_chat, "You Have Frost Nade")
}
else client_print(id, print_chat, "You Dont Have Now Money")
}
}
}

Napoleon_be 10-28-2011 13:28

Re: Can someone help me ?
 
PHP Code:

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

new const PLUGIN[] = "grenadeshop"
new const VERSION[] = "0.1"
new const AUTHOR[] = "quark"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /nades""grenadeshop")
    
register_clcmd("say nades""grenadeshop")
}

public 
grenadeshop(id)
{
    if(
is_user_alive(id))
    {
        new 
ShopMenu menu_create("Nades Shop""shop_handler")
        
menu_additem(ShopMenu"Blast Nades (500$)""1"id)
        
menu_additem(ShopMenu"Fire Nades (750$)""2"id)
        
menu_additem(ShopMenu"Frost Nades (500$)""3"id)
        
menu_setprop(ShopMenuMPROP_EXITMEXIT_ALL);
        
menu_setprop(ShopMenuMPROP_NUMBER_COLOR"\y");
        
menu_display(idShopMenu0)
    }
    return 
PLUGIN_CONTINUE
}

public 
shop_handler(idShopMenuitem)
{
    new 
money cs_get_user_money(id)
    switch(
item)
    {
        case 
0:
        {
            if(
money >= 500)
            {
                new 
setmoney money 500
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_hegrenade")
                
client_print(idprint_chat"You have Blast Nade")
            }
            else 
client_print(idprint_chat"You Dont Have Now Money")
        }
        case 
1:
        {
            if(
money >= 750)
            {
                new 
setmoney money 750
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_flashbang")
                
client_print(idprint_chat"You have Fire Nade")
            }
            else 
client_print(idprint_chat"You Dont Have Now Money")
        }
        case 
2:
        {
            if(
money >= 500)
            {
                new 
setmoney money 500
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_smokegrenade")
                
client_print(idprint_chat"You Have Frost Nade")
            }
            else 
client_print(idprint_chat"You Dont Have Now Money")
        }
    }


Thanks for using my code @ JailBreakShop but next time leave the #include <amxmodx> in it..

quark 11-18-2011 19:10

Re: Can someone help me ?
 
NOT LOL

Backstabnoob 11-18-2011 19:14

Re: Can someone help me ?
 
Quote:

Originally Posted by Napoleon_be (Post 1585063)
PHP Code:

... 

Thanks for using my code @ JailBreakShop but next time leave the #include <amxmodx> in it..

Sorry but the code is one of the most easiest to write, it's not optimized and coded badly so it can cause errors. I wouldn't dare to say something like "my code" when talking about creating a custom menu that only checks if the user has required money and gives grenades. If by any chance this is your work, you even failed at doing it.

Napoleon_be 11-18-2011 20:05

Re: Can someone help me ?
 
Quote:

Originally Posted by Backstabnoob (Post 1598799)
Sorry but the code is one of the most easiest to write, it's not optimized and coded badly so it can cause errors. I wouldn't dare to say something like "my code" when talking about creating a custom menu that only checks if the user has required money and gives grenades. If by any chance this is your work, you even failed at doing it.

This was coded like a month ago, i improved a lot in that time:
PHP Code:

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

new const VERSION[] = "0.1"

new const g_szShopItems[3][] = {
    
"Blast Nades",
    
"Fire Nades",
    
"Frost Nades"
}

new const 
iShopPrices[3] = {
    
500,
    
750,
    
500
}

public 
plugin_init()
{
    
register_plugin("Grenade Shop"VERSION"quark")
    
register_clcmd("say /nades""grenadeshop")
    
register_clcmd("say nades""grenadeshop")
}

public 
grenadeshop(id)
{
    if(
is_user_alive(id))
    {
        new 
menu menu_create("Nades Shop""shop_handler")
        for(new 
0sizeof(g_szShopItems); i++) {
            new 
szTemp[500], Key[6]
            
            
formatex(szTempcharsmax(szTemp), "%s [%i$]"cs_get_user_money(id) >= iShopPrices[i] ? "\r" "\d"g_szShopItems[i], iShopPrices[i])
            
num_to_str(iKeycharsmax(Key))
            
menu_additem(menuszTempKey)
        }
        
menu_display(idmenu)
    }
    else {
        
client_print(idprint_chat"You have to be alive to open the shop!")
    }
    return 
PLUGIN_CONTINUE
}

public 
shop_handler(idShopMenuitem)
{
    new 
money cs_get_user_money(id)
    switch(
item)
    {
        case 
0:
        {
            if(
money >= 500)
            {
                new 
setmoney money 500
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_hegrenade")
                
client_print(idprint_chat"You have Blast Nade")
            }
            else {
                
client_print(idprint_chat"You Dont Have Now Money")
            }
        }
        case 
1:
        {
            if(
money >= 750)
            {
                new 
setmoney money 750
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_flashbang")
                
client_print(idprint_chat"You have Fire Nade")
            }
            else {
                
client_print(idprint_chat"You Dont Have Now Money")
            }
        }
        case 
2:
        {
            if(
money >= 500)
            {
                new 
setmoney money 500
                cs_set_user_money
(idclamp(setmoney050000))
                
give_item(id"weapon_smokegrenade")
                
client_print(idprint_chat"You Have Frost Nade")
            }
            else {
                
client_print(idprint_chat"You Dont Have Now Money")
            }
        }
    }




All times are GMT -4. The time now is 14:21.

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