Raised This Month: $319 Target: $400
 79%   Almost there!

[req] Please add samting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FLOY
Senior Member
Join Date: Dec 2013
Location: I love to www.steam.lv
Old 01-03-2021 , 08:06   [req] Please add samting
Reply With Quote #1

Quote:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#include <WPMGPrintChatColor>

#define PLUGIN "Shop"
#define VERSION "1.0"
#define AUTHOR "StudenT"

#define ACCESS ADMIN_LEVEL_H

#define RegMenu(%1,%2) register_menucmd(register_menuid(%1), 1023, %2)
#define Flag(%1) get_user_flags(%1) & ACCESS
#define Connect(%1) is_user_connected(%1)
#define Alive(%1) is_user_alive(%1)
#define SetMoney(%1) cs_set_user_money(%1)
#define GetMoney(%1) cs_get_user_money(%1)

#define COST_ARMOR get_pcvar_num(g_Cvar[2])
#define COST_ALLGREN get_pcvar_num(g_Cvar[3])
#define COST_HEALTH get_pcvar_num(g_Cvar[4])
#define COST_SMOKEGREN get_pcvar_num(g_Cvar[5])
#define COST_HEGREN get_pcvar_num(g_Cvar[6])
#define COST_FLASHGREN get_pcvar_num(g_Cvar[7])
#define COST_INVIS get_pcvar_num(g_Cvar[8])

new g_Discount[33]
new g_Cvar[9]
new bool:g_Once[33][8]

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

g_Cvar[0] = register_cvar("shop_enabled", "")
g_Cvar[1] = register_cvar("shop_admdiscount", "")

g_Cvar[2] = register_cvar("shop_costarmor", "")
g_Cvar[3] = register_cvar("shop_costallgren", "")
g_Cvar[4] = register_cvar("shop_costhealth", "")
g_Cvar[5] = register_cvar("shop_costsmokegren", "")
g_Cvar[6] = register_cvar("shop_costhegren", "")
g_Cvar[7] = register_cvar("shop_costflashgren", "")
g_Cvar[8] = register_cvar("shop_costinvis", "")

RegisterHam(Ham_Spawn, "player", "HamSpawnPlayers", 1)

RegMenu("ShopMenu", "ActionShop")
register_clcmd("shop", "ClCmd_Shop")
register_clcmd("say /shop", "ClCmd_Shop")
register_clcmd("say_team /shop", "ClCmd_Shop")

register_dictionary("shop.txt")
}

public plugin_cfg()
{
new g_Cfg[128]
get_localinfo("amxx_configsdir", g_Cfg, charsmax(g_Cfg))
return server_cmd("exec %s/shop.cfg", g_Cfg)
}

public HamSpawnPlayers(id)
{
if(!Connect(id))
return HAM_IGNORED

if(g_Once[id][7])
fm_set_user_rendering(id)

for(new i; i < 8; i++)
g_Once[id][i] = true

return HAM_IGNORED
}

public ClCmd_Shop(id)
{
if(get_pcvar_num(g_Cvar[0]) == 0)
{
PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_DISABLED")
return PLUGIN_HANDLED
}

if(Flag(id)) g_Discount[id] = get_pcvar_num(g_Cvar[1])
else g_Discount[id] = 0

return ShowShopMenu(id)
}

public ShowShopMenu(id)
{
if(!Alive(id))
{
PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_NOALIVE")
return PLUGIN_HANDLED
}

new g_Menu[512], iLen, iKey
iKey |= (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1< <6)|(1<<9)

if(g_Discount[id] > 0) iLen = formatex(g_Menu, 511, "%L^n^n", LANG_PLAYER, "SHOP_TITLEDISC", GetMoney(id), g_Discount[id])
else iLen = formatex(g_Menu, 511, "%L^n^n", LANG_PLAYER, "SHOP_TITLENODISC", GetMoney(id))

if(GetMoney(id) >= GetItemCost(id, COST_ARMOR) && g_Once[id][1])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM1", GetItemCost(id, COST_ARMOR))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM1_1", GetItemCost(id, COST_ARMOR))
iKey &= ~(1<<0)
}

if(GetMoney(id) >= GetItemCost(id, COST_ALLGREN) && g_Once[id][2])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM2", GetItemCost(id, COST_ALLGREN))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM2_1", GetItemCost(id, COST_ALLGREN))
iKey &= ~(1<<1)
}

if(GetMoney(id) >= GetItemCost(id, COST_HEALTH) && g_Once[id][3])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM3", GetItemCost(id, COST_HEALTH))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM3_1", GetItemCost(id, COST_HEALTH))
iKey &= ~(1<<2)
}

