#include #include #include #include new bool:StealthShoes[33] new bool:BuyTimeAllow new bool:BuyZoneAllow[33] new Float:BuyTimeFloat new BuyTimeNum new bool:BuyTimeCvar new bool:BuyZoneCvar //TAKE AWAY CODE BELOW TO REMOVE CONNECT MESSAGE public client_connect(id) { StealthShoes[id]=false } //TAKE AWAY CODE ABOVE TO REMOVE CONNECT MESSAGE public client_disconnect(id) { StealthShoes[id]=false } public ass_sshoes(id,level,cid) { if (!cmd_access(id,level,cid,2)) { return PLUGIN_HANDLED } new victim[32] read_argv(1,victim,31) new admin[32] get_user_name(id,admin,31) if (victim[0]=='@') { new team[32], inum get_players(team,inum,"e",victim[1]) if (inum==0) { console_print(id,"[AMX] No clients found on such team.") return PLUGIN_HANDLED } for (new i=0;i 10000) { set_cvar_num("shoes_cost",10000) } return PLUGIN_CONTINUE } public RoundTime() { if ( read_data(1)==get_cvar_num("mp_freezetime") || read_data(1)==6 ) // freezetime starts { remove_task(701) // remove buytime task BuyTimeAllow = true BuyTimeFloat = get_cvar_float("mp_buytime") * 60 BuyTimeNum = floatround(BuyTimeFloat,floatround_floor) BuyTimeCvar = (get_cvar_num("shoes_buytime")) ? true : false BuyZoneCvar = (get_cvar_num("shoes_buyzone")) ? true : false } else // freezetime is over { set_task(BuyTimeFloat,"BuyTimeTask",701) } return PLUGIN_CONTINUE } public BuyTimeTask() { BuyTimeAllow = false // buytime is over } public BuyIcon(id) // player is in buyzone? { if (read_data(1)) BuyZoneAllow[id] = true else BuyZoneAllow[id] = false return PLUGIN_CONTINUE } public Check(id) // check if player can buy { if ( !is_user_alive(id)){ client_print(id,print_center,"You cannot buy while dead.") return false } if ((!BuyZoneAllow[id]&&BuyZoneCvar) ) { client_print(id,print_center,"You cannot buy outside of the buyzone.") return false } if (BuyTimeCvar) { if (!CheckTime(id)) return false } return true } public CheckTime(id) // check buytime { if (!BuyTimeAllow) { client_print(id,print_center,"%d seconds have passed...^n^nYou can't buy anything now!",BuyTimeNum) return false } return true } public buy_shoes(id) { new name[32] get_user_name(id,name,31) new userCash = cs_get_user_money(id) new shade_cost = get_cvar_num("shoes_cost") if (StealthShoes[id]) { client_print(id,print_chat,"[SHOES] You currently have a pair of Stealth Shoes.") return PLUGIN_HANDLED } if (!Check(id)) { return PLUGIN_HANDLED } if (!is_user_alive(id)) { return PLUGIN_HANDLED } if (userCash < shade_cost) { client_print(id,print_center,"You have insufficient funds!") client_print(id,print_chat,"[SHOES] You do not have enough money to buy Stealth Shoes. You need $%i.",shade_cost) return PLUGIN_HANDLED } else if (userCash >= shade_cost) { StealthShoes[id]=true set_user_footsteps(id,1) cs_set_user_money(id,userCash - shade_cost,1) client_print(id,print_chat,"[SHOES] You have successfully bought a pair of Stealth Shoes.") return PLUGIN_HANDLED } return PLUGIN_HANDLED } public sell_shoes(id) { new name[32] get_user_name(id,name,31) new userCash = cs_get_user_money(id) new shade_sell = get_cvar_num("shoes_cost")*2/3 if (!StealthShoes[id]) { client_print(id,print_chat,"[SHOES] You currently do not have a pair of Stealth Shoes.") } if (StealthShoes[id]) { StealthShoes[id]=false set_user_footsteps(id,0) cs_set_user_money(id,userCash + shade_sell,1) client_print(id,print_chat,"[SHOES] You have sold your Stealth Shoes for 75 percent of the sell price.") } return PLUGIN_HANDLED } public HandleSay(id) { new Speech[192] read_args(Speech,192) remove_quotes(Speech) if( (containi(Speech, "water") != -1) || (containi(Speech, "diving") != -1) || (containi(Speech, "damage") != -1) || (containi(Speech, "breathe") != -1) ){ client_print(id,print_chat, "[SHOES] You can buy Stealth Shoes on this server. Type /shoes for details.") } return PLUGIN_CONTINUE } public shoes_help(id) { new buffer[1024] new len = copy( buffer , 1023 , "Buy Stealth Shoes:^n\ Bind a key to buyshoes -- OR -- Type buyshoes in console^n^n\ Sell Stealth Shoes:^n\ Bind a key to sellshoes -- OR -- type sellshoes in console^n^n\ In order to bind a key you must open your console and use the bind command: ^n\ Bind ^"key^" ^"command^" ^n^n" ) len += copy( buffer[len] , 1023-len , "In this case the commands are ^"buyshoes^" & ^"sellshoes^".^nHere are some examples:^n\ bind / buyshoes bind / sellshoes^n^n\ When you have the Stealth Shoes:^n\ - You will have silent footsteps when using this. ") show_motd(id,buffer ,"Stealth Shoes Help:") return PLUGIN_HANDLED } public CheckIt() { new all[32], inum get_players(all,inum) for (new i=0;i gives player a pair of stealth shoes") register_concmd("amx_unshoes","ass_unsshoes",ADMIN_LEVEL_A,"< Nick, UniqueID< #userid, @TEAM, or * > removes player's stealth shoes") register_cvar("shoes_cost","2000") register_cvar("shoes_buyzone","1") register_cvar("shoes_buytime","1") register_event("StatusIcon","BuyIcon","be","2=buyzone") register_event("RoundTime","RoundTime","bc") register_event("DeathMsg", "player_death", "a") register_clcmd("say","HandleSay",0) register_clcmd("say /shoes", "shoes_help",0,": Opens Stealth Shoes help menu") set_task(0.5,"cost_force",0,"",0,"b") set_task(1.0,"CheckIt",0,"",0,"b") return PLUGIN_CONTINUE }