Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* AMX Mod X
- * No Recoil
- *
- * This file is provided as is (no warranties)
- *
- * Original by: Petey B
- * Original Credits: Xavior, Mattcook, Fox-NL, KRoT@L, Others
- *
- * Ported by: Blitz (July 20, 2005)
- * Version: 1.3
- *
- * Changelog:
- * 1.3 Re-wrote most of the plugin
- * Added language dictionary for future multilanguage support
- * Added showing administrator activity from a CVAR
- * Added HUD notifications
- * Added short sound when you buy no recoil and return to normal
- * Changed way of detecting disabled no recoil
- * Changed way of executing recoil commands on clients
- * Changed way of telling clients how to use no recoil
- * Removed useless code
- * Removed limit CVAR per team because of unbalance
- * Cleaned and organized code
- * 1.2 Added when you buy no recoil, a message is given notifying the purchase
- * Added message saying if no recoil is disabled on the server
- * 1.1 Changed around some CVAR names
- * Added CVAR to limit amount of people using no recoil per team
- * Fixed bug where you are able to buy no recoil when you already have it
- * Fixed bug where you can buy no recoil when you're dead
- * 1.0 Ported to AMXX
- *
- * Note:
- * This plugin allows you to be able to get no recoil on weapons.
- * You can either buy no recoil or get it from an administrator.
- * You may return recoil to normal at anytime, but every round it is returned to normal.
- * This plugin is meant for EVERYONE. Have fun with it.
- *
- * You need the language file along with this .sma in order to work properly.
- *
- * Admin Commands:
- * amx_recoil <nick, part nick, @TEAM or *ALL> - gives client normal recoil
- * amx_norecoil <nick, part nick, @TEAM or *ALL> - gives client no recoil
- *
- * Client Commands:
- * say /recoil - return to normal recoil
- * say /norecoil - buy no recoil
- *
- * CVARs:
- * sv_norecoil <1/0> - enables/disables buying no recoil
- * sv_norecoil_tell <1/0> - tells everyone about no recoil on connect
- * sv_norecoil_cost <$> - sets the price of no recoil
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <engine>
- #include <cstrike>
- #define ADMIN_FLAG ADMIN_LEVEL_H // replace this with any admin flag
- new reco[33]
- public plugin_init()
- {
- register_plugin("No Recoil","1.3","Blitz/Petey B")
- register_dictionary("amx_norecoil.txt")
- register_concmd("amx_norecoil","admin_norecoil",ADMIN_FLAG,"<nick, part of nick, @TEAM or *ALL>")
- register_concmd("amx_recoil","admin_recoil",ADMIN_FLAG,"<nick, part of nick, @TEAM or *ALL>")
- register_clcmd("say /norecoil","noreco",0,": Purchases no recoil")
- register_clcmd("say /recoil","recoi",0,": Returns recoil to normal")
- register_cvar("sv_norecoil","1")
- register_cvar("sv_norecoil_tell","1")
- register_cvar("sv_norecoil_cost","5000")
- register_event("ResetHUD","newRound","b")
- register_event("CurWeapon","change_weapon","be","1=1")
- }
- public plugin_modules()
- {
- require_module("engine")
- require_module("cstrike")
- }
- public client_putinserver(id)
- {
- if (is_user_bot(id))
- return
- set_task(15.0, "recoMsg", id)
- }
- public recoMsg(id)
- {
- if (get_cvar_num("sv_norecoil")==1)
- {
- if (get_cvar_num("sv_norecoil_tell")==1)
- {
- client_print(0, print_chat, "%L", LANG_PLAYER, "NR_CHECK_TELL")
- }
- }
- }
- public admin_norecoil(id)
- {
- if (!(get_user_flags(id)&ADMIN_FLAG))
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_ACCESS_DENIED")
- return PLUGIN_HANDLED
- }
- if (read_argc() <2)
- {
- client_print(id, print_console, "%L", LANG_PLAYER, "AMX_NR_USAGE")
- return PLUGIN_HANDLED
- }
- new arg[32], name2[32]
- read_argv(1,arg,31)
- get_user_name(id,name2,31)
- set_hudmessage(255, 25, 25, -1.0, 0.25, 0, 1.0, 9.0, 0.2, 0.4, 2)
- if (arg[0]=='@')
- {
- new players[32], inum, i
- get_players(players,inum,"ae",arg[1])
- if (inum==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_TEAM_FAILED")
- return PLUGIN_CONTINUE
- }
- else if (reco[players[i]]==1)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_NR_TEAM_EXISTS", arg[1])
- return PLUGIN_HANDLED
- }
- for (i=0; i<inum; ++i)
- {
- reco[players[i]] = 1
- }
- switch (get_cvar_num("amx_show_activity"))
- {
- case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_NR_TEAM_SET2", name2, arg[1])
- case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_NR_TEAM_SET1", arg[1])
- }
- console_print(id, "%L", LANG_PLAYER, "AMX_NR_TEAM_SET", arg[1])
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_NR_TEAM_SET", arg[1])
- return PLUGIN_CONTINUE
- }
- else if (arg[0]=='*')
- {
- new players[32], inum, i, changed
- get_players(players, inum)
- for (i=0; i<inum; ++i)
- {
- if(!is_user_connected(players[i]))
- continue
- if (reco[players[i]]!=1)
- {
- reco[players[i]] = 1; changed = 1;
- console_print(i, "%L", LANG_PLAYER, "AMX_NR_ALL_SET")
- }
- }
- if (changed==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_NR_ALL_EXISTS")
- }
- else
- {
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_NR_ALL_SET")
- }
- }
- else
- {
- new player = cmd_target(id,arg,0)
- new name[32]
- get_user_name(player,name,31)
- if (!player)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_CLIENT_FAILED")
- return PLUGIN_CONTINUE
- }
- else if (reco[player]==1)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_NR_CLIENT_EXISTS", name)
- return PLUGIN_HANDLED
- }
- reco[player] = 1
- switch (get_cvar_num("amx_show_activity"))
- {
- case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_NR_CLIENT_SET2", name2, name)
- case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_NR_CLIENT_SET1", name)
- }
- console_print(id, "%L", LANG_PLAYER, "AMX_NR_CLIENT_SET", name)
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_NR_CLIENT_SET", name)
- }
- return PLUGIN_HANDLED
- }
- public admin_recoil(id)
- {
- if (!(get_user_flags(id)&ADMIN_FLAG))
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_ACCESS_DENIED")
- return PLUGIN_HANDLED
- }
- if (read_argc() <2)
- {
- client_print(id, print_console, "%L", LANG_PLAYER, "AMX_R_USAGE")
- return PLUGIN_HANDLED
- }
- new arg[32], name2[32]
- read_argv(1,arg,31)
- get_user_name(id,name2,31)
- set_hudmessage(25, 125, 200, -1.0, 0.25, 0, 1.0, 9.0, 0.2, 0.4, 2)
- if (arg[0]=='@')
- {
- new players[32], inum, i
- get_players(players,inum,"ae",arg[1])
- if (inum==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_TEAM_FAILED")
- return PLUGIN_CONTINUE
- }
- else if (reco[players[i]]==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_R_TEAM_EXISTS", arg[1])
- return PLUGIN_HANDLED
- }
- for (i=0; i<inum; ++i)
- {
- reco[players[i]] = 0
- }
- switch (get_cvar_num("amx_show_activity"))
- {
- case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_R_TEAM_SET2", name2, arg[1])
- case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_R_TEAM_SET1", arg[1])
- }
- console_print(id, "%L", LANG_PLAYER, "AMX_R_TEAM_SET", arg[1])
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_R_TEAM_SET", arg[1])
- return PLUGIN_CONTINUE
- }
- else if (arg[0]=='*')
- {
- new players[32], inum, i, changed
- get_players(players, inum)
- for (i=0; i<inum; ++i)
- {
- if(!is_user_connected(players[i]))
- continue
- if (reco[players[i]]!=0)
- {
- reco[players[i]] = 0; changed = 1;
- console_print(i, "%L", LANG_PLAYER, "AMX_R_ALL_SET")
- }
- }
- if (changed==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_R_ALL_EXISTS")
- }
- else
- {
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_R_ALL_SET")
- }
- }
- else
- {
- new player = cmd_target(id,arg,0)
- new name[32]
- get_user_name(player,name,31)
- if (!player)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_CLIENT_FAILED")
- return PLUGIN_CONTINUE
- }
- else if (reco[player]==0)
- {
- console_print(id, "%L", LANG_PLAYER, "AMX_R_CLIENT_EXISTS", name)
- return PLUGIN_HANDLED
- }
- reco[player] = 0
- switch (get_cvar_num("amx_show_activity"))
- {
- case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_R_CLIENT_SET2", name2, name)
- case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "AMX_R_CLIENT_SET1", name)
- }
- console_print(id, "%L", LANG_PLAYER, "AMX_R_CLIENT_SET", name)
- show_hudmessage(0, "%L", LANG_PLAYER, "HUD_R_CLIENT_SET", name)
- }
- return PLUGIN_HANDLED
- }
- public noreco(id)
- {
- if (get_cvar_num("sv_norecoil")==1)
- {
- if (!is_user_alive(id))
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "NR_CHECK_ALIVE")
- return PLUGIN_HANDLED
- }
- }
- new money = cs_get_user_money(id)
- new recocost = get_cvar_num("sv_norecoil_cost")
- if (get_cvar_num("sv_norecoil")==0)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "AMX_CHECK_DISABLED")
- }
- else if (money < recocost)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "NR_CHECK_MONEY", recocost)
- }
- else
- {
- if (reco[id])
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "NR_CHECK_EXISTS")
- }
- else if (get_cvar_num("sv_norecoil")==1)
- {
- cs_set_user_money(id, money - recocost)
- reco[id] = 1
- client_cmd(id, "spk items/clipinsert1.wav")
- client_print(id, print_center, "%L", LANG_PLAYER, "NR_CHECK_BUY")
- }
- }
- return PLUGIN_HANDLED
- }
- public recoi(id)
- {
- if (get_cvar_num("sv_norecoil")==0)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "AMX_CHECK_DISABLED")
- }
- else
- {
- if (reco[id]==0)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "R_CHECK_EXISTS")
- }
- else if (reco[id]==1)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "R_CHECK_RETURN")
- reco[id] = 0
- client_cmd(id, "spk items/cliprelease1.wav")
- }
- }
- }
- public newRound(id)
- {
- if (reco[id]==1)
- {
- client_print(id, print_center, "%L", LANG_PLAYER, "R_CHECK_RETURN")
- }
- reco[id] = 0
- return PLUGIN_HANDLED
- }
- public client_PreThink(id)
- {
- if (reco[id]==1)
- {
- entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
- }
- }
- public change_weapon(id)
- {
- if (reco[id]==1)
- {
- entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement