Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < cstrike >
- #include < fakemeta_util >
- #include < fvault >
- new const g_vault_name[] = "HNR_Vault";
- new HNR_points[ 33 ]
- new HNR_maxplayers;
- new HNR_cvar;
- forward ForwardClientWin( client );
- enum _:Options
- {
- HNR_M4A1,
- HNR_INVISIBILITY,
- HNR_AK47,
- HNR_SPEED,
- HNR_NOCLIP
- };
- new OptionsName[ Options ][ ] =
- {
- "M4a1",
- "Invisibilty",
- "Ak47",
- "Speed",
- "Noclip"
- };
- new OptionsPrices[ Options ] =
- {
- 40,
- 70,
- 40,
- 70,
- 100
- };
- public plugin_init()
- {
- register_plugin("Hit And Run Shop", "1.0", "iStrike")
- register_clcmd("say /shop", "ShopMenu")
- register_clcmd("say /hnrshop", "ShopMenu")
- HNR_cvar = register_cvar("hnr_shop", "1")
- HNR_maxplayers = get_maxplayers();
- register_event( "HLTV", "Event_New_Round", "a", "1=0", "2=0" )
- }
- public Event_New_Round()
- {
- for ( new i; i <= HNR_maxplayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) )
- continue;
- fm_set_user_maxspeed(i, 250.0)
- fm_set_user_noclip(i, 0)
- fm_set_user_rendering(i)
- }
- }
- public client_putinserver(plr)
- {
- LoadPoints(plr)
- }
- public client_disconnect(plr)
- {
- SavePoints(plr)
- }
- public ShopMenu(id)
- {
- if ( get_pcvar_num( HNR_cvar ) )
- {
- if ( is_user_alive( id ) )
- {
- new Shopmenu = menu_create("\r[\d Hit And Run \r] \ySelect Your Shop Items", "ShopHandler")
- static Option[ 64 ], szNum[ 10 ];
- for ( new i; i < Options; i ++ )
- {
- num_to_str( i + 1, szNum, charsmax( szNum ) )
- formatex( Option, charsmax( Option ), "%s \dFor A Game \r[\d %d \r]", OptionsName[ i ], OptionsPrices[ i ] )
- menu_additem(Shopmenu, Option, szNum )
- }
- menu_setprop(Shopmenu, MPROP_EXIT, MEXIT_ALL )
- menu_display(id, Shopmenu)
- }
- else
- {
- ColorChat(id, "You Must Be Aive To Open The Hit And Run Shop")
- }
- }
- }
- public ShopHandler(id, Shopmenu, item)
- {
- if ( item == MENU_EXIT || !get_pcvar_num( HNR_cvar ) )
- {
- menu_destroy( Shopmenu )
- return PLUGIN_HANDLED;
- }
- new data[6], iName[64]
- new access, callback
- menu_item_getinfo(Shopmenu, item, access, data, 6, iName, 63, callback)
- new key = str_to_num( data );
- if ( HNR_points[ id ] < OptionsPrices[ key - 1 ] )
- {
- ColorChat( id, "You Dont Have Enough Points !" )
- menu_destroy( Shopmenu )
- return PLUGIN_HANDLED;
- }
- switch( key - 1 )
- {
- case HNR_M4A1: fm_give_item(id, "weapon_m4a1") && cs_set_user_bpammo(id, CSW_M4A1, 9999)
- case HNR_INVISIBILITY: fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
- case HNR_AK47: fm_give_item(id, "weapon_ak47") && cs_set_user_bpammo(id, CSW_AK47, 9999)
- case HNR_SPEED: fm_set_user_maxspeed(id, 900.0)
- case HNR_NOCLIP: fm_set_user_noclip(id, 1)
- }
- HNR_points[ id ] -= OptionsPrices[ key - 1 ];
- ColorChat(id, "You Bought %s For A Game", OptionsName[ key - 1 ] )
- menu_destroy(Shopmenu)
- return PLUGIN_HANDLED;
- }
- public ForwardClientWin( client )
- {
- if ( is_user_connected( client ) )
- {
- HNR_points[ client ] += 4;
- }
- }
- LoadPoints(plr)
- {
- new authid[35], data[16];
- get_user_authid(plr, authid, sizeof(authid) - 1);
- if( fvault_get_data(g_vault_name, authid, data, sizeof(data) - 1) )
- HNR_points[plr] = str_to_num(data);
- else
- HNR_points[plr] = 0;
- }
- SavePoints(plr)
- {
- new authid[35];
- get_user_authid(plr, authid, sizeof(authid) - 1);
- new data[16];
- num_to_str(HNR_points[plr], data, sizeof(data) - 1);
- fvault_set_data(g_vault_name, authid, data);
- }
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
- new msg[191], players[32], count = 1;
- static len; len = formatex(msg, charsmax(msg), "^3[^1 Hit And Run Shop ^3]^1 ");
- vformat(msg[len], charsmax(msg) - len, string, 3);
- if(id) players[0] = id;
- else get_players(players,count,"ch");
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
Add Comment
Please, Sign In to add comment