Raised This Month: $ Target: $400
 0% 

[REQ] JB shop whith nVault Top15


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MerreBigger
Senior Member
Join Date: Nov 2012
Location: Belgium
Old 12-25-2013 , 09:35   [REQ] JB shop whith nVault Top15
Reply With Quote #1

Hi all
I found a plugin..
This over here
PHP Code:
/* Plugin generated by AMXX-Studio */

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

new const PLUGIN[] = "JailBreakShop"
new const VERSION[] = "v1.2"
new const AUTHOR[] = "NapoleoN#"

new const g_szPrefix[] = "^x04[JB-Shop]^x01"
new const JBINFO[] = "jbinfo.html"
new const CMD[] = "commands.html"

new pCash[33]

new 
g_pEnableShop // Gives you the possibility to Enable / Disable the shop.
new g_pEnableInfo // Gives you the possibility to Enable / Disable the /info command.
new g_pEnableCommands // Gives you the possibility to Enable / Disable the /commands command.
new g_pEnableGamble // Gives you the possibility to Enable / Disable the Gamble system.

new const Shop_ItemNamesTerro[8][] = {
    
"Deagle (7 Bullets)",
    
"Gravity (600)",
    
"Speed",
    
"Regenerate to 100HP",
    
"Disable Footsteps",
    
"Invisability (60 Seconds)",
    
"Secret Rebel Packet",
    
"Roll The Dice"
}
new const 
Shop_ItemPricesTerro[8] = {
    
3000,
    
2000,
    
1500,
    
4000,
    
2000,
    
6000,
    
7000,
    
0
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /jbshop""JailBreakShop")
    
register_clcmd("say /shop""JailBreakShop")
    
register_clcmd("say /jailbreakshop""JailBreakShop")
    
register_clcmd("say_team /jbshop""JailBreakShop")
    
register_clcmd("say_team /shop""JailBreakShop")
    
register_clcmd("say_team /jailbreakshop""JailBreakShop")
    
    
register_clcmd("say /jbinfo""JailBreakInfo")
    
register_clcmd("say_team /jbinfo""JailBreakInfo")
    
register_clcmd("say /info""JailBreakInfo")
    
register_clcmd("say_team /info""JailBreakInfo")
    
    
register_clcmd("say /commands""Commands")
    
register_clcmd("say /cmds""Commands")
    
register_clcmd("say_team /commands""Commands")
    
register_clcmd("say_team /cmds""Commands")
    
    
register_clcmd("say /gamble""gamble")
    
register_clcmd("say /rtd""gamble")
    
register_clcmd("say_team /gamble""gamble")
    
register_clcmd("say_team /rtd""gamble")
    
    
register_clcmd("say /he""hegrenade")
    
register_clcmd("say_team /he""hegrenade")
    
    
register_clcmd("say /cash""Handler_ShowPlayerCash")
    
    
RegisterHam(Ham_Killed"player""Ham_PlayerKilled");
    
    
g_pEnableShop register_cvar("jb_shop""1")
    
g_pEnableInfo register_cvar("jb_info""1")
    
g_pEnableCommands register_cvar("jb_commands""1")
    
g_pEnableGamble register_cvar("jb_gamble""1")
}

public 
JailBreakShop(id)
{
    if(!
get_pcvar_num(g_pEnableShop))
    {
        return 
PLUGIN_HANDLED
    
}
    if(
cs_get_user_team(id)==CS_TEAM_T && is_user_alive(id))
    {
        new 
ShopMenu menu_create("\rJailBreak \yShop \wMenu:""shop_handler")
        
        new 
szTemp[500], Key[6]; 
        
        for(new 
08i++) {
            
formatex(szTempcharsmax(szTemp), "%s%s\d [\y$%i\d]", (pCash[id] >= Shop_ItemPricesTerro[i]) ? "\r" "\d"Shop_ItemNamesTerro[i], Shop_ItemPricesTerro[i])
            
num_to_str(iKeycharsmax(Key))
            
menu_additem(ShopMenuszTempKey)
        }
        
menu_setprop(ShopMenuMPROP_EXITMEXIT_ALL)
        
menu_display(idShopMenu0)
    }
    return 
PLUGIN_CONTINUE
}

public 
shop_handler(idShopMenuitem) {
    if(
item != MENU_EXIT) {
        new 
key MenuKey(ShopMenuitem)
        
        if(
Shop_ItemPricesTerro[key] > pCash[id]) {
            
ColorChat(idGREY"%s You don't got enough money for^x03 %s^x01."g_szPrefixShop_ItemNamesTerro[key])
            
JailBreakShop(id)
        }
        else {
            switch(
key)
            {
                case 
0:
                {
                    
give_item(id"weapon_deagle")
                }
                case 
1:
                {
                    
set_user_gravity(id0.7)
                }
                case 
2:
                {
                    
set_user_maxspeed(id320.0)
                }
                case 
3:
                {
                    
set_user_health(id100)
                }
                case 
4:
                {
                    
set_user_footsteps(id1)
                }
                case 
5:
                {
                    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0);
                    
set_task(60.0"RemoveInvis"id)
                }
                case 
6:
                {
                    
give_item(id"weapon_usp")
                    
give_item(id"weapon_flashbang")
                    
give_item(id"weapon_hegrenade")
                    
set_user_health(id80)
                    
set_user_armor(id100)
                }
                case 
7:
                {
                    if(!
get_pcvar_num(g_pEnableGamble))
                    {
                        return 
PLUGIN_HANDLED
                    
}
                    if(
pCash[id] > 200)
                    {
                        new 
Playernum random_num(1100)
                        new 
Servernum random_num(25100)
                        if(
Playernum Servernum)
                        {
                            new 
szName[32]; get_user_name(idszNamecharsmax(szName))
                            
pCash[id] += 200
                            ColorChat
(idTEAM_COLOR"%s You've won^x04 200$^x01 versus the server! %i vs %i"g_szPrefixPlayernumServernum)
                        }
                        else if(
Servernum Playernum)
                        {
                            new 
szName[32]; get_user_name(idszNamecharsmax(szName))
                            
pCash[id] -= 200
                            ColorChat
(idTEAM_COLOR"%s You've lost^x04 200$^x01 versus the server! %i vs %i"g_szPrefixServernumPlayernum)
                        }
                    }
                    else if(
pCash[id] < 200)
                    {
                        
ColorChat(idTEAM_COLOR"%s You need more JB cash to roll the dice!"g_szPrefix)
                    }
                        
                }
            }
            if(
Shop_ItemPricesTerro[key]) {
                
pCash[id] -= Shop_ItemPricesTerro[key]
                
ColorChat(idGREY"%s You bought item^x03 %s^x01 for^x03 %i$^x01."g_szPrefixShop_ItemNamesTerro[key], Shop_ItemPricesTerro[key])
            }
        }
    }    
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
set_task(10.0"ShowMessage"id)
    
set_task(20.0"ShowInfo"id)
}

public 
ShowMessage(id)
{
    if(
is_user_connected(id))
    {
        new 
szName[32]; get_user_name(idszNamecharsmax(szName))
        
ColorChat(idTEAM_COLOR"%s Welcome to the server, ^x04[%s]^x01!"g_szPrefixszName)
    }
}

public 
RemoveInvis(id)
{
    if(
is_user_alive(id))
    {
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha255)
        
ColorChat(idTEAM_COLOR"%s You are not invisable anymore!"g_szPrefix)
    }
}

public 
JailBreakInfo(id)
{
    if(!
get_pcvar_num(g_pEnableInfo))
    {
        return 
PLUGIN_HANDLED
    
}
    if(
is_user_connected(id))
    {
        
show_motd(idJBINFO"JailBreak Shop Information!")
    }
    return 
PLUGIN_CONTINUE
}

public 
ShowInfo(id)
{
    if(
is_user_connected(id))
    {
        
ColorChat(idTEAM_COLOR"%s Type /info to check out the information about the JB Shop!"g_szPrefix)
    }
}

public 
Commands(id)
{
    if(!
get_pcvar_num(g_pEnableCommands))
    {
        return 
PLUGIN_HANDLED
    
}
    if(
is_user_connected(id))
    {
        
show_motd(idCMD"JailBreak Shop Commands!")
    }
    return 
PLUGIN_CONTINUE
}


public 
hegrenade(id)
{
    if(
cs_get_user_team(id)==CS_TEAM_CT && is_user_alive(id))
    {
        
give_item(id"weapon_hegrenade")
    }
    else
    {
        
ColorChat(idTEAM_COLOR"%s You're not alive or you're not in the correct team to say use this command."g_szPrefix)
    }
}

public 
Ham_PlayerKilled(idiAttacker)
{
    if(
is_user_alive(iAttacker) && get_user_team(id) != get_user_team(iAttacker))
    {
        
pCash[iAttacker] += 150
    
}
}

public 
Handler_ShowPlayerCash(idiAttacker
{
    
client_print(idprint_chat"You got %i cash."pCash[iAttacker])
}
stock MenuKey(menuitem) {
    new 
iAccessszNum], hCallback
    menu_item_getinfo
menuitemiAccessszNumcharsmaxszNum ), __hCallback )
    
    return 
str_to_numszNum )

but i want
this into it so if player says /cashtop
you can see top players whith most cash ....
so i found this
PHP Code:
stock save_client_pointsindex )
{
 
gVault nvault_open"Jbcash" )
 
 if( 
gVault == INVALID_HANDLE )
 {
  
set_fail_state"[JbShop] nValut ERROR: =-> Invalid-Handle" )
 }
 
 
get_user_authidindexgSteamIDcharsmaxgSteamID ) )
 
 
formatexvKeycharsmaxvKey ), "%sCASH"gSteamID )
 
formatexvDatacharsmaxvData ), "%d"gKillerPointsindex ] )
 
nvault_setgVaultvKeyvData )
 
nvault_closegVault )
}
stock load_client_pointsindex )
{
 
gVault nvault_open"Jbcash" )
 
 if( 
gVault == INVALID_HANDLE )
 {
  
set_fail_state"[JbShop] nValut ERROR: =-> Invalid-Handle" )
 }
 
 
get_user_authidindexgSteamIDcharsmaxgSteamID ) )
 
 
formatexvKeycharsmaxvKey ), "%sCASH"gSteamID )
 
gKillerPointsindex ] = nvault_getgVaultvKey )
 
nvault_closegVault )
}
public 
show_top15(id){
 new 
pos,key[64],data[64],timestamp
 
new vault nvault_util_open("Jbcash")
 new 
count nvault_util_count(vault)
 
 new Array:
stats,Trie:names
 stats 
ArrayCreate(20)
 
names TrieCreate()
 
 new 
temp[20],knum[5]
 for (new 
i=1;i<=count;i++ ){
  
pos nvault_util_read(vault,pos,key,64,data,64,timestamp)
  
formatex(temp,19,"%d %d",i,str_to_num(data))
  
ArrayPushString(stats,temp)
  
replace_all(key,64,"CASH","")
  
formatex(knum,4,"%d",i)
  
TrieSetString(names,knum,key)
 }
 
 
nvault_util_close(vault)
 
ArraySort(stats,"sorter")
 
 new 
motd[1501],iLen;
 
iLen format(motdsizeof motd 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
 
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%s %-22.22s %3s^n""#""Name""Cash")
 
 for(new 
015x++){
  new 
rank,name[32],srank[5]
  new 
pt getter(stats,x,rank)
  
formatex(srank,4,"%d",rank)
  
TrieGetString(names,srank,name,31)
  
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%d %-22.22s %d^n"1namept);
 }
 
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"</body></font></pre>")
 
 
ArrayDestroy(stats)
 
TrieDestroy(names)
 
show_motd(id,motd"Cash top");
}
public 
sorter(Array:array,item1,item2){
 new 
res1=getter(array,item1)
 new 
res2=getter(array,item2)
 
 if(
res1<res2)
  return 
1
 
 
else if(res1>res2)
  return -
1
 
return 0
}
getter(Array:array,item,&rank=0){
 new 
outa[32],temp[2][10],val
 ArrayGetString
(array,item,outa,31)
 
parse(outa,temp[0],9,temp[1],9)
 
rank str_to_num(temp[0])
 
val str_to_num(temp[1])
 return 
val
}
 
public 
ClientUserInfoChanged(id

 static const 
name[] = "name" 
 
static szOldName[32], szNewName[32
 
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
 if( 
szOldName[0] ) 
 {
  
get_user_info(idnameszNewNamecharsmax(szNewName)) 
  if( !
equal(szOldNameszNewName) ) 
  {
   
gKillerPoints[id] = 0
   set_task
(0.5"ChangeTime"id)
   return 
FMRES_HANDLED 
  
}
 }
 return 
FMRES_IGNORED 

Whith command /cashtop
I can donate if you want.
Thanks
__________________
___________________________________________


MerreBigger 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:29.


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