hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.15. 22:40



Jelenlévő felhasználók

Jelenleg 350 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 349 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [7 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: hook
HozzászólásElküldve:2013.10.04. 20:15 
Offline
Jómunkásember
Avatar

Csatlakozott:2012.12.24. 13:27
Hozzászólások:447
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 14 alkalommal
Olyat szeretnék hogy hookot csak az tudjon használni akinek én engedem mármint arra gondolok hogy van egy hook.ini fálj pl.. és akkor bele irom pl az ip jét vagy a nevét vagy a steamid jét és akkor csak az az ember tud használni hookot! ,köszönöm! természetesen a gomb is megy!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.06. 18:35 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
Teszteld
csinálj 1 ini filét a configs mappában belül :hook_admin.ini néven abba írd (1. sorba) a steam id det és teszteld
SMA Forráskód: [ Mindet kijelol ]
  1. /**************************************************************************************************
  2.  
  3. **** CVARS (FEATURES) ****
  4. sv_adminhook = Turn Plugin On/off
  5. **** ADMIN COMMANDS ****
  6. ADMIN_LEVEL_A (flag="m")
  7. Granting Hook/Rope = amx_granthook <authid, nick, @team, @all or #userid> <on/off>
  8.  
  9. ADMIN_LEVEL_E (flag="q") || Granted by admin
  10. Ninja Rope by Spacedude (slightly modified) & Hook thingy
  11. Attaching Rope = +rope
  12. Deattaching Rope = -rope
  13. Attaching Hook = +hook
  14. Deattaching Hook = -hook
  15.  
  16. **************************************************************************************************/
  17. #define USING_AMX 0 // 1 = Using AMX \ 0 = Useing AMXX
  18.  
  19. #if USING_AMX
  20. #include <amxmod>
  21. #include <amxmisc>
  22. #include <VexdUM>
  23. #include <fun>
  24. new gModName[32] = "AMX"
  25. #else
  26. #include <amxmodx>
  27. #include <amxmisc>
  28. #include <fun>
  29. #include <engine>
  30. new gModName[32] = "AMXX"
  31. #endif
  32.  
  33. #define TE_BEAMENTPOINT 1
  34. #define TE_KILLBEAM 99
  35. #define DELTA_T 0.1 // seconds
  36. #define BEAMLIFE 100 // deciseconds
  37. #define MOVEACCELERATION 150 // units per second^2
  38. #define REELSPEED 300 // units per second
  39.  
  40. /* Hook Stuff */
  41. new gHookLocation[33][3]
  42. new gHookLenght[33]
  43. new bool:gIsHooked[33]
  44. new gAllowedHook[33]
  45. new Float:gBeamIsCreated[33]
  46. new global_gravity
  47. new beam
  48. new cfg[120];
  49. new line = 0;
  50. new linetext[255], linetextlength;
  51. /************************************************************************************************************************/
  52. public plugin_init() //Called on plugin start
  53. {
  54. // Plugin Info
  55. register_plugin("Admin Hook","1.0","AssKicR")
  56.  
  57. //CVARS
  58. register_cvar("sv_adminhook", "1" )
  59.  
  60. //ADMIN CMDS
  61. register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<authid, nick, @team, @all or #userid> <on/off>")
  62.  
  63. //USER COMMANDS
  64. register_clcmd("+rope", "hook_on")
  65. register_clcmd("-rope", "hook_off")
  66. register_clcmd("+hook", "hook_on")
  67. register_clcmd("-hook", "hook_off")
  68.  
  69. //HOOKED EVENTS
  70. register_event("ResetHUD", "ResetHUD", "b")
  71. }
  72. /************************************************************************************************************************/
  73. public plugin_precache()
  74. {
  75. beam = precache_model("sprites/zbeam4.spr")
  76. precache_sound("weapons/xbow_hit2.wav")
  77. }
  78. /*************************************************************************************************************************/
  79. /************************************************** USP/SCOUT REMOVE *****************************************************/
  80. /*************************************************************************************************************************/
  81.  
  82. /*************************************************************************************************************************/
  83. /**************************************************** HOOKED EVENTS ******************************************************/
  84. /*************************************************************************************************************************/
  85. public ResetHUD(id) {
  86. //Check if he is hooked to something
  87. if (gIsHooked[id]) RopeRelease(id)
  88. }
  89. /************************************************************************************************************************/
  90. stock kz_velocity_set(id,vel[3]) {
  91. //Set Their Velocity to 0 so that they they fall straight down from
  92. new Float:Ivel[3]
  93. Ivel[0]=float(vel[0])
  94. Ivel[1]=float(vel[1])
  95. Ivel[2]=float(vel[2])
  96. entity_set_vector(id, EV_VEC_velocity, Ivel)
  97. }
  98.  
  99. stock kz_velocity_get(id,vel[3]) {
  100. //Set Their Velocity to 0 so that they they fall straight down from
  101. new Float:Ivel[3]
  102.  
  103. entity_get_vector(id, EV_VEC_velocity, Ivel)
  104. vel[0]=floatround(Ivel[0])
  105. vel[1]=floatround(Ivel[1])
  106. vel[2]=floatround(Ivel[2])
  107. }
  108.  
  109. /************************************************************************************************************************/
  110. /**************************************************** ADMIN COMMANDS ****************************************************/
  111. /************************************************************************************************************************/
  112. public AdminGrantHook(id,level,cid)
  113. {
  114. if ( !cmd_access(id,level,cid,1) )
  115. return PLUGIN_HANDLED
  116.  
  117. new arg1[32],arg2[32]
  118. read_argv(1,arg1,31)
  119. read_argv(2,arg2,31)
  120. new onoff = str_to_num(arg2)
  121.  
  122. if ( equali(arg1,"@all") )
  123. {
  124. new plist[32],pnum
  125. get_players(plist,pnum,"a")
  126. if (pnum==0)
  127. {
  128. console_print(id,"[%s] There are no clients",gModName)
  129. return PLUGIN_HANDLED
  130. }
  131. for (new i=0; i<pnum; i++) {
  132. gAllowedHook[plist[i]]=onoff
  133. if (gIsHooked[plist[i]]==true && onoff==0)
  134. {
  135. RopeRelease(plist[i])
  136. }
  137. }
  138.  
  139. console_print(id,"[%s] %s all players access to hook/rope",gModName,onoff ? "Gave":"Removed")
  140. }
  141. else if ( arg1[0]=='@' )
  142. {
  143. new plist[32],pnum
  144. get_players(plist,pnum,"ae",arg1[1])
  145. if ( pnum==0 )
  146. {
  147. console_print(id,"[%s] No clients in such team",gModName)
  148. return PLUGIN_HANDLED
  149. }
  150. for (new i=0; i<pnum; i++) {
  151. gAllowedHook[plist[i]]=onoff
  152. if (gIsHooked[plist[i]]==true && onoff==0)
  153. {
  154. RopeRelease(plist[i])
  155. }
  156. }
  157. console_print(id,"[%s] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
  158. }
  159. else
  160. {
  161. new pName[32]
  162. new player = cmd_target(id,arg1,6)
  163. if (!player) return PLUGIN_HANDLED
  164.  
  165. gAllowedHook[player]=onoff
  166. if (gAllowedHook[player]==0 && onoff==0)
  167. {
  168. RopeRelease(player)
  169. }
  170.  
  171.  
  172. get_user_name(player,pName,31)
  173. console_print(id,"[%s] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
  174. }
  175.  
  176. return PLUGIN_HANDLED
  177. }
  178.  
  179. /************************************************************************************************************************/
  180. /****************************************************** NINJAROPE *******************************************************/
  181. /************************************************************************************************************************/
  182.  
  183. public ropetask(parm[])
  184. {
  185. new id = parm[0]
  186. new user_origin[3], user_look[3], user_direction[3], move_direction[3]
  187. new A[3], D[3], buttonadjust[3]
  188. new acceleration, velocity_towards_A, desired_velocity_towards_A
  189. new velocity[3], null[3]
  190.  
  191. if (!is_user_alive(id))
  192. {
  193. RopeRelease(id)
  194. return
  195. }
  196.  
  197. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  198. {
  199. beamentpoint(id)
  200. }
  201.  
  202. null[0] = 0
  203. null[1] = 0
  204. null[2] = 0
  205.  
  206. get_user_origin(id, user_origin)
  207. get_user_origin(id, user_look,2)
  208. kz_velocity_get(id, velocity)
  209.  
  210. buttonadjust[0]=0
  211. buttonadjust[1]=0
  212.  
  213. if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
  214. if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
  215. if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
  216. if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
  217. if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
  218. if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
  219.  
  220. if (buttonadjust[0] || buttonadjust[1])
  221. {
  222. user_direction[0] = user_look[0] - user_origin[0]
  223. user_direction[1] = user_look[1] - user_origin[1]
  224.  
  225. move_direction[0] = buttonadjust[0]*user_direction[0] + user_direction[1]*buttonadjust[1]
  226. move_direction[1] = buttonadjust[0]*user_direction[1] - user_direction[0]*buttonadjust[1]
  227. move_direction[2] = 0
  228.  
  229. velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  230. velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  231. }
  232.  
  233. if (buttonadjust[2]) gHookLenght[id] -= floatround(buttonadjust[2] * REELSPEED * DELTA_T)
  234. if (gHookLenght[id] < 100) gHookLenght[id] = 100
  235.  
  236. A[0] = gHookLocation[id][0] - user_origin[0]
  237. A[1] = gHookLocation[id][1] - user_origin[1]
  238. A[2] = gHookLocation[id][2] - user_origin[2]
  239.  
  240. D[0] = A[0]*A[2] / get_distance(null,A)
  241. D[1] = A[1]*A[2] / get_distance(null,A)
  242. D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)
  243.  
  244. acceleration = - global_gravity * D[2] / get_distance(null,D)
  245.  
  246. velocity_towards_A = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)
  247. desired_velocity_towards_A = (get_distance(user_origin,gHookLocation[id]) - gHookLenght[id] /*- 10*/) * 4
  248.  
  249. if (get_distance(null,D)>10)
  250. {
  251. velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))
  252. velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))
  253. velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))
  254. }
  255.  
  256. velocity[0] += ((desired_velocity_towards_A - velocity_towards_A) * A[0]) / get_distance(null,A)
  257. velocity[1] += ((desired_velocity_towards_A - velocity_towards_A) * A[1]) / get_distance(null,A)
  258. velocity[2] += ((desired_velocity_towards_A - velocity_towards_A) * A[2]) / get_distance(null,A)
  259.  
  260. kz_velocity_set(id, velocity)
  261. }
  262.  
  263. public hooktask(parm[])
  264. {
  265. new id = parm[0]
  266. new velocity[3]
  267.  
  268. if ( !gIsHooked[id] ) return
  269.  
  270. new user_origin[3],oldvelocity[3]
  271. parm[0] = id
  272.  
  273. if (!is_user_alive(id))
  274. {
  275. RopeRelease(id)
  276. return
  277. }
  278.  
  279. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  280. {
  281. beamentpoint(id)
  282. }
  283.  
  284. get_user_origin(id, user_origin)
  285. kz_velocity_get(id, oldvelocity)
  286. new distance=get_distance( gHookLocation[id], user_origin )
  287. if ( distance > 10 )
  288. {
  289. velocity[0] = floatround( (gHookLocation[id][0] - user_origin[0]) * ( 2.0 * REELSPEED / distance ) )
  290. velocity[1] = floatround( (gHookLocation[id][1] - user_origin[1]) * ( 2.0 * REELSPEED / distance ) )
  291. velocity[2] = floatround( (gHookLocation[id][2] - user_origin[2]) * ( 2.0 * REELSPEED / distance ) )
  292. }
  293. else
  294. {
  295. velocity[0]=0
  296. velocity[1]=0
  297. velocity[2]=0
  298. }
  299.  
  300. kz_velocity_set(id, velocity)
  301.  
  302. }
  303.  
  304. public hook_on(id)
  305. {
  306. new steamid[32]
  307. line = 0;
  308. get_configsdir(cfg, 63);
  309. get_user_authid(id, steamid, charsmax(steamid));
  310. format(cfg, 119, "%s/hook_admin.ini", cfg);
  311. if (file_exists(cfg))
  312. {
  313. while ((line = read_file(cfg, line, linetext, 256, linetextlength)))
  314. {
  315. if(linetext[0] == ';')
  316. {
  317. return PLUGIN_CONTINUE
  318. }
  319. if((equal(linetext, steamid)))
  320. {
  321. if (!gIsHooked[id] && is_user_alive(id))
  322. {
  323. new cmd[32]
  324. read_argv(0,cmd,31)
  325. if(equal(cmd,"+rope")) RopeAttach(id,0)
  326. if(equal(cmd,"+hook")) RopeAttach(id,1)
  327. }
  328. }
  329. }
  330. }
  331. return PLUGIN_HANDLED
  332. }
  333.  
  334. public hook_off(id)
  335. {
  336. new steamid[32]
  337. line = 0;
  338. get_configsdir(cfg, 63);
  339. get_user_authid(id, steamid, charsmax(steamid));
  340. format(cfg, 119, "%s/hook_admin.ini", cfg);
  341. if (file_exists(cfg))
  342. {
  343. while ((line = read_file(cfg, line, linetext, 256, linetextlength)))
  344. {
  345. if(linetext[0] == ';')
  346. {
  347. return PLUGIN_CONTINUE
  348. }
  349. if((equal(linetext, steamid)))
  350. {
  351. if (gIsHooked[id])
  352. {
  353. RopeRelease(id)
  354. }
  355. }
  356. }
  357. }
  358. return PLUGIN_HANDLED
  359. }
  360.  
  361. public RopeAttach(id,hook)
  362. {
  363. new parm[1], user_origin[3]
  364. parm[0] = id
  365. gIsHooked[id] = true
  366. get_user_origin(id,user_origin)
  367. get_user_origin(id,gHookLocation[id], 3)
  368. gHookLenght[id] = get_distance(gHookLocation[id],user_origin)
  369. global_gravity = get_cvar_num("sv_gravity")
  370. set_user_gravity(id,0.001)
  371. beamentpoint(id)
  372. emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  373. if (hook) set_task(DELTA_T, "hooktask", 200+id, parm, 1, "b")
  374. else set_task(DELTA_T, "ropetask", 200+id, parm, 1, "b")
  375. }
  376.  
  377. public RopeRelease(id)
  378. {
  379. gIsHooked[id] = false
  380. killbeam(id)
  381. set_user_gravity(id)
  382. remove_task(200+id)
  383. }
  384.  
  385. public beamentpoint(id)
  386. {
  387. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  388. write_byte( TE_BEAMENTPOINT )
  389. write_short( id )
  390. write_coord( gHookLocation[id][0] )
  391. write_coord( gHookLocation[id][1] )
  392. write_coord( gHookLocation[id][2] )
  393. write_short( beam ) // sprite index
  394. write_byte( 0 ) // start frame
  395. write_byte( 0 ) // framerate
  396. write_byte( BEAMLIFE ) // life
  397. write_byte( 10 ) // width
  398. write_byte( 0 ) // noise
  399. if (get_user_team(id)==1) // Terrorist
  400. {
  401. write_byte( 255 ) // r, g, b
  402. write_byte( 0 ) // r, g, b
  403. write_byte( 0 ) // r, g, b
  404. }
  405. else // Counter-Terrorist
  406. {
  407. write_byte( 0 ) // r, g, b
  408. write_byte( 0 ) // r, g, b
  409. write_byte( 255 ) // r, g, b
  410. }
  411. write_byte( 150 ) // brightness
  412. write_byte( 0 ) // speed
  413. message_end( )
  414. gBeamIsCreated[id] = get_gametime()
  415. }
  416.  
  417. public killbeam(id)
  418. {
  419. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  420. write_byte( TE_KILLBEAM )
  421. write_short( id )
  422. message_end()
  423. }
  424.  
  425. /************************************************************************************************************************/
  426. /******************************************************* FORWARDS *******************************************************/
  427. /************************************************************************************************************************/
  428.  
  429. public client_disconnect(id) {
  430. gAllowedHook[id]=0
  431. }
  432.  
  433. /************************************************************************************************************************/
  434. /************************************************** AMXX -> AMX funcs ***************************************************/
  435. /************************************************************************************************************************/
  436. #if USING_AMX
  437. stock get_user_button(id) return entity_get_int(id, EV_INT_button)
  438. #endif

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.06. 19:51 
Offline
Jómunkásember
Avatar

