| IneedHelp |
08-16-2008 20:43 |
Re: Moar scr1pt1ng err0rz
What? This compile fine for me, What are the errors that you receive?
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike>
#define PLUGIN "Risky Business" #define VERSION "1.0" #define AUTHOR "PvtSmithFSSF"
new messagecvar[2] new pricecvar new custom[2] new payfornothing
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /gamble", "gamble") register_clcmd("say gamble", "gamble") register_clcmd("say_team /gamble", "gamble") register_clcmd("say_team gamble", "gamble") messagecvar[0] = register_cvar("gamble_msg", "1") messagecvar[1] = register_cvar("gamble_msg_time", "120") pricecvar = register_cvar("gamble_price", "3500") custom[0] = register_cvar("gamble_custom_gain", "15") custom[1] = register_cvar("gamble_custom_lose", "15") payfornothing = register_cvar("gamble_payfornothing", "1") }
public client_putinserver(id) { if (get_pcvar_num(messagecvar[0]) == 1) set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg", id) }
public Advertise_Msg(id) { if (get_pcvar_num(messagecvar[0]) == 1) { client_print(id, print_chat, "[Gambler] Type 'gamble' to gamble your health. This is risky business!") } set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg", id) return PLUGIN_CONTINUE }
public client_disconnect(id) { remove_task(id) }
public gamble(id) { new num = random_num(1,100) new money = cs_get_user_money(id) new health = get_user_health(id) new price = get_pcvar_num(pricecvar) new customgain = get_pcvar_num(custom[0]) new customlose = get_pcvar_num(custom[1]) if (money < price) { client_print(id, print_chat, "[Gambler] You don't have enough cash!") } else { if(num <= 10) { client_print(id, print_chat, "[Gambler] Sorry, you lost 100 health!") set_user_health(id, health-100) cs_set_user_money(id,money-price) } else if(num <= 20) { client_print(id, print_chat, "[Gambler] Sorry, you lost 80 health!") set_user_health(id, health-80) cs_set_user_money(id, money-price) } else if(num <= 30) { client_print(id, print_chat, "[Gambler] Sorry, you lost 50 health!") set_user_health(id, health-50) cs_set_user_money(id, money-price) } else if(num <= 40) { client_print(id, print_chat, "[Gambler] Sorry, you lost %i health!",customlose) set_user_health(id,health-customlose) cs_set_user_money(id,money-price) } else if(num <= 50) { client_print(id, print_chat, "[Gambler] Nothing happened, sorry!") if (get_pcvar_num(payfornothing) == 1) { cs_set_user_money(id, money-price) } else { client_print(id, print_chat, "[Gambler] It's okay, you won't be charged!") } } else if(num <= 60) { client_print(id, print_chat, "[Gambler] Congratulations! You've won 30 health! ") set_user_health(id,health+30) cs_set_user_money(id, money-price) } else if(num <= 70) { client_print(id, print_chat, "[Gambler] Congratulations! You've won 50 health! ") set_user_health(id,health+50) cs_set_user_money(id, money-price) } else if(num <= 80) { client_print(id, print_chat, "[Gambler] Congratulations! You've won 80 health! ") set_user_health(id,health+80) cs_set_user_money(id, money-price) } else if(num <= 90) { client_print(id, print_chat, "[Gambler] Congratulations! You've won 100 health! ") set_user_health(id,health+100) cs_set_user_money(id, money-price) } else if(num <= 100) { client_print(id, print_chat, "[Gambler] Congratulation! You've won %i health!",customgain) set_user_health(id,health+customgain) cs_set_user_money(id, money-price) } } }
|