hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.29. 07:52



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó 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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Hook
HozzászólásElküldve: 2014.08.23. 10:50 
Offline
Beavatott

Csatlakozott: 2014.05.23. 18:32
Hozzászólások: 68
Megköszönt másnak: 88 alkalommal
Megköszönték neki: 2 alkalommal
Láttam egy szerveren egy olyan hookot hogy más színen húzza a csíkot nem team mint t.knek piross ct.knek kék nekem egy egy színü kellene. Ha valaki megcsinálja meg a gomb
Előre is köszi.

[mozgo]Reklam tiltva sry[/mozgo]


A hozzászólást 1 alkalommal szerkesztették, utoljára DeteCT0R 2014.08.23. 11:01-kor.
Reklam...


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hook
HozzászólásElküldve: 2014.08.23. 10:58 
Offline
Félisten
Avatar

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

_________________
Kép
Pár pluginom:
LCAW Frag Bolt
S E C R E T (78%...)
KépKép

Ők köszönték meg xXlederXxHUN nek ezt a hozzászólást: spice (2014.08.23. 11:28)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Hook
HozzászólásElküldve: 2014.08.23. 16:49 
Offline
Őskövület
Avatar

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

_________________
Kép

Ők köszönték meg CrB nek ezt a hozzászólást: spice (2014.08.23. 19:08)
  Népszerűség: 2.27%


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  [ 3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 17 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