Csatlakozott:2012.12.24. 13:27
Hozzászólások:447
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 14 alkalommal
Ip vel és nevel is működik?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.06. 20:02 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
csak steam id

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.06. 20:56 
Offline
Jómunkásember
Avatar

Csatlakozott:2012.12.24. 13:27
Hozzászólások:447
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 14 alkalommal
meg lehetne oldani ip + name vel?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.07. 06:09 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
tessék steam id v név v ip
SMA Forráskód: [ Mindet kijelol ]
  1. /**************************************************************************************************
  2.  
  3. **** CVARS (FEATURES) ****
  4. sv_adminhook = Turn Plugin On/off
  5. **** ADMIN COMMANDS ****
  6. ADMIN_LEVEL_A (flag="m")
  7. Granting Hook/Rope = amx_granthook <authid, nick, @team, @all or #userid> <on/off>
  8.  
  9. ADMIN_LEVEL_E (flag="q") || Granted by admin
  10. Ninja Rope by Spacedude (slightly modified) & Hook thingy
  11. Attaching Rope = +rope
  12. Deattaching Rope = -rope
  13. Attaching Hook = +hook
  14. Deattaching Hook = -hook
  15.  
  16. **************************************************************************************************/
  17. #define USING_AMX 0 // 1 = Using AMX \ 0 = Useing AMXX
  18.  
  19. #if USING_AMX
  20. #include <amxmod>
  21. #include <amxmisc>
  22. #include <VexdUM>
  23. #include <fun>
  24. new gModName[32] = "AMX"
  25. #else
  26. #include <amxmodx>
  27. #include <amxmisc>
  28. #include <fun>
  29. #include <engine>
  30. new gModName[32] = "AMXX"
  31. #endif
  32.  
  33. #define TE_BEAMENTPOINT 1
  34. #define TE_KILLBEAM 99
  35. #define DELTA_T 0.1 // seconds
  36. #define BEAMLIFE 100 // deciseconds
  37. #define MOVEACCELERATION 150 // units per second^2
  38. #define REELSPEED 300 // units per second
  39.  
  40. /* Hook Stuff */
  41. new gHookLocation[33][3]
  42. new gHookLenght[33]
  43. new bool:gIsHooked[33]
  44. new gAllowedHook[33]
  45. new Float:gBeamIsCreated[33]
  46. new global_gravity
  47. new beam
  48. new cfg[120];
  49. new line = 0;
  50. new linetext[255], linetextlength;
  51. /************************************************************************************************************************/
  52. public plugin_init() //Called on plugin start
  53. {
  54. // Plugin Info
  55. register_plugin("Admin Hook","1.0","AssKicR")
  56.  
  57. //CVARS
  58. register_cvar("sv_adminhook", "1" )
  59.  
  60. //ADMIN CMDS
  61. register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<authid, nick, @team, @all or #userid> <on/off>")
  62.  
  63. //USER COMMANDS
  64. register_clcmd("+rope", "hook_on")
  65. register_clcmd("-rope", "hook_off")
  66. register_clcmd("+hook", "hook_on")
  67. register_clcmd("-hook", "hook_off")
  68.  
  69. //HOOKED EVENTS
  70. register_event("ResetHUD", "ResetHUD", "b")
  71. }
  72. /************************************************************************************************************************/
  73. public plugin_precache()
  74. {
  75. beam = precache_model("sprites/zbeam4.spr")
  76. precache_sound("weapons/xbow_hit2.wav")
  77. }
  78. /*************************************************************************************************************************/
  79. /************************************************** USP/SCOUT REMOVE *****************************************************/
  80. /*************************************************************************************************************************/
  81.  
  82. /*************************************************************************************************************************/
  83. /**************************************************** HOOKED EVENTS ******************************************************/
  84. /*************************************************************************************************************************/
  85. public ResetHUD(id) {
  86. //Check if he is hooked to something
  87. if (gIsHooked[id]) RopeRelease(id)
  88. }
  89. /************************************************************************************************************************/
  90. stock kz_velocity_set(id,vel[3]) {
  91. //Set Their Velocity to 0 so that they they fall straight down from
  92. new Float:Ivel[3]
  93. Ivel[0]=float(vel[0])
  94. Ivel[1]=float(vel[1])
  95. Ivel[2]=float(vel[2])
  96. entity_set_vector(id, EV_VEC_velocity, Ivel)
  97. }
  98.  
  99. stock kz_velocity_get(id,vel[3]) {
  100. //Set Their Velocity to 0 so that they they fall straight down from
  101. new Float:Ivel[3]
  102.  
  103. entity_get_vector(id, EV_VEC_velocity, Ivel)
  104. vel[0]=floatround(Ivel[0])
  105. vel[1]=floatround(Ivel[1])
  106. vel[2]=floatround(Ivel[2])
  107. }
  108.  
  109. /************************************************************************************************************************/
  110. /**************************************************** ADMIN COMMANDS ****************************************************/
  111. /************************************************************************************************************************/
  112. public AdminGrantHook(id,level,cid)
  113. {
  114. if ( !cmd_access(id,level,cid,1) )
  115. return PLUGIN_HANDLED
  116.  
  117. new arg1[32],arg2[32]
  118. read_argv(1,arg1,31)
  119. read_argv(2,arg2,31)
  120. new onoff = str_to_num(arg2)
  121.  
  122. if ( equali(arg1,"@all") )
  123. {
  124. new plist[32],pnum
  125. get_players(plist,pnum,"a")
  126. if (pnum==0)
  127. {
  128. console_print(id,"[%s] There are no clients",gModName)
  129. return PLUGIN_HANDLED
  130. }
  131. for (new i=0; i<pnum; i++) {
  132. gAllowedHook[plist[i]]=onoff
  133. if (gIsHooked[plist[i]]==true && onoff==0)
  134. {
  135. RopeRelease(plist[i])
  136. }
  137. }
  138.  
  139. console_print(id,"[%s] %s all players access to hook/rope",gModName,onoff ? "Gave":"Removed")
  140. }
  141. else if ( arg1[0]=='@' )
  142. {
  143. new plist[32],pnum
  144. get_players(plist,pnum,"ae",arg1[1])
  145. if ( pnum==0 )
  146. {
  147. console_print(id,"[%s] No clients in such team",gModName)
  148. return PLUGIN_HANDLED
  149. }
  150. for (new i=0; i<pnum; i++) {
  151. gAllowedHook[plist[i]]=onoff
  152. if (gIsHooked[plist[i]]==true && onoff==0)
  153. {
  154. RopeRelease(plist[i])
  155. }
  156. }
  157. console_print(id,"[%s] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
  158. }
  159. else
  160. {
  161. new pName[32]
  162. new player = cmd_target(id,arg1,6)
  163. if (!player) return PLUGIN_HANDLED
  164.  
  165. gAllowedHook[player]=onoff
  166. if (gAllowedHook[player]==0 && onoff==0)
  167. {
  168. RopeRelease(player)
  169. }
  170.  
  171.  
  172. get_user_name(player,pName,31)
  173. console_print(id,"[%s] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
  174. }
  175.  
  176. return PLUGIN_HANDLED
  177. }
  178.  
  179. /************************************************************************************************************************/
  180. /****************************************************** NINJAROPE *******************************************************/
  181. /************************************************************************************************************************/
  182.  
  183. public ropetask(parm[])
  184. {
  185. new id = parm[0]
  186. new user_origin[3], user_look[3], user_direction[3], move_direction[3]
  187. new A[3], D[3], buttonadjust[3]
  188. new acceleration, velocity_towards_A, desired_velocity_towards_A
  189. new velocity[3], null[3]
  190.  
  191. if (!is_user_alive(id))
  192. {
  193. RopeRelease(id)
  194. return
  195. }
  196.  
  197. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  198. {
  199. beamentpoint(id)
  200. }
  201.  
  202. null[0] = 0
  203. null[1] = 0
  204. null[2] = 0
  205.  
  206. get_user_origin(id, user_origin)
  207. get_user_origin(id, user_look,2)
  208. kz_velocity_get(id, velocity)
  209.  
  210. buttonadjust[0]=0
  211. buttonadjust[1]=0
  212.  
  213. if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
  214. if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
  215. if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
  216. if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
  217. if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
  218. if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
  219.  
  220. if (buttonadjust[0] || buttonadjust[1])
  221. {
  222. user_direction[0] = user_look[0] - user_origin[0]
  223. user_direction[1] = user_look[1] - user_origin[1]
  224.  
  225. move_direction[0] = buttonadjust[0]*user_direction[0] + user_direction[1]*buttonadjust[1]
  226. move_direction[1] = buttonadjust[0]*user_direction[1] - user_direction[0]*buttonadjust[1]
  227. move_direction[2] = 0
  228.  
  229. velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  230. velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  231. }
  232.  
  233. if (buttonadjust[2]) gHookLenght[id] -= floatround(buttonadjust[2] * REELSPEED * DELTA_T)
  234. if (gHookLenght[id] < 100) gHookLenght[id] = 100
  235.  
  236. A[0] = gHookLocation[id][0] - user_origin[0]
  237. A[1] = gHookLocation[id][1] - user_origin[1]
  238. A[2] = gHookLocation[id][2] - user_origin[2]
  239.  
  240. D[0] = A[0]*A[2] / get_distance(null,A)
  241. D[1] = A[1]*A[2] / get_distance(null,A)
  242. D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)
  243.  
  244. acceleration = - global_gravity * D[2] / get_distance(null,D)
  245.  
  246. velocity_towards_A = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)
  247. desired_velocity_towards_A = (get_distance(user_origin,gHookLocation[id]) - gHookLenght[id] /*- 10*/) * 4
  248.  
  249. if (get_distance(null,D)>10)
  250. {
  251. velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))
  252. velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))
  253. velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))
  254. }
  255.  
  256. velocity[0] += ((desired_velocity_towards_A - velocity_towards_A) * A[0]) / get_distance(null,A)
  257. velocity[1] += ((desired_velocity_towards_A - velocity_towards_A) * A[1]) / get_distance(null,A)
  258. velocity[2] += ((desired_velocity_towards_A - velocity_towards_A) * A[2]) / get_distance(null,A)
  259.  
  260. kz_velocity_set(id, velocity)
  261. }
  262.  
  263. public hooktask(parm[])
  264. {
  265. new id = parm[0]
  266. new velocity[3]
  267.  
  268. if ( !gIsHooked[id] ) return
  269.  
  270. new user_origin[3],oldvelocity[3]
  271. parm[0] = id
  272.  
  273. if (!is_user_alive(id))
  274. {
  275. RopeRelease(id)
  276. return
  277. }
  278.  
  279. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  280. {
  281. beamentpoint(id)
  282. }
  283.  
  284. get_user_origin(id, user_origin)
  285. kz_velocity_get(id, oldvelocity)
  286. new distance=get_distance( gHookLocation[id], user_origin )
  287. if ( distance > 10 )
  288. {
  289. velocity[0] = floatround( (gHookLocation[id][0] - user_origin[0]) * ( 2.0 * REELSPEED / distance ) )
  290. velocity[1] = floatround( (gHookLocation[id][1] - user_origin[1]) * ( 2.0 * REELSPEED / distance ) )
  291. velocity[2] = floatround( (gHookLocation[id][2] - user_origin[2]) * ( 2.0 * REELSPEED / distance ) )
  292. }
  293. else
  294. {
  295. velocity[0]=0
  296. velocity[1]=0
  297. velocity[2]=0
  298. }
  299.  
  300. kz_velocity_set(id, velocity)
  301.  
  302. }
  303.  
  304. public hook_on(id)
  305. {
  306. new steamid[32]
  307. new ip[32]
  308. new nev[32]
  309. line = 0;
  310. get_configsdir(cfg, 63);
  311. get_user_authid(id, steamid, charsmax(steamid));
  312. get_user_name(id, nev, charsmax(nev));
  313. get_user_ip(id, ip, charsmax(ip));
  314. format(cfg, 119, "%s/hook_admin.ini", cfg);
  315. if (file_exists(cfg))
  316. {
  317. while ((line = read_file(cfg, line, linetext, 256, linetextlength)))
  318. {
  319. if(linetext[0] == ';')
  320. {
  321. return PLUGIN_CONTINUE
  322. }
  323. if((equal(linetext, steamid)) || (equal(linetext, nev)) || (equal(linetext, ip)))
  324. {
  325. if (!gIsHooked[id] && is_user_alive(id))
  326. {
  327. new cmd[32]
  328. read_argv(0,cmd,31)
  329. if(equal(cmd,"+rope")) RopeAttach(id,0)
  330. if(equal(cmd,"+hook")) RopeAttach(id,1)
  331. }
  332. }
  333. }
  334. }
  335.  
  336. return PLUGIN_HANDLED
  337. }
  338.  
  339. public hook_off(id)
  340. {
  341. new steamid[32]
  342. new ip[32]
  343. new nev[32]
  344. line = 0;
  345. get_configsdir(cfg, 63);
  346. get_user_authid(id, steamid, charsmax(steamid));
  347. get_user_name(id, nev, charsmax(nev));
  348. get_user_ip(id, ip, charsmax(ip));
  349. format(cfg, 119, "%s/hook_admin.ini", cfg);
  350. if (file_exists(cfg))
  351. {
  352. while ((line = read_file(cfg, line, linetext, 256, linetextlength)))
  353. {
  354. if(linetext[0] == ';')
  355. {
  356. return PLUGIN_CONTINUE
  357. }
  358. if((equal(linetext, steamid)) || (equal(linetext, nev)) || (equal(linetext, ip)))
  359. {
  360. if (gIsHooked[id])
  361. {
  362. RopeRelease(id)
  363. }
  364. }
  365. }
  366. }
  367. return PLUGIN_HANDLED
  368. }
  369.  
  370. public RopeAttach(id,hook)
  371. {
  372. new parm[1], user_origin[3]
  373. parm[0] = id
  374. gIsHooked[id] = true
  375. get_user_origin(id,user_origin)
  376. get_user_origin(id,gHookLocation[id], 3)
  377. gHookLenght[id] = get_distance(gHookLocation[id],user_origin)
  378. global_gravity = get_cvar_num("sv_gravity")
  379. set_user_gravity(id,0.001)
  380. beamentpoint(id)
  381. emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  382. if (hook) set_task(DELTA_T, "hooktask", 200+id, parm, 1, "b")
  383. else set_task(DELTA_T, "ropetask", 200+id, parm, 1, "b")
  384. }
  385.  
  386. public RopeRelease(id)
  387. {
  388. gIsHooked[id] = false
  389. killbeam(id)
  390. set_user_gravity(id)
  391. remove_task(200+id)
  392. }
  393.  
  394. public beamentpoint(id)
  395. {
  396. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  397. write_byte( TE_BEAMENTPOINT )
  398. write_short( id )
  399. write_coord( gHookLocation[id][0] )
  400. write_coord( gHookLocation[id][1] )
  401. write_coord( gHookLocation[id][2] )
  402. write_short( beam ) // sprite index
  403. write_byte( 0 ) // start frame
  404. write_byte( 0 ) // framerate
  405. write_byte( BEAMLIFE ) // life
  406. write_byte( 10 ) // width
  407. write_byte( 0 ) // noise
  408. if (get_user_team(id)==1) // Terrorist
  409. {
  410. write_byte( 255 ) // r, g, b
  411. write_byte( 0 ) // r, g, b
  412. write_byte( 0 ) // r, g, b
  413. }
  414. else // Counter-Terrorist
  415. {
  416. write_byte( 0 ) // r, g, b
  417. write_byte( 0 ) // r, g, b
  418. write_byte( 255 ) // r, g, b
  419. }
  420. write_byte( 150 ) // brightness
  421. write_byte( 0 ) // speed
  422. message_end( )
  423. gBeamIsCreated[id] = get_gametime()
  424. }
  425.  
  426. public killbeam(id)
  427. {
  428. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  429. write_byte( TE_KILLBEAM )
  430. write_short( id )
  431. message_end()
  432. }
  433.  
  434. /************************************************************************************************************************/
  435. /******************************************************* FORWARDS *******************************************************/
  436. /************************************************************************************************************************/
  437.  
  438. public client_disconnect(id) {
  439. gAllowedHook[id]=0
  440. }
  441.  
  442. /************************************************************************************************************************/
  443. /************************************************** AMXX -> AMX funcs ***************************************************/
  444. /************************************************************************************************************************/
  445. #if USING_AMX
  446. stock get_user_button(id) return entity_get_int(id, EV_INT_button)
  447. #endif

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: hook
HozzászólásElküldve:2013.10.07. 15:34 
Offline
Jómunkásember
Avatar

Csatlakozott:2012.12.24. 13:27
Hozzászólások:447
Megköszönt másnak: 20 alkalommal
Megköszönték neki: 14 alkalommal
Bele irom a ini be a steam ID met be irom consolba hogy bind v +hook és semmi..


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [7 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 5 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole