PHP- Kodu:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN "HP Shop"
#define VERSION "1.0"
#define AUTHOR "Gudik"
new money
new health
new cost100 = 16000
new cost50 = 10000
new cost40 = 8000
new cost30 = 7000
new cost20 = 6000
new cost10 = 5000
public plugin_init() {
register_plugin("HP Shop", "1.1", "Gudik");
register_clcmd ("say /HPShop", "HP_menu");
register_cvar ("amx_HPShop", "1");
register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
}
public HP_menu (id)
{
if(get_user_team(id) == 1)
{
new menu = menu_create ("HP Shop", "menu_hp");
menu_additem (menu, "100 Health - 16000$", "1", 0);
menu_additem (menu, "50 Health - 10000$", "2", 0);
menu_additem (menu, "40 Health - 8000$" , "3", 0);
menu_additem (menu, "30 Health - 7000$" , "4", 0);
menu_additem (menu, "20 Health - 6000$" , "5", 0);
menu_additem (menu, "10 Health - 5000$" , "6", 0);
menu_setprop (menu, MPROP_EXIT, MEXIT_ALL);
menu_display (id, menu, 0)
}
}
public menu_hp (id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy (menu)
return PLUGIN_HANDLED
}
new data [6], iname [64]
new access, callback
menu_item_getinfo (menu, item, access, data, 5, iname, 63, callback)
new key = str_to_num (data)
switch (key)
{
case 1: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost100) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +100);
client_print(id, print_chat, "[HP Shop] - 100 HP Yuklendi!");
cs_set_user_money(id, money - cost100);
}
}
}
case 2: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost50) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +50);
client_print(id, print_chat, "[HP Shop] - 50 HP Yuklendi!");
cs_set_user_money(id, money - cost50);
}
}
}
case 3: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost40) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +40);
client_print(id, print_chat, "[HP Shop] - 40 HP Yuklendi!");
cs_set_user_money(id, money - cost40);
}
}
}
case 4: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost30) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +30);
client_print(id, print_chat, "[HP Shop] - 30 HP Yuklendi!");
cs_set_user_money(id, money - cost30);
}
}
}
case 5: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost20) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +20);
client_print(id, print_chat, "[HP Shop] - 20 HP Yuklendi!");
cs_set_user_money(id, money - cost20);
}
}
}
case 6: {
money = cs_get_user_money(id);
health = get_user_health(id);
if (money <= cost10) {
client_print(id, print_chat, "[HP Shop] - Yeterli Para Yok!");
}
else {
if (is_user_alive(id)) {
set_user_health(id, health +10);
client_print(id, print_chat, "[HP Shop] - 10 HP Yuklendi!");
cs_set_user_money(id, money - cost10);
}
}
}
}
return PLUGIN_HANDLED
}