/* HLBS - Shop System + save your money on bank * * Credit : Sam Tsuki (idea , some helpfull codes) . * * * Change log : * * 1) v1.0 First released . * 2) v1.3 Added more items . * 3) v1.7b Fix invisible bug . (Beta version) * 4) v2.0b (Beta version) * *-------------------------------------------------------------------------- * | * # # | * # # # # # # ###### | * # # # # # # # # | * # # # # ## ## # # | * # # # # # # # # # # | * # # # # # # # # # # | * ## # # # # # # # # | * # # # # # # # # ######## | * # # # # # # # # # | * # # # # # # # # | * # # # # # # # # | * # # # # # # # # | * # # # # # # # # | * # # ####### # # # # | * | *-------------------------------------------------------------------------- * * * *Money System + Shop items for Half-Life * *Info : * *Author : Kuma *Version : v2.0b * *Requirement : * *AMX Mod X 1.8.1 or high . * *Discription : * *With this plugin players can earn money by killing , this is lik in cs 1.6 *and money will saved by steamid by using nvault Module * *Cvars : * *pla_points = "20" // 20 is amount money can players get for 1 kill , you can change it *hlbs_save = "1/0" // Save *hlbs_saveby = "1/0" // Save by steamid . * * * */ #include #include #include #include #include #include #define VLTNAME "Banker_by_Kuma" #define MAX_SECONDS 40 enum _: iRGB { r, g, b }; enum { TASK_ONE, TASK_TWO }; new const gGmodColors[ MAX_SECONDS ][ iRGB ] = { { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 127, 212, 255}, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 127, 212, 255 }, { 255, 255, 255 } }; new const gNocColors[ MAX_SECONDS ][ iRGB ] = { { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 170, 85, 255 }, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 170, 85, 255}, { 170, 85, 255 }, { 3170, 85, 255 }, { 170, 85, 255 }, { 170, 85, 255}, { 255, 255, 255 } }; new const gInvisColors[ MAX_SECONDS ][ iRGB ] = { { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 192, 0, 1 }, { 3, 255, 2 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127}, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 85, 127 }, { 255, 255, 255 } }; new gCountTimer; new gHudSync; new hlbs_save, hlbs_saveby; new gVaultHandle; new hlbs_points[33], pla_points; // This will hold Players Point . new g_30hp = 600 new g_30ar = 700 new g_invi = 1700 new g_god = 1200 new g_noc = 1500 new g_addmn = 15000 new g_gift100 = 1500 public plugin_init( ) { register_plugin( "HLBS Bank + Shop Menu", "v2.0b", "Kuma77" ); register_dictionary("Dauh_Bank.txt") pla_points = register_cvar("pla_points", "20") hlbs_save = register_cvar("hlbs_save", "1") hlbs_saveby = register_cvar("hlbs_saveby", "0") register_clcmd("say /shop", "ShowMenu", _, "ddff") register_clcmd("say /cash", "points") register_clcmd("say ad", "Vip") register_clcmd("say_team /cash", "points") register_event("DeathMsg", "dd_death", "a") gHudSync = CreateHudSyncObj(); } public plugin_precache() { precache_sound("boid/boid_idle3.wav") } public client_putinserver(id) { if(!is_user_bot(id)) set_task(2.0,"client_authorized2",id); } public client_authorized2(id) { set_hudmessage(85, 170, 255, -1.0, 0.87, 2, 6.0, 12.0) show_hudmessage(id, "This server using HL Banker + Shoping by Kuma") set_task(10.0, "ads",id) set_task(0.1, "cpt",id, _, _, "b") } public ads(id) { client_print(id, print_chat, "[HL BS] Available commands /cash /shop") set_task(40.0, "ads",id) } public cpt(id) { set_hudmessage(69, 239, 27, 0.82, 0.79, 0, 6.0, 0.1, 0.1, 0.2, next_hudchannel(id) ) show_hudmessage(id,"%L",id,"MSG_BANK",hlbs_points[id]) //return PLUGIN_CONTINUE } public client_disconnect(id) { SaveScore(id); } public SaveScore(id) { if (!get_pcvar_num(hlbs_save) || is_user_bot(id)) return PLUGIN_HANDLED new authid[32] if (get_pcvar_num(hlbs_saveby) == 0) get_user_authid(id, authid, 31) else if (get_pcvar_num(hlbs_saveby) == 1) get_user_ip(id, authid, 31, 1) else get_user_name(id, authid, 31) new vaultkey[64], vaultdata[64] gVaultHandle = nvault_open(VLTNAME) format(vaultkey, 63, "HLBS-%s-points", authid) format(vaultdata, 63, "%d", hlbs_points[id]) nvault_set(gVaultHandle, vaultkey, vaultdata) if(is_user_connected(id)) { } nvault_close(gVaultHandle) return PLUGIN_HANDLED } //-------------------------------------------------------------------------------------------------- public LoadScore(id) { if (!get_pcvar_num(hlbs_save) || is_user_bot(id)) return PLUGIN_HANDLED new authid[32] if (get_pcvar_num(hlbs_saveby) == 0) get_user_authid(id, authid, 31) else if (get_pcvar_num(hlbs_saveby) == 1) get_user_ip(id, authid, 31, 1) else get_user_name(id, authid, 31) new vaultkey[64], vaultdata[64] gVaultHandle = nvault_open(VLTNAME) format(vaultkey, 63, "HLBS-%s-points", authid) nvault_get(gVaultHandle, vaultkey, vaultdata, 63) hlbs_points[id] = str_to_num(vaultdata) nvault_close(gVaultHandle) return PLUGIN_HANDLED } //-------------------------------------------------------------------------------------------------- public client_connect(id) { LoadScore(id); } //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- public points(id) { set_hudmessage(162, 205, 35, 0.0, 0.32, 1, 6.0, 4.0) show_hudmessage(id, "You Have [ $%d ] in your bank account",hlbs_points[id]) set_task(2.0,"client_authorized2",id); client_authorized2(id) return PLUGIN_CONTINUE } //-------------------------------------------------------------------------------------------------- public dd_death() { new killer = read_data(1) new id = read_data(2) new maxplayers = get_maxplayers() if(!killer || killer > maxplayers || killer == id) return PLUGIN_HANDLED new points = get_pcvar_num(pla_points) hlbs_points[killer] += points new name[32], killername[32] get_user_name(killer, killername, 31) get_user_name(id, name, 31) //client_print(killer, print_chat, "%d $ points for killing %s ", points, name) set_hudmessage(71, 241, 29, 0.53, 0.26, 0, 6.0, 3.0) show_hudmessage(killer, "+ %d $", points) if(hlbs_points[killer] == g_30hp ){ client_print(0, print_chat, "** %s has UNLOCK ^"full health^" with $%d **", killername, g_30hp ) } if(hlbs_points[killer] == g_30ar ){ client_print(0, print_chat, "** %s has UNLOCK ^"full armor^" with $%d **", killername, g_30ar ) } if(hlbs_points[killer] == g_invi ){ client_print(0, print_chat, "** %s has UNLOCK ^"Invisible mod^" with $%d -- Perfect ! **", killername, g_invi ) } if(hlbs_points[killer] == g_god ){ client_print(0, print_chat, "** %s has UNLOCK ^"Godmode^" with $%d -- Good Job ! **", killername, g_god ) } if(hlbs_points[killer] == g_noc ){ client_print(0, print_chat, "** %s has UNLOCK ^"Noclip^" with $%d -- Good Job ! **", killername, g_noc ) } return PLUGIN_CONTINUE } public ShowMenu(id) { new menu = menu_create("Shop", "mh_MyMenu"); menu_additem(menu, "Buy Full Health 600 $", "", 0); // case 0 menu_additem(menu, "Buy Full Armor 700 $", "", 0); // case 1 menu_additem(menu, "Buy Invisible -(40sec) 1700 $", "", 0); // case 2 menu_additem(menu, "Buy GodMode -(40sec) (1200 $)", "", 0); // case 3 menu_additem(menu, "Buy Noclip -(40sec) (1500 $)", "", 0); // case 4 menu_additem(menu, "Buy VIP [Mini Admin] (15000 $)", "", 0); // case 5 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_setprop(menu, MPROP_PERPAGE, 7); menu_display(id, menu, 0); return PLUGIN_HANDLED; } public mh_MyMenu(id, menu, item) { if(item == MENU_EXIT) { menu_cancel(id); return PLUGIN_HANDLED; } new command[6], name[64], access, callback; menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback); switch(item) { case 0: { // Player have Full HP if(hlbs_points[id] >= g_30hp) { client_print(id, print_chat, "[Shop] You add +30 health you lose %d !", g_30hp); hl_set_user_health(id, hl_get_user_health(id) +30); hlbs_points[id] -= g_30hp SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } case 1: { // Player have Full AR if(hlbs_points[id] >= g_30ar) { client_print(id, print_chat, "[Shop] You add +30 armor !"); hl_set_user_armor(id, hl_get_user_armor(id) +30); hlbs_points[id] -= g_30ar SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } case 2: { // Player have Invisibllity if(hlbs_points[id] >= g_invi) { client_print(id, print_chat, "[Shop] You buy Invisible"); hlbs_points[id] -= g_invi set_task(0.0, "Invis", id, _, _, "b") SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } case 3: { // Player have Godmode if(hlbs_points[id] >= g_god) { client_print(id, print_chat, "[Shop] You buy Godmode For (30 Seconds)"); hlbs_points[id] -= g_god set_task(0.0, "Gmod", id, _, _, "b") SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged //set_hudmessage(255, 170, 212, 0.0, 0.54, 0, 6.0, 6.0) //show_hudmessage(0, "%s use Godmode for (30 seconds)",name) } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } case 4: { // Player have Noclip if(hlbs_points[id] >= g_noc) { hlbs_points[id] -= g_noc client_print(id, print_chat, "[Shop] You buy Noclip For (30 Seconds)"); set_task(0.0, "Noc", id, _, _, "b") SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } case 5: { // Player have Buy VIP if(hlbs_points[id] >= g_addmn) { new steamid[64] get_user_authid(id, steamid, 63) hlbs_points[id] -= g_addmn set_task(0.0, "Vip", id, _, _, "b") Vip(id, steamid) SaveScore(id) set_task(0.1, "cpt",id, _, _, "b") // becouse have bugged } else { client_print(id, print_chat, "[Shop] You dont have much money !"); } } } menu_destroy(menu); return PLUGIN_HANDLED; } public Vip(id, steamid[]) { new authid[32] get_user_authid(id, authid, 31) new configsDir[64] get_configsdir(configsDir, 63) format(configsDir, 63, "%s/users.ini", configsDir) new name[32] get_user_name(id, name ,31) // Make sure steamid isn't already in file. new line = 0, textline[256], len const SIZE = 63 new line_steamid[SIZE + 1], line_password[SIZE + 1], line_accessflags[SIZE + 1], line_flags[SIZE + 1], parsedParams // while ((line = read_file(configsDir, line, textline, 255, len))) { if (len == 0 || equal(textline, ";", 1)) continue // comment line parsedParams = parse(textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE) if (parsedParams != 4) continue // Send warning/error? if (equal(line_steamid, steamid)) { client_print(id, print_chat, "[Shop] you are already VIP") hlbs_points[id] += g_addmn return } } client_print(id, print_chat, "[Shop] Happy Admin you are VIP now !, wait untill map change"); set_hudmessage(255, 212, 255, 0.0, 0.59, 0, 6.0, 12.0) show_hudmessage(0, "%s Got VIP (Mini Admin) + $%d Gift", name, g_gift100) hlbs_points[id] += g_gift100 new linetoadd[512] format(linetoadd, 511, "^"%s^" ^"^" ^"cfju^" ^"ce^"", steamid) console_print(id, "Adding:^n%s", linetoadd) write_file(configsDir, linetoadd) } //---------------------------------- Godmod ---------------// public Gmod(id) { set_user_godmode(id, 1) remove_task( TASK_ONE ); remove_task( TASK_TWO ); set_task(2.0,"client_authorized2",id); client_authorized2(id) set_task( float( MAX_SECONDS ), "RemoveGmodHUD", id, _, _, "b" ); set_task(1.0, "ShowGmod", id, _, _, "a", MAX_SECONDS ); } public ShowGmod(id) { gCountTimer++; new iTimer = MAX_SECONDS - gCountTimer; set_hudmessage(gGmodColors[ iTimer ][ r ], gGmodColors[ iTimer ][ g ], gGmodColors[ iTimer ][ b ], -1.0, 0.29, 1, 6.0, 3.0) ShowSyncHudMsg(id, gHudSync, "%d seconds to disable Godmode !", iTimer ); if( iTimer <= 10 ) { new szNumToWord[ 60 ];// if i want numbers format num_to_word( iTimer, szNumToWord, charsmax( szNumToWord ) ); client_cmd( 0, "speak ^"boid/boid_idle3.wav^""); // Kumaluchi } // if(iTimer <= 1) // you lose your run // { // set_hudmessage(230, 102, 17, -1.0, 0.29, 1, 6.0, 3.0) // show_hudmessage(id, "You lose your Godmode") // // } } public RemoveGmodHUD(id) { set_task(2.0,"client_authorized2",id); client_authorized2(id) set_user_godmode(id, 0) remove_task( TASK_ONE ); remove_task( TASK_TWO ); gCountTimer = 0; } //---------------------------------- Noclip ---------------// public Noc(id) { set_user_noclip(id, 1) remove_task( TASK_ONE ); remove_task( TASK_TWO ); set_task(2.0,"client_authorized2",id); client_authorized2(id) set_task( float( MAX_SECONDS ), "RemoveNocHUD", id, _, _, "b" ); set_task(1.0, "ShowNoc", id, _, _, "a", MAX_SECONDS ); } public ShowNoc(id) { gCountTimer++; new iTimer = MAX_SECONDS - gCountTimer; set_hudmessage(gNocColors[ iTimer ][ r ], gNocColors[ iTimer ][ g ], gNocColors[ iTimer ][ b ], -1.0, 0.29, 1, 6.0, 3.0) ShowSyncHudMsg(id, gHudSync, "%d seconds to disable Noclip !", iTimer ); if( iTimer <= 10 ) { new szNumToWord[ 60 ];// if i want numbers format num_to_word( iTimer, szNumToWord, charsmax( szNumToWord ) ); client_cmd( 0, "speak ^"boid/boid_idle3.wav^""); // Kumaluchi } // if(iTimer <= 1) // you lose your run // { // set_hudmessage(230, 102, 17, -1.0, 0.29, 1, 6.0, 3.0) // show_hudmessage(id, "You lose your Godmode") // // } } public RemoveNocHUD(id) { set_task(2.0,"client_authorized2",id); client_authorized2(id) set_user_noclip(id, 0) remove_task( TASK_ONE ); remove_task( TASK_TWO ); gCountTimer = 0; } // ---------------------------- Invisible --------------------// public Invis(id) { new name[33] get_user_name(id,name,32) InvisOn(id) remove_task( TASK_ONE ); remove_task( TASK_TWO ); set_task(2.0,"client_authorized2",id); client_authorized2(id) set_task( float( MAX_SECONDS ), "RemoveInvisHUD", id, _, _, "b" ); set_task(1.0, "ShowInvis", id, _, _, "a", MAX_SECONDS ); } public ShowInvis(id) { gCountTimer++; new iTimer = MAX_SECONDS - gCountTimer; set_hudmessage(gInvisColors[ iTimer ][ r ], gInvisColors[ iTimer ][ g ], gInvisColors[ iTimer ][ b ], -1.0, 0.29, 1, 6.0, 3.0) ShowSyncHudMsg(id, gHudSync, "%d seconds to disable Invisible !", iTimer ); if( iTimer <= 10 ) { new szNumToWord[ 60 ];// if i want numbers format num_to_word( iTimer, szNumToWord, charsmax( szNumToWord ) ); client_cmd( 0, "speak ^"boid/boid_idle3.wav^""); // Kumaluchi } // if(iTimer <= 1) // you lose your run // { // set_hudmessage(230, 102, 17, -1.0, 0.29, 1, 6.0, 3.0) // show_hudmessage(id, "You lose your Godmode") // // } } public RemoveInvisHUD(id) { new szalpha[8] read_argv(2,szalpha,7) client_print(id,print_chat,"[Amxx] is no longer invisible ") InvisOff(id) set_task(2.0,"client_authorized2",id); client_authorized2(id) remove_task( TASK_ONE ); remove_task( TASK_TWO ); gCountTimer = 0; } public InvisOn(id) { fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, 0); } public InvisOff(id) { fm_set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 255); }