if(GetMoney(id) >= GetItemCost(id, COST_SMOKEGREN) && g_Once[id][4])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM4", GetItemCost(id, COST_SMOKEGREN))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM4_1", GetItemCost(id, COST_SMOKEGREN))
iKey &= ~(1<<3)
}

if(GetMoney(id) >= GetItemCost(id, COST_HEGREN) && g_Once[id][5])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM5", GetItemCost(id, COST_HEGREN))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM5_1", GetItemCost(id, COST_HEGREN))
iKey &= ~(1<<4)
}

if(GetMoney(id) >= GetItemCost(id, COST_FLASHGREN) && g_Once[id][6])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM6", GetItemCost(id, COST_FLASHGREN))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM6_1", GetItemCost(id, COST_FLASHGREN))
iKey &= ~(1<<5)
}

if(GetMoney(id) >= GetItemCost(id, COST_INVIS) && g_Once[id][7])
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM7", GetItemCost(id, COST_INVIS))
else
{
iLen += formatex(g_Menu[iLen], 511 - iLen, "%L^n", LANG_PLAYER, "SHOP_ITEM7_1", GetItemCost(id, COST_INVIS))
iKey &= ~(1<<6)
}

iLen += formatex(g_Menu[iLen], 511 - iLen, "^n%L", LANG_PLAYER, "SHOP_ITEMEXIT")

return show_menu(id, iKey, g_Menu, -1, "ShopMenu")
}

public ActionShop(id, iKey)
{
if(!Connect(id))
return PLUGIN_HANDLED

switch(iKey)
{
case 0:
{
if(GetMoney(id) < GetItemCost(id, COST_ARMOR) || !g_Once[id][1] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTARMOR")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_ARMOR))
cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)
g_Once[id][1] = false
ShowShopMenu(id)
}

case 1:
{
if(GetMoney(id) < GetItemCost(id, COST_ALLGREN) || !g_Once[id][2] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTALLGREN")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_ALLGREN))
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_smokegrenade")
g_Once[id][2] = false
ShowShopMenu(id)
}

case 2:
{
if(GetMoney(id) < GetItemCost(id, COST_HEALTH) || !g_Once[id][3] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTHEALTH")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_HEALTH))
fm_set_user_health(id, 100)
g_Once[id][3] = false
ShowShopMenu(id)
}

case 3:
{
if(GetMoney(id) < GetItemCost(id, COST_SMOKEGREN) || !g_Once[id][4] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTSMOKEGREN")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_SMOKEGREN))
fm_give_item(id, "weapon_smokegrenade")
g_Once[id][4] = false
ShowShopMenu(id)
}

case 4:
{
if(GetMoney(id) < GetItemCost(id, COST_HEGREN) || !g_Once[id][5] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTHEGREN")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_HEGREN))
fm_give_item(id, "weapon_hegrenade")
g_Once[id][5] = false
ShowShopMenu(id)
}

case 5:
{
if(GetMoney(id) < GetItemCost(id, COST_FLASHGREN) || !g_Once[id][6] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTFLASHGREN")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_FLASHGREN))
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_flashbang")
g_Once[id][6] = false
ShowShopMenu(id)
}

case 6:
{
if(GetMoney(id) < GetItemCost(id, COST_INVIS) || !g_Once[id][7] || !Alive(id))
return PLUGIN_CONTINUE

PrintChatColor(id, _, "%L %L", LANG_PLAYER, "SHOP_CHATPREFIX", LANG_PLAYER, "SHOP_COSTINVIS")
SetMoney(id, GetMoney(id) - GetItemCost(id, COST_INVIS))
fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 50)
g_Once[id][7] = false
ShowShopMenu(id)
}
}
return PLUGIN_HANDLED
}

GetItemCost(id, iCost)
{
iCost -= floatround(iCost / 100.0 * g_Discount[id])
return iCost
}
Can add in this shop
Golden ak ? or jetpack ? samting like dat please!
Or add 1 new guns for small price awp guns
__________________
homepage:steam.lv
topsites:top.steam.lv
FLOY is offline
Send a message via Skype™ to FLOY
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-03-2021 , 09:27   Re: [req] Please add samting
Reply With Quote #2

Its mach izier to use a beter plagin - https://forums.alliedmods.net/showthread.php?t=284603
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
FLOY
Senior Member
Join Date: Dec 2013
Location: I love to www.steam.lv
Old 01-03-2021 , 15:34   Re: [req] Please add samting
Reply With Quote #3

close and no thanks i redy my self
__________________
homepage:steam.lv
topsites:top.steam.lv
FLOY is offline
Send a message via Skype™ to FLOY
Reply


Thread Tools
Display Modes

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 02:35.


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