Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.80 KB | None | 0 0
  1. new const VERSION[]="1.1" // current saved version of this plug-in.
  2. /* ===========================================================================================
  3.  
  4. _______________________________________________________________________
  5. |This program is free software: you can redistribute it and/or modify |
  6. |it under the terms of the GNU General Public License as published by |
  7. |the Free Software Foundation, either version 1.1 of the License, or |
  8. |(at your option) any later version. |
  9. | |
  10. |This program is distributed in the hope that it will be useful, |
  11. |but WITHOUT ANY WARRANTY; without even the implied warranty of |
  12. |MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  13. |GNU General Public License for more details. |
  14. | |
  15. |You should have received a copy of the GNU General Public License |
  16. |along with this program. If not, see <http://www.gnu.org/licenses/>.|
  17. | |
  18. |In addition, as a special exception, the author gives permission to |
  19. |link the code of this program with the Half-Life Game Engine ("HL |
  20. |Engine") and Modified Game Libraries ("MODs") developed by Valve, |
  21. |L.L.C ("Valve"). You must obey the GNU General Public License in all |
  22. |respects for all of the code used other than the HL Engine and MODs |
  23. |from Valve. If you modify this file, you may extend this exception |
  24. |to your version of the file, but you are not obligated to do so. If |
  25. |you do not wish to do so, delete this exception statement from your |
  26. |version |
  27. | |
  28. |_____________________________________________________________________|
  29. |@ Rj's Plug-ins License |
  30. |_____________________________________________________________________|
  31. |CS:GO Knives Selector V1.1 - Copyright (c) 2016 by .:Rj:. | |
  32. |_____________________________________________________________________|
  33. _________________________________________________________
  34.  
  35. CS:GO Knives Selector V1.1
  36. - by .:Rj:.
  37.  
  38. DESCRIPTION:
  39. Menu of all CS:GO Knives; switch your knife to CS:GO Knife models.
  40. Both teams have own arm textures (unlike other csgo knife selector plugins)
  41. To show the menu, choose at least one command below then type it on console.
  42.  
  43. ________________________
  44. COMMANDS :
  45. ________________________
  46. - say /csgoknives
  47. - say /csgok
  48. - say /knivescsgo
  49. - say /knives
  50. - say /selectknives
  51. - say /knivesselector
  52. ________________________
  53. CS:GO AVAILABLE KNIVES :
  54. ________________________
  55. - Default CS:GO Knife
  56. - Bayonet
  57. - Gutt Knife
  58. - Flip Knife
  59. - Hunstman
  60. - Shadow Daggers
  61. - Butterfly Knife
  62. - Karambit
  63. - M9 Bayonet
  64.  
  65. --------------------------------------------------------------------------------------
  66. CHANGE LOG/ BUG LOG/ UPDATE LOG :
  67. --------------------------------------------------------------------------------------
  68. 1.0
  69. * First Release
  70. --------------------------------------------------------------------------------------
  71. 1.1:
  72.  
  73. - Change register_event "CurWeapon" to Register_Ham "Ham_Item_Deploy [weapon_knife]"
  74. - Reported as being lag to BOTs, fixed!.
  75. + Added engclient_cmd "weapon_knife" after set_pev "pev_viewmodel2"
  76. (view arm model) codes to switch the current weapon to knife, and
  77. added set_task for anti- model bug...
  78. - Bug confirmed, fixed!.
  79. - removed set_pcvar_num "csgoks_knife" to 0 in client_putinserver
  80. (player selected a team) and client_discnonected (player disconnected).
  81. - not neccessary, removed!.
  82. --------------------------------------------------------------------------------------
  83. */
  84.  
  85. //====================================================
  86. #include <amxmodx>
  87. #include <amxmisc>
  88. #include <cstrike>
  89. #include <fakemeta>
  90. #include <hamsandwich>
  91. //====================================================
  92. #define PLUGIN "CSGO Knives Selector"
  93. //====================================================
  94. new Menu
  95. new SayText
  96. const m_iPlayer = 41
  97. new cvar_enable,cvar_admin
  98. //====================================================
  99. // Do not change the codes below. If you would like to change the model, go to the folder and rename it with 'v_knife.mdl'.
  100. new const V_DEFAULT[] = "models/v_knife.mdl"
  101. new const T_DEFAULT[] = "models/v_knife.mdl"
  102. new const V_BAYONET[] = "models/pvpts/kelebek.mdl"
  103. new const T_BAYONET[] = "models/pvpts/kelebek.mdl"
  104. new const V_GUT[] = "models/pvpts/karambit.mdl"
  105. new const T_GUT[] = "models/pvpts/karambit.mdl"
  106. new const V_FLIP[] = "models/pvpts/flip.mdl"
  107. new const T_FLIP[] = "models/pvpts/flip.mdl"
  108. //====================================================
  109. public plugin_init() {
  110. //====================================================
  111. register_plugin(PLUGIN, VERSION, ".:Rj:.")
  112. //====================================================
  113. register_clcmd("say .bicak","selectknives")
  114. //====================================================
  115. cvar_enable = register_cvar("csgok_knife","1")
  116. cvar_admin = register_cvar("csgo_admin_only","0")
  117. //====================================================
  118. /*register_event("CurWeapon" , "fwItemDeployPost" , "be" , "1=1" )*/ // 1.0 reproted bug #1
  119. RegisterHam(Ham_Item_Deploy, "weapon_knife", "fwItemDeployPost", 1);
  120. SayText=get_user_msgid("SayText")
  121. //====================================================
  122. Menu = menu_create("\PVPTS.NET Bicak Menu", "CSGO_SelectKnives")
  123.  
  124. menu_additem(Menu, "\Normal Bicak", "1")
  125. menu_additem(Menu, "\Kelebek Bicak", "2")
  126. menu_additem(Menu, "\Karambit Bicak", "3")
  127. menu_additem(Menu, "\Flip Bicak", "4")
  128. //====================================================
  129. menu_addblank(Menu)
  130. menu_addblank(Menu)
  131. menu_addblank(Menu)
  132. //====================================================
  133. menu_setprop(Menu, MPROP_ORDER)
  134. //====================================================
  135. }
  136. //====================================================
  137. public plugin_precache() // precaching csgo arms...
  138. {
  139.  
  140. precache_model("models/v_knife.mdl")
  141. precache_model(V_DEFAULT)
  142. precache_model(T_DEFAULT)
  143. precache_model(V_BAYONET)
  144. precache_model(T_BAYONET)
  145. precache_model(V_FLIP)
  146. precache_model(T_FLIP)
  147. precache_model(V_GUT)
  148. precache_model(T_GUT)
  149. }
  150. //====================================================
  151. stock client_printcolor(const id, const input[], any:...)
  152. {
  153. new count = 1, players[32]
  154. static msg[191]
  155. vformat(msg, 190, input, 3)
  156.  
  157. replace_all(msg, 190, "!g", "^4") // Green Color
  158. replace_all(msg, 190, "!y", "^1") // Default Color
  159. replace_all(msg, 190, "!t", "^3") // Team Color
  160.  
  161. if (id) players[0] = id; else get_players(players, count, "ch")
  162. {
  163. for ( new i = 0; i < count; i++ )
  164. {
  165. if ( is_user_connected(players[i]) )
  166. {
  167. message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
  168. write_byte(players[i]);
  169. write_string(msg);
  170. message_end();
  171. }
  172. }
  173. }
  174. }
  175. //====================================================
  176. public selectknives(id) // command to show the menu...
  177. {
  178. engclient_cmd(id,"weapon_knife")
  179. //====================================================
  180. if(get_pcvar_num(cvar_enable) <= 0 || get_pcvar_num(cvar_enable) > 9)
  181. {
  182. client_printcolor(id,"!t[!gCSGOKS!t] !gCSGO Knives Selector !yare currently disabled.")
  183. return 1
  184. }
  185. //====================================================
  186. if(get_pcvar_num(cvar_admin) && get_user_flags(id) != ADMIN_MENU)
  187. {
  188. client_printcolor(id,"!t[!gCSGOKS!t] !yOnly !tADMINs !ycan use !gCSGO Knives Selector!y.")
  189. return 1
  190. }
  191. //====================================================
  192. if(!is_user_alive(id)) return 1
  193. menu_display(id, Menu)
  194. //====================================================
  195. return 1
  196. }
  197. //====================================================
  198. public CSGO_SelectKnives(id, Menu, item) // Menu of knives.
  199. {
  200. //====================================================
  201. if(item == MENU_EXIT)
  202. {
  203. menu_destroy(Menu)
  204. return PLUGIN_HANDLED
  205. }
  206. //====================================================
  207. new iData[6]
  208. new iAccess
  209. new iCallback
  210. new iName[64]
  211. //====================================================
  212. menu_item_getinfo(Menu, item, iAccess, iData, 5, iName, 63, iCallback)
  213. //====================================================
  214. switch(str_to_num(iData))
  215. {
  216. //====================================================
  217. case 1:
  218. {
  219. if(!is_user_alive(id) )
  220. return 1
  221. if(get_pcvar_num(cvar_enable) <= 0)
  222. return 1
  223. if(get_pcvar_num(cvar_enable) == 1)
  224. {
  225. client_printcolor(id,"!t[!gPVPTS!t] !yZaten Bu Bicagi Kullaniyorsun")
  226. return 1
  227. }
  228.  
  229. set_pcvar_num(cvar_enable,1)
  230. if(cs_get_user_team(id) == CS_TEAM_CT)
  231. set_pev(id, pev_viewmodel2, V_DEFAULT)
  232. else if(cs_get_user_team(id) == CS_TEAM_T)
  233. set_pev(id, pev_viewmodel2, T_DEFAULT)
  234. set_task(0.2,"knife_switching",id)
  235. client_printcolor(id,"!t[!gCSGOKS!t] !yKnife switched to !gNormal Bicak!y.")
  236. }
  237.  
  238. //====================================================
  239. case 2:
  240. {
  241. if(!is_user_alive(id) )
  242. return 1
  243. if(get_pcvar_num(cvar_enable) <= 0)
  244. return 1
  245. if(get_pcvar_num(cvar_enable) == 2)
  246. {
  247. client_printcolor(id,"!t[!gPVPTS!t] !yZaten Bu Bicagi Kullaniyorsun")
  248. return 1
  249. }
  250.  
  251. set_pcvar_num(cvar_enable,2)
  252. if(cs_get_user_team(id) == CS_TEAM_CT)
  253. set_pev(id, pev_viewmodel2, V_BAYONET)
  254. else if(cs_get_user_team(id) == CS_TEAM_T)
  255. set_pev(id, pev_viewmodel2, T_BAYONET)
  256. set_task(0.2,"knife_switching",id)
  257. client_printcolor(id,"!t[!gCSGOKS!t] !yKnife switched to !gKelebek Bicak!y.")
  258.  
  259. }
  260. //====================================================
  261. case 3:
  262. {
  263. if(!is_user_alive(id) )
  264. return 1
  265. if(get_pcvar_num(cvar_enable) <= 0)
  266. return 1
  267. if(get_pcvar_num(cvar_enable) == 3)
  268. {
  269. client_printcolor(id,"!t[!gPVPTS!t] !yZaten Bu Bicagi Kullaniyorsun")
  270. return 1
  271. }
  272.  
  273. set_pcvar_num(cvar_enable,3)
  274. if(cs_get_user_team(id) == CS_TEAM_CT)
  275. set_pev(id, pev_viewmodel2, V_GUT)
  276. else if(cs_get_user_team(id) == CS_TEAM_T)
  277. set_pev(id, pev_viewmodel2, T_GUT)
  278. set_task(0.2,"knife_switching",id)
  279. client_printcolor(id,"!t[!gCSGOKS!t] !yKnife switched to !gKarambit Bicak!y.")
  280. }
  281. //====================================================
  282. case 4:
  283. {
  284. if(!is_user_alive(id) )
  285. return 1
  286. if(get_pcvar_num(cvar_enable) <= 0)
  287. return 1
  288. if(get_pcvar_num(cvar_enable) == 4)
  289. {
  290. client_printcolor(id,"!t[!gPVPTS!t] !yZaten Bu Bicagi Kullaniyorsun")
  291. return 1
  292. }
  293. set_pcvar_num(cvar_enable,4)
  294. if(cs_get_user_team(id) == CS_TEAM_CT)
  295. set_pev(id, pev_viewmodel2, V_FLIP)
  296. else if(cs_get_user_team(id) == CS_TEAM_T)
  297. set_pev(id, pev_viewmodel2, T_FLIP)
  298. set_task(0.2,"knife_switching",id)
  299. client_printcolor(id,"!t[!gCSGOKS!t] !yKnife switched to !gFlip Bicak!y.")
  300. }
  301.  
  302. }
  303. return 1
  304. }
  305. //====================================================
  306. public fwItemDeployPost(weapon)
  307. {
  308. //====================================================
  309. static id;
  310. id = get_pdata_cbase(weapon, m_iPlayer, 4);
  311. //====================================================
  312. /*if(get_user_weapon(id) != CSW_KNIFE) return*/
  313. if(get_pcvar_num(cvar_enable) > 9 || get_pcvar_num(cvar_enable) <= 0)
  314. {
  315. set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
  316. return
  317. }
  318. //====================================================
  319. if(get_pcvar_num(cvar_enable) == 1)
  320. {
  321. if(cs_get_user_team(id) == CS_TEAM_CT)
  322. set_pev(id, pev_viewmodel2, V_DEFAULT)
  323. else if(cs_get_user_team(id) == CS_TEAM_T)
  324. set_pev(id, pev_viewmodel2, T_DEFAULT)
  325. return
  326. }
  327. //====================================================
  328. if(get_pcvar_num(cvar_enable) == 2)
  329. {
  330. if(cs_get_user_team(id) == CS_TEAM_CT)
  331. set_pev(id, pev_viewmodel2, V_BAYONET)
  332. else if(cs_get_user_team(id) == CS_TEAM_T)
  333. set_pev(id, pev_viewmodel2, T_BAYONET)
  334. return
  335. }
  336. //====================================================
  337. if(get_pcvar_num(cvar_enable) == 3)
  338. {
  339. if(cs_get_user_team(id) == CS_TEAM_CT)
  340. set_pev(id, pev_viewmodel2, V_GUT)
  341. else if(cs_get_user_team(id) == CS_TEAM_T)
  342. set_pev(id, pev_viewmodel2, T_GUT)
  343. return
  344. }
  345. //====================================================
  346. if(get_pcvar_num(cvar_enable) == 4)
  347. {
  348. if(cs_get_user_team(id) == CS_TEAM_CT)
  349. set_pev(id, pev_viewmodel2, V_FLIP)
  350. else if(cs_get_user_team(id) == CS_TEAM_T)
  351. set_pev(id, pev_viewmodel2, T_FLIP)
  352. return
  353. }
  354.  
  355. return
  356. }
  357. public knife_switching(id) engclient_cmd( id, "weapon_knife" ) // task to switch knife (time :0 .2)
  358. // 1.0 bug reported #3
  359. //====================================================
  360. /*
  361. //====================================================
  362. public client_putinserver()
  363. set_pcvar_num(cvar_enable,0)
  364. //====================================================
  365. public client_disconnect()
  366. set_pcvar_num(cvar_enable,0)
  367. //====================================================
  368. */
  369. //====================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement