Raised This Month: $ Target: $400
 0% 

help with shop vip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Juuhz
Junior Member
Join Date: Sep 2012
Old 09-01-2012 , 19:25   help with shop vip
Reply With Quote #1

Hello, I'm newbie, I modified it a plug and left it the way I wanted, but I wanted to put certain items only for vip, using ADMIN_LEVEL_H
most do not know how, could someone help?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new i
new bool:g_iSet[33]
new 
g_szDefault_Model[33][50]

enum _:items_data {
    
item_Name[100],
    
item_Cost,
    
item_Team
}

new Array:
g_aItems
new gmsgSetFOV 
new bool:has_drug[33]

public 
plugin_init()
{
    
register_plugin("JailBreak SHOP.""2.0""Andre Neves")
    
    
register_clcmd("say /shop""cmdShop")
    
    
register_event("CurWeapon""set_speed""be""1=1");
    
    
g_aItems ArrayCreate(items_data)
    
    
Add_Item("500 Hp"15000CS_TEAM_CT)
    
Add_Item("255 Hp"7500CS_TEAM_CT)
    
Add_Item("TEC-TEC\d [VIP]"16000CS_TEAM_CT)
    
Add_Item("Gravidade\d [20s]"5000CS_TEAM_CT)
    
Add_Item("1 Bomba HE" 3000CS_TEAM_CT)
    
Add_Item("2 Bombas Flash"2000CS_TEAM_CT)
    
Add_Item("Park Bombas"9000CS_TEAM_CT)
    
Add_Item("1 Bombas Congelante"4000CS_TEAM_CT)
    
Add_Item("Colete 255",5000CS_TEAM_T)
    
Add_Item("Invencibilidade\d [5s]"15000CS_TEAM_T)
    
    
gmsgSetFOV get_user_msgid("SetFOV"
}

public 
cmdShop(id)
{
    if(!
is_user_alive(id))
    {
        
client_print(idprint_chat"[Click #1] Voce precisa estar vivo para abrir o Shop !!")
    }
    
    static 
iMoneyszBuffer[50], iTotalItemsitem_Data[items_data], team
    team    
_:cs_get_user_team(id)
    
iMoney  cs_get_user_money(id)
    
    
formatex(szBuffercharsmax(szBuffer), "\r[Click #1] - Shop ^n Seu dinheiro:\w%i^n\wPagina:"iMoney)
    new 
iMenu menu_create(szBuffer"MenuHandler")
    
    new 
szMenuId[10]
    
    
iTotalItems ArraySize(g_aItems)
    
    for( 
0iTotalItemsi++)
    {
        
ArrayGetArray(g_aItemsiitem_Data)
        
        if(
item_Data[item_Team] != _:team)
            continue
        
        if(
item_Data[item_Cost] > iMoney)
        {
            
remove_colorMenu(item_Data[item_Name], charsmax(item_Data[item_Name]))
            
formatex(szBuffercharsmax(szBuffer), "%s \r=[%i]"item_Data[item_Name], item_Data[item_Cost])
        }
        
        else
            
formatex(szBuffercharsmax(szBuffer), "%s \r=[%i]"item_Data[item_Name], item_Data[item_Cost])
        
        
num_to_str(iszMenuId9)
        
menu_additem(iMenuszBufferszMenuId)
    }
    
    
menu_setprop(iMenuMPROP_EXITMEXIT_ALL)
    
menu_display(idiMenu)
    
    return 
1
}

public 
MenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
        return
    
    new 
data[6], iName[64]
    new 
iAccesscallback
    menu_item_getinfo
(menuitemiAccessdata5iName63callback)
    new 
itemId str_to_num(data)
    
    static 
iMoneyitem_Data[items_data]
    
    
iMoney cs_get_user_money(id)
    
    
ArrayGetArray(g_aItemsitemIditem_Data)
    
    if(
iMoney item_Data[item_Cost])
    {
        
client_print(idprint_chat"[Click #1] Voce ainda precisa de mais dinheiro para comprar este item !!")
        return
    }
    
    
iMoney -= item_Data[item_Cost]
    
    
cs_set_user_money(idiMoney)
    
    switch(++
itemId)
    {
        case 
1:                         
        {
            
set_user_health(id500)
            
            
client_printidprint_chat"[Click #1] Voce comprou 500 de Vida !!")
        
        }
        case 
2:   
        {
            
set_user_health(id255)
            
            
client_printidprint_chat"[Click #1] Voce comprou 255 de Vida !!")
            
        }
        case 
3
        {
        
            
cs_set_weapon_ammo(give_item(id"weapon_sg550"), 12)
            
cs_set_user_bpammo(idCSW_USP0)
            
            
client_printidprint_chat"[Click #1] Voce comprou uma TEC-TEC !!")
                
        }
        case 
4:
        {
            
set_user_gravity(id0.5)
            
set_task(20.0"remove_gravity"id)
            
            
client_printidprint_chat"[Click #1] Voce comprou 20 segundos de Gravidade reduzida !!")
                
        }
        case 
5:
        {
            
give_item(id"weapon_hegrenade")
            
            
client_printidprint_chat"[Click #1] Voce comprou 1 Granada !!")
                
        }
        case 
6:
        {
            
give_itemid"weapon_flashbang" );
            
give_itemid"weapon_flashbang" );
            
            
client_printidprint_chat"[Click #1] Voce comprou 2 Flash !!")
            
        }
        case 
7:
        {
            
give_item(id"weapon_hegrenade")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_smokegrenade")            
            
            
client_printidprint_chat"[Click #1] Voce comprou Park Granadas com Flash , He e Smolk !!")
                
        }
        case 
8:{
            
            
            
give_item(id"weapon_smokegrenade")
            
            
            
client_printidprint_chat"[Click #1] Voce comprou Granada Congelante !!")
            
        }
        case 
9
        {
            
cs_set_user_armor(id255CS_ARMOR_VESTHELM)
            
            
client_printidprint_chat"[Click #1] Voce comprou 255 de Colete !!")
                
        }
                     
        case 
10:
        {
            
set_user_godmode(id1)
            
set_task(5.0"remove_godmode"id)
            
            
client_printidprint_chat"[Click #1] Voce comprou 5 segundos de Invensibilidade !!")
                
        }
    }
    return;
}

Add_Item(name[], costCsTeams:team) {
    static 
item_Data[items_data]
    
    
copy(item_Data[item_Name], charsmax(item_Data[item_Name]), name)
    
item_Data[item_Cost] = cost
    item_Data
[item_Team] = _:team
    
    ArrayPushArray
(g_aItemsitem_Data)     
}

public 
remove_gravity(id)
{
    if(
is_user_connected(id))
        
set_user_gravity(id1.0)
}

public 
remove_noclip(id)
{
    if(
is_user_connected(id))
        
set_user_noclip(id0)
}

public 
remove_godmode(id)
    
set_user_godmode(id0)

public 
remove_CTmodel(id)
    
cs_set_user_model(idg_szDefault_Model[id])

public 
remove_drug(id)
{
    if(!
has_drug[id])
        return;
    
    
message_begin(MSG_ONEgmsgSetFOV, {0,0,0}, id
    
write_byte(90
    
message_end() 
    
has_drug[id] = false
    client_print
idprint_chat"O Efeito da Maconha Acabou !!")
    
client_printidprint_chat"By:  !!")        
}

remove_colorMenu(menu[], len)
{
replace_all(menulen"\r""")
replace_all(menulen"\d""")
replace_all(menulen"\y""")
replace_all(menulen"\w""")

copyc(menulenmenu0)
}

public 
Reset_Stealth(id
{
set_user_renderingidkRenderFxNone000kRenderNormal)
client_print(idprint_chat" Sua Invisibilidade Acabou !!")
client_printidprint_chat"By:  !!")        
}

public 
set_speed(id)
{
if(
g_iSet[id])
{
    
set_user_maxspeed(id600.0)
}
}

public 
set_timer(id)
{
set_user_maxspeed(id250.0)
client_print(idprint_chat" Sua Velocidade Acabou !!")
client_printidprint_chat"By:  !!")        
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
wanted to leave that item just for vip using ADMIN_LEVEL_H
PHP Code:
    Add_Item("TEC-TEC\d [VIP]"16000CS_TEAM_CT
Juuhz is offline
Infernuz
Member
Join Date: May 2011
Old 09-01-2012 , 22:12   Re: help with shop vip
Reply With Quote #2

PHP Code:
case 3:  
{
    new 
user_flags get_user_flags(id);
    
    if(
user_flags ADMIN_LEVEL_H) {
        
cs_set_weapon_ammo(give_item(id"weapon_sg550"), 12
        
cs_set_user_bpammo(idCSW_USP0
    
        
client_printidprint_chat"[Click #1] Voce comprou uma TEC-TEC !!"
    } else {
        
client_printidprint_chat"No SG550 for ya! Sorry dude, go ask daddy for permission."
    }

?

Last edited by Infernuz; 09-01-2012 at 22:16.
Infernuz is offline
Send a message via ICQ to Infernuz
Juuhz
Junior Member
Join Date: Sep 2012
Old 09-02-2012 , 00:24   Re: help with shop vip
Reply With Quote #3

Hello Infernuz, thank you very much, it worked, but only had a problem when a normal player will buy it can no longer spend money

There is one more thing, is regeneration and no recoil add this shop?
Juuhz is offline
Infernuz
Member
Join Date: May 2011
Old 09-02-2012 , 10:05   Re: help with shop vip
Reply With Quote #4

Quote:
Originally Posted by Juuhz View Post
Hello Infernuz, thank you very much, it worked, but only had a problem when a normal player will buy it can no longer spend money

There is one more thing, is regeneration and no recoil add this shop?
Yeah, that's because money are being subtracted before the check if user have the flags. Look at your code here.

PHP Code:
    iMoney -= item_Data[item_Cost
     
    
cs_set_user_money(idiMoney
     
    switch(++
itemId
    { 
        case 
1
If user have enought money, and he clicks on SG550 item AND he won't have the flag ADMIN_LEVEL_H. His money will be gone.

To fix this, you will have to simply move the substraction money code to the end of the switch case and at the bottom make a check if user clicked on some item.


Quote:
There is one more thing, is regeneration and no recoil add this shop?
I don't realy understand you. You want me to make it for you?
Infernuz is offline
Send a message via ICQ to Infernuz
Juuhz
Junior Member
Join Date: Sep 2012
Old 09-02-2012 , 12:18   Re: help with shop vip
Reply With Quote #5

Hello, thank you very much, it worked just right now.

Quote:
Originally Posted by Infernuz View Post
I don't realy understand you. You want me to make it for you?
if you have time and want to help a newbie and makes you happy, it would be great, I do not know how to construct codes in amxmodx editor
Juuhz 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