hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.06.16. 14:29



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Hook
HozzászólásElküldve: 2013.04.24. 20:36 
Offline
Tud valamit

Csatlakozott: 2013.03.02. 17:41
Hozzászólások: 124
Megköszönt másnak: 31 alkalommal
Helló!

A problémám az, hogy a szerveremrr tettem fel mapokat és azokon nem működik a hook nem lehet falhoz/földhöz hookolni magam (ilyen map pl.: 35hp_2) alap pályákon működik (pl.: de_dust2)... :( rákérdeztem a hfg konfigosainál, ők azt mondták h olyan elemekből épül fel a pálya amit a hook nem fog... Nos én kipróbáltam ugyan ezeket a mapokat más szolgáltatónál (sunwell) és ott működik! mi lehet a próbléma?? Ha valaki tud legyen szíves segítsen! :)

Ui.: A szervert nem reklámozni akarom, csak nem tudom hova írjam! :S


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.04.24. 20:42 
Offline
Félisten
Avatar

Csatlakozott: 2013.03.12. 10:03
Hozzászólások: 859
Megköszönt másnak: 37 alkalommal
Megköszönték neki: 44 alkalommal
Próbáld meg evvel :)
Am Meg Édes Anyukám egy Anyuka :)


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.  
  49. /************************************************************************************************************************/
  50. public plugin_init() //Called on plugin start
  51. {
  52. // Plugin Info
  53. register_plugin("Admin Hook","1.0","AssKicR")
  54.  
  55. //CVARS
  56. register_cvar("sv_adminhook", "1" )
  57.  
  58. //ADMIN CMDS
  59. register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<authid, nick, @team, @all or #userid> <on/off>")
  60.  
  61. //USER COMMANDS
  62. register_clcmd("+rope", "hook_on",ADMIN_LEVEL_E)
  63. register_clcmd("-rope", "hook_off",ADMIN_LEVEL_E)
  64. register_clcmd("+hook", "hook_on",ADMIN_LEVEL_E)
  65. register_clcmd("-hook", "hook_off",ADMIN_LEVEL_E)
  66.  
  67. //HOOKED EVENTS
  68. register_event("ResetHUD", "ResetHUD", "b")
  69. }
  70. /************************************************************************************************************************/
  71. public plugin_precache()
  72. {
  73. beam = precache_model("sprites/zbeam4.spr")
  74. precache_sound("weapons/xbow_hit2.wav")
  75. }
  76. /*************************************************************************************************************************/
  77. /************************************************** USP/SCOUT REMOVE *****************************************************/
  78. /*************************************************************************************************************************/
  79.  
  80. /*************************************************************************************************************************/
  81. /**************************************************** HOOKED EVENTS ******************************************************/
  82. /*************************************************************************************************************************/
  83. public ResetHUD(id) {
  84. //Check if he is hooked to something
  85. if (gIsHooked[id]) RopeRelease(id)
  86. }
  87. /************************************************************************************************************************/
  88. stock kz_velocity_set(id,vel[3]) {
  89. //Set Their Velocity to 0 so that they they fall straight down from
  90. new Float:Ivel[3]
  91. Ivel[0]=float(vel[0])
  92. Ivel[1]=float(vel[1])
  93. Ivel[2]=float(vel[2])
  94. entity_set_vector(id, EV_VEC_velocity, Ivel)
  95. }
  96.  
  97. stock kz_velocity_get(id,vel[3]) {
  98. //Set Their Velocity to 0 so that they they fall straight down from
  99. new Float:Ivel[3]
  100.  
  101. entity_get_vector(id, EV_VEC_velocity, Ivel)
  102. vel[0]=floatround(Ivel[0])
  103. vel[1]=floatround(Ivel[1])
  104. vel[2]=floatround(Ivel[2])
  105. }
  106.  
  107. /************************************************************************************************************************/
  108. /**************************************************** ADMIN COMMANDS ****************************************************/
  109. /************************************************************************************************************************/
  110. public AdminGrantHook(id,level,cid)
  111. {
  112. if ( !cmd_access(id,level,cid,1) )
  113. return PLUGIN_HANDLED
  114.  
  115. new arg1[32],arg2[32]
  116. read_argv(1,arg1,31)
  117. read_argv(2,arg2,31)
  118. new onoff = str_to_num(arg2)
  119.  
  120. if ( equali(arg1,"@all") )
  121. {
  122. new plist[32],pnum
  123. get_players(plist,pnum,"a")
  124. if (pnum==0)
  125. {
  126. console_print(id,"[%s] There are no clients",gModName)
  127. return PLUGIN_HANDLED
  128. }
  129. for (new i=0; i<pnum; i++) {
  130. gAllowedHook[plist[i]]=onoff
  131. if (gIsHooked[plist[i]]==true && onoff==0)
  132. {
  133. RopeRelease(plist[i])
  134. }
  135. }
  136.  
  137. console_print(id,"[%s] %s all players access to hook/rope",gModName,onoff ? "Gave":"Removed")
  138. }
  139. else if ( arg1[0]=='@' )
  140. {
  141. new plist[32],pnum
  142. get_players(plist,pnum,"ae",arg1[1])
  143. if ( pnum==0 )
  144. {
  145. console_print(id,"[%s] No clients in such team",gModName)
  146. return PLUGIN_HANDLED
  147. }
  148. for (new i=0; i<pnum; i++) {
  149. gAllowedHook[plist[i]]=onoff
  150. if (gIsHooked[plist[i]]==true && onoff==0)
  151. {
  152. RopeRelease(plist[i])
  153. }
  154. }
  155. console_print(id,"[%s] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
  156. }
  157. else
  158. {
  159. new pName[32]
  160. new player = cmd_target(id,arg1,6)
  161. if (!player) return PLUGIN_HANDLED
  162.  
  163. gAllowedHook[player]=onoff
  164. if (gAllowedHook[player]==0 && onoff==0)
  165. {
  166. RopeRelease(player)
  167. }
  168.  
  169.  
  170. get_user_name(player,pName,31)
  171. console_print(id,"[%s] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
  172. }
  173.  
  174. return PLUGIN_HANDLED
  175. }
  176.  
  177. /************************************************************************************************************************/
  178. /****************************************************** NINJAROPE *******************************************************/
  179. /************************************************************************************************************************/
  180.  
  181. public ropetask(parm[])
  182. {
  183. new id = parm[0]
  184. new user_origin[3], user_look[3], user_direction[3], move_direction[3]
  185. new A[3], D[3], buttonadjust[3]
  186. new acceleration, velocity_towards_A, desired_velocity_towards_A
  187. new velocity[3], null[3]
  188.  
  189. if (!is_user_alive(id))
  190. {
  191. RopeRelease(id)
  192. return
  193. }
  194.  
  195. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  196. {
  197. beamentpoint(id)
  198. }
  199.  
  200. null[0] = 0
  201. null[1] = 0
  202. null[2] = 0
  203.  
  204. get_user_origin(id, user_origin)
  205. get_user_origin(id, user_look,2)
  206. kz_velocity_get(id, velocity)
  207.  
  208. buttonadjust[0]=0
  209. buttonadjust[1]=0
  210.  
  211. if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
  212. if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
  213. if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
  214. if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
  215. if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
  216. if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
  217.  
  218. if (buttonadjust[0] || buttonadjust[1])
  219. {
  220. user_direction[0] = user_look[0] - user_origin[0]
  221. user_direction[1] = user_look[1] - user_origin[1]
  222.  
  223. move_direction[0] = buttonadjust[0]*user_direction[0] + user_direction[1]*buttonadjust[1]
  224. move_direction[1] = buttonadjust[0]*user_direction[1] - user_direction[0]*buttonadjust[1]
  225. move_direction[2] = 0
  226.  
  227. velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  228. velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  229. }
  230.  
  231. if (buttonadjust[2]) gHookLenght[id] -= floatround(buttonadjust[2] * REELSPEED * DELTA_T)
  232. if (gHookLenght[id] < 100) gHookLenght[id] = 100
  233.  
  234. A[0] = gHookLocation[id][0] - user_origin[0]
  235. A[1] = gHookLocation[id][1] - user_origin[1]
  236. A[2] = gHookLocation[id][2] - user_origin[2]
  237.  
  238. D[0] = A[0]*A[2] / get_distance(null,A)
  239. D[1] = A[1]*A[2] / get_distance(null,A)
  240. D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)
  241.  
  242. acceleration = - global_gravity * D[2] / get_distance(null,D)
  243.  
  244. velocity_towards_A = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)
  245. desired_velocity_towards_A = (get_distance(user_origin,gHookLocation[id]) - gHookLenght[id] /*- 10*/) * 4
  246.  
  247. if (get_distance(null,D)>10)
  248. {
  249. velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))
  250. velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))
  251. velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))
  252. }
  253.  
  254. velocity[0] += ((desired_velocity_towards_A - velocity_towards_A) * A[0]) / get_distance(null,A)
  255. velocity[1] += ((desired_velocity_towards_A - velocity_towards_A) * A[1]) / get_distance(null,A)
  256. velocity[2] += ((desired_velocity_towards_A - velocity_towards_A) * A[2]) / get_distance(null,A)
  257.  
  258. kz_velocity_set(id, velocity)
  259. }
  260.  
  261. public hooktask(parm[])
  262. {
  263. new id = parm[0]
  264. new velocity[3]
  265.  
  266. if ( !gIsHooked[id] ) return
  267.  
  268. new user_origin[3],oldvelocity[3]
  269. parm[0] = id
  270.  
  271. if (!is_user_alive(id))
  272. {
  273. RopeRelease(id)
  274. return
  275. }
  276.  
  277. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  278. {
  279. beamentpoint(id)
  280. }
  281.  
  282. get_user_origin(id, user_origin)
  283. kz_velocity_get(id, oldvelocity)
  284. new distance=get_distance( gHookLocation[id], user_origin )
  285. if ( distance > 10 )
  286. {
  287. velocity[0] = floatround( (gHookLocation[id][0] - user_origin[0]) * ( 2.0 * REELSPEED / distance ) )
  288. velocity[1] = floatround( (gHookLocation[id][1] - user_origin[1]) * ( 2.0 * REELSPEED / distance ) )
  289. velocity[2] = floatround( (gHookLocation[id][2] - user_origin[2]) * ( 2.0 * REELSPEED / distance ) )
  290. }
  291. else
  292. {
  293. velocity[0]=0
  294. velocity[1]=0
  295. velocity[2]=0
  296. }
  297.  
  298. kz_velocity_set(id, velocity)
  299.  
  300. }
  301.  
  302. public hook_on(id)
  303. {
  304. if (get_cvar_num("sv_adminhook")==1)
  305. {
  306. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  307. if (!gIsHooked[id] && is_user_alive(id))
  308. {
  309. new cmd[32]
  310. read_argv(0,cmd,31)
  311. if(equal(cmd,"+rope")) RopeAttach(id,0)
  312. if(equal(cmd,"+hook")) RopeAttach(id,1)
  313. }
  314. }else{
  315. client_print(id,print_chat,"[%s] Nincs elerhetoseged hozza",gModName)
  316. return PLUGIN_HANDLED
  317. }
  318. }else{
  319. client_print(id,print_chat,"[%s] Ez a parancs ki van kapcsolva",gModName)
  320. }
  321. return PLUGIN_HANDLED
  322. }
  323.  
  324. public hook_off(id)
  325. {
  326. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  327. if (gIsHooked[id])
  328. {
  329. RopeRelease(id)
  330. }
  331. }else{
  332. client_print(id,print_chat,"[%s] Nincs elerhetoseged hozza",gModName)
  333. return PLUGIN_HANDLED
  334. }
  335. return PLUGIN_HANDLED
  336. }
  337.  
  338. public RopeAttach(id,hook)
  339. {
  340. new parm[1], user_origin[3]
  341. parm[0] = id
  342. gIsHooked[id] = true
  343. get_user_origin(id,user_origin)
  344. get_user_origin(id,gHookLocation[id], 3)
  345. gHookLenght[id] = get_distance(gHookLocation[id],user_origin)
  346. global_gravity = get_cvar_num("sv_gravity")
  347. set_user_gravity(id,0.001)
  348. beamentpoint(id)
  349. emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  350. if (hook) set_task(DELTA_T, "hooktask", 200+id, parm, 1, "b")
  351. else set_task(DELTA_T, "ropetask", 200+id, parm, 1, "b")
  352. }
  353.  
  354. public RopeRelease(id)
  355. {
  356. gIsHooked[id] = false
  357. killbeam(id)
  358. set_user_gravity(id)
  359. remove_task(200+id)
  360. }
  361.  
  362. public beamentpoint(id)
  363. {
  364. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  365. write_byte( TE_BEAMENTPOINT )
  366. write_short( id )
  367. write_coord( gHookLocation[id][0] )
  368. write_coord( gHookLocation[id][1] )
  369. write_coord( gHookLocation[id][2] )
  370. write_short( beam ) // sprite index
  371. write_byte( 0 ) // start frame
  372. write_byte( 0 ) // framerate
  373. write_byte( BEAMLIFE ) // life
  374. write_byte( 10 ) // width
  375. write_byte( 0 ) // noise
  376. if (get_user_team(id)==1) // Terrorist
  377. {
  378. write_byte( 255 ) // r, g, b
  379. write_byte( 0 ) // r, g, b
  380. write_byte( 0 ) // r, g, b
  381. }
  382. else // Counter-Terrorist
  383. {
  384. write_byte( 0 ) // r, g, b
  385. write_byte( 0 ) // r, g, b
  386. write_byte( 255 ) // r, g, b
  387. }
  388. write_byte( 150 ) // brightness
  389. write_byte( 0 ) // speed
  390. message_end( )
  391. gBeamIsCreated[id] = get_gametime()
  392. }
  393.  
  394. public killbeam(id)
  395. {
  396. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  397. write_byte( TE_KILLBEAM )
  398. write_short( id )
  399. message_end()
  400. }
  401.  
  402. /************************************************************************************************************************/
  403. /******************************************************* FORWARDS *******************************************************/
  404. /************************************************************************************************************************/
  405.  
  406. public client_disconnect(id) {
  407. gAllowedHook[id]=0
  408. }
  409.  
  410. /************************************************************************************************************************/
  411. /************************************************** AMXX -> AMX funcs ***************************************************/
  412. /************************************************************************************************************************/
  413. #if USING_AMX
  414. stock get_user_button(id) return entity_get_int(id, EV_INT_button)
  415. #endif

RopeReleaseid

_________________
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.04.24. 21:00 
Offline
Veterán
Avatar

Csatlakozott: 2012.09.01. 22:19
Hozzászólások: 1697
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 302 alkalommal
Papi írta:
Próbáld meg evvel :)
Am Meg Édes Anyukám egy Anyuka :)


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.  
  49. /************************************************************************************************************************/
  50. public plugin_init() //Called on plugin start
  51. {
  52. // Plugin Info
  53. register_plugin("Admin Hook","1.0","AssKicR")
  54.  
  55. //CVARS
  56. register_cvar("sv_adminhook", "1" )
  57.  
  58. //ADMIN CMDS
  59. register_concmd("amx_granthook","AdminGrantHook",ADMIN_LEVEL_A,"<authid, nick, @team, @all or #userid> <on/off>")
  60.  
  61. //USER COMMANDS
  62. register_clcmd("+rope", "hook_on",ADMIN_LEVEL_E)
  63. register_clcmd("-rope", "hook_off",ADMIN_LEVEL_E)
  64. register_clcmd("+hook", "hook_on",ADMIN_LEVEL_E)
  65. register_clcmd("-hook", "hook_off",ADMIN_LEVEL_E)
  66.  
  67. //HOOKED EVENTS
  68. register_event("ResetHUD", "ResetHUD", "b")
  69. }
  70. /************************************************************************************************************************/
  71. public plugin_precache()
  72. {
  73. beam = precache_model("sprites/zbeam4.spr")
  74. precache_sound("weapons/xbow_hit2.wav")
  75. }
  76. /*************************************************************************************************************************/
  77. /************************************************** USP/SCOUT REMOVE *****************************************************/
  78. /*************************************************************************************************************************/
  79.  
  80. /*************************************************************************************************************************/
  81. /**************************************************** HOOKED EVENTS ******************************************************/
  82. /*************************************************************************************************************************/
  83. public ResetHUD(id) {
  84. //Check if he is hooked to something
  85. if (gIsHooked[id]) RopeRelease(id)
  86. }
  87. /************************************************************************************************************************/
  88. stock kz_velocity_set(id,vel[3]) {
  89. //Set Their Velocity to 0 so that they they fall straight down from
  90. new Float:Ivel[3]
  91. Ivel[0]=float(vel[0])
  92. Ivel[1]=float(vel[1])
  93. Ivel[2]=float(vel[2])
  94. entity_set_vector(id, EV_VEC_velocity, Ivel)
  95. }
  96.  
  97. stock kz_velocity_get(id,vel[3]) {
  98. //Set Their Velocity to 0 so that they they fall straight down from
  99. new Float:Ivel[3]
  100.  
  101. entity_get_vector(id, EV_VEC_velocity, Ivel)
  102. vel[0]=floatround(Ivel[0])
  103. vel[1]=floatround(Ivel[1])
  104. vel[2]=floatround(Ivel[2])
  105. }
  106.  
  107. /************************************************************************************************************************/
  108. /**************************************************** ADMIN COMMANDS ****************************************************/
  109. /************************************************************************************************************************/
  110. public AdminGrantHook(id,level,cid)
  111. {
  112. if ( !cmd_access(id,level,cid,1) )
  113. return PLUGIN_HANDLED
  114.  
  115. new arg1[32],arg2[32]
  116. read_argv(1,arg1,31)
  117. read_argv(2,arg2,31)
  118. new onoff = str_to_num(arg2)
  119.  
  120. if ( equali(arg1,"@all") )
  121. {
  122. new plist[32],pnum
  123. get_players(plist,pnum,"a")
  124. if (pnum==0)
  125. {
  126. console_print(id,"[%s] There are no clients",gModName)
  127. return PLUGIN_HANDLED
  128. }
  129. for (new i=0; i<pnum; i++) {
  130. gAllowedHook[plist[i]]=onoff
  131. if (gIsHooked[plist[i]]==true && onoff==0)
  132. {
  133. RopeRelease(plist[i])
  134. }
  135. }
  136.  
  137. console_print(id,"[%s] %s all players access to hook/rope",gModName,onoff ? "Gave":"Removed")
  138. }
  139. else if ( arg1[0]=='@' )
  140. {
  141. new plist[32],pnum
  142. get_players(plist,pnum,"ae",arg1[1])
  143. if ( pnum==0 )
  144. {
  145. console_print(id,"[%s] No clients in such team",gModName)
  146. return PLUGIN_HANDLED
  147. }
  148. for (new i=0; i<pnum; i++) {
  149. gAllowedHook[plist[i]]=onoff
  150. if (gIsHooked[plist[i]]==true && onoff==0)
  151. {
  152. RopeRelease(plist[i])
  153. }
  154. }
  155. console_print(id,"[%s] %s all %ss access to hook/rope",onoff ? "Gave":"Removed",arg1[1])
  156. }
  157. else
  158. {
  159. new pName[32]
  160. new player = cmd_target(id,arg1,6)
  161. if (!player) return PLUGIN_HANDLED
  162.  
  163. gAllowedHook[player]=onoff
  164. if (gAllowedHook[player]==0 && onoff==0)
  165. {
  166. RopeRelease(player)
  167. }
  168.  
  169.  
  170. get_user_name(player,pName,31)
  171. console_print(id,"[%s] %s ^"%s^" access to hook/rope",onoff ? "Gave":"Removed",pName)
  172. }
  173.  
  174. return PLUGIN_HANDLED
  175. }
  176.  
  177. /************************************************************************************************************************/
  178. /****************************************************** NINJAROPE *******************************************************/
  179. /************************************************************************************************************************/
  180.  
  181. public ropetask(parm[])
  182. {
  183. new id = parm[0]
  184. new user_origin[3], user_look[3], user_direction[3], move_direction[3]
  185. new A[3], D[3], buttonadjust[3]
  186. new acceleration, velocity_towards_A, desired_velocity_towards_A
  187. new velocity[3], null[3]
  188.  
  189. if (!is_user_alive(id))
  190. {
  191. RopeRelease(id)
  192. return
  193. }
  194.  
  195. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  196. {
  197. beamentpoint(id)
  198. }
  199.  
  200. null[0] = 0
  201. null[1] = 0
  202. null[2] = 0
  203.  
  204. get_user_origin(id, user_origin)
  205. get_user_origin(id, user_look,2)
  206. kz_velocity_get(id, velocity)
  207.  
  208. buttonadjust[0]=0
  209. buttonadjust[1]=0
  210.  
  211. if (get_user_button(id)&IN_FORWARD) buttonadjust[0]+=1
  212. if (get_user_button(id)&IN_BACK) buttonadjust[0]-=1
  213. if (get_user_button(id)&IN_MOVERIGHT) buttonadjust[1]+=1
  214. if (get_user_button(id)&IN_MOVELEFT) buttonadjust[1]-=1
  215. if (get_user_button(id)&IN_JUMP) buttonadjust[2]+=1
  216. if (get_user_button(id)&IN_DUCK) buttonadjust[2]-=1
  217.  
  218. if (buttonadjust[0] || buttonadjust[1])
  219. {
  220. user_direction[0] = user_look[0] - user_origin[0]
  221. user_direction[1] = user_look[1] - user_origin[1]
  222.  
  223. move_direction[0] = buttonadjust[0]*user_direction[0] + user_direction[1]*buttonadjust[1]
  224. move_direction[1] = buttonadjust[0]*user_direction[1] - user_direction[0]*buttonadjust[1]
  225. move_direction[2] = 0
  226.  
  227. velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  228. velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))
  229. }
  230.  
  231. if (buttonadjust[2]) gHookLenght[id] -= floatround(buttonadjust[2] * REELSPEED * DELTA_T)
  232. if (gHookLenght[id] < 100) gHookLenght[id] = 100
  233.  
  234. A[0] = gHookLocation[id][0] - user_origin[0]
  235. A[1] = gHookLocation[id][1] - user_origin[1]
  236. A[2] = gHookLocation[id][2] - user_origin[2]
  237.  
  238. D[0] = A[0]*A[2] / get_distance(null,A)
  239. D[1] = A[1]*A[2] / get_distance(null,A)
  240. D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)
  241.  
  242. acceleration = - global_gravity * D[2] / get_distance(null,D)
  243.  
  244. velocity_towards_A = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)
  245. desired_velocity_towards_A = (get_distance(user_origin,gHookLocation[id]) - gHookLenght[id] /*- 10*/) * 4
  246.  
  247. if (get_distance(null,D)>10)
  248. {
  249. velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))
  250. velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))
  251. velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))
  252. }
  253.  
  254. velocity[0] += ((desired_velocity_towards_A - velocity_towards_A) * A[0]) / get_distance(null,A)
  255. velocity[1] += ((desired_velocity_towards_A - velocity_towards_A) * A[1]) / get_distance(null,A)
  256. velocity[2] += ((desired_velocity_towards_A - velocity_towards_A) * A[2]) / get_distance(null,A)
  257.  
  258. kz_velocity_set(id, velocity)
  259. }
  260.  
  261. public hooktask(parm[])
  262. {
  263. new id = parm[0]
  264. new velocity[3]
  265.  
  266. if ( !gIsHooked[id] ) return
  267.  
  268. new user_origin[3],oldvelocity[3]
  269. parm[0] = id
  270.  
  271. if (!is_user_alive(id))
  272. {
  273. RopeRelease(id)
  274. return
  275. }
  276.  
  277. if (gBeamIsCreated[id] + BEAMLIFE/10 <= get_gametime())
  278. {
  279. beamentpoint(id)
  280. }
  281.  
  282. get_user_origin(id, user_origin)
  283. kz_velocity_get(id, oldvelocity)
  284. new distance=get_distance( gHookLocation[id], user_origin )
  285. if ( distance > 10 )
  286. {
  287. velocity[0] = floatround( (gHookLocation[id][0] - user_origin[0]) * ( 2.0 * REELSPEED / distance ) )
  288. velocity[1] = floatround( (gHookLocation[id][1] - user_origin[1]) * ( 2.0 * REELSPEED / distance ) )
  289. velocity[2] = floatround( (gHookLocation[id][2] - user_origin[2]) * ( 2.0 * REELSPEED / distance ) )
  290. }
  291. else
  292. {
  293. velocity[0]=0
  294. velocity[1]=0
  295. velocity[2]=0
  296. }
  297.  
  298. kz_velocity_set(id, velocity)
  299.  
  300. }
  301.  
  302. public hook_on(id)
  303. {
  304. if (get_cvar_num("sv_adminhook")==1)
  305. {
  306. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  307. if (!gIsHooked[id] && is_user_alive(id))
  308. {
  309. new cmd[32]
  310. read_argv(0,cmd,31)
  311. if(equal(cmd,"+rope")) RopeAttach(id,0)
  312. if(equal(cmd,"+hook")) RopeAttach(id,1)
  313. }
  314. }else{
  315. client_print(id,print_chat,"[%s] Nincs elerhetoseged hozza",gModName)
  316. return PLUGIN_HANDLED
  317. }
  318. }else{
  319. client_print(id,print_chat,"[%s] Ez a parancs ki van kapcsolva",gModName)
  320. }
  321. return PLUGIN_HANDLED
  322. }
  323.  
  324. public hook_off(id)
  325. {
  326. if (gAllowedHook[id] || (get_user_flags(id)&ADMIN_LEVEL_E)) {
  327. if (gIsHooked[id])
  328. {
  329. RopeRelease(id)
  330. }
  331. }else{
  332. client_print(id,print_chat,"[%s] Nincs elerhetoseged hozza",gModName)
  333. return PLUGIN_HANDLED
  334. }
  335. return PLUGIN_HANDLED
  336. }
  337.  
  338. public RopeAttach(id,hook)
  339. {
  340. new parm[1], user_origin[3]
  341. parm[0] = id
  342. gIsHooked[id] = true
  343. get_user_origin(id,user_origin)
  344. get_user_origin(id,gHookLocation[id], 3)
  345. gHookLenght[id] = get_distance(gHookLocation[id],user_origin)
  346. global_gravity = get_cvar_num("sv_gravity")
  347. set_user_gravity(id,0.001)
  348. beamentpoint(id)
  349. emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  350. if (hook) set_task(DELTA_T, "hooktask", 200+id, parm, 1, "b")
  351. else set_task(DELTA_T, "ropetask", 200+id, parm, 1, "b")
  352. }
  353.  
  354. public RopeRelease(id)
  355. {
  356. gIsHooked[id] = false
  357. killbeam(id)
  358. set_user_gravity(id)
  359. remove_task(200+id)
  360. }
  361.  
  362. public beamentpoint(id)
  363. {
  364. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  365. write_byte( TE_BEAMENTPOINT )
  366. write_short( id )
  367. write_coord( gHookLocation[id][0] )
  368. write_coord( gHookLocation[id][1] )
  369. write_coord( gHookLocation[id][2] )
  370. write_short( beam ) // sprite index
  371. write_byte( 0 ) // start frame
  372. write_byte( 0 ) // framerate
  373. write_byte( BEAMLIFE ) // life
  374. write_byte( 10 ) // width
  375. write_byte( 0 ) // noise
  376. if (get_user_team(id)==1) // Terrorist
  377. {
  378. write_byte( 255 ) // r, g, b
  379. write_byte( 0 ) // r, g, b
  380. write_byte( 0 ) // r, g, b
  381. }
  382. else // Counter-Terrorist
  383. {
  384. write_byte( 0 ) // r, g, b
  385. write_byte( 0 ) // r, g, b
  386. write_byte( 255 ) // r, g, b
  387. }
  388. write_byte( 150 ) // brightness
  389. write_byte( 0 ) // speed
  390. message_end( )
  391. gBeamIsCreated[id] = get_gametime()
  392. }
  393.  
  394. public killbeam(id)
  395. {
  396. message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  397. write_byte( TE_KILLBEAM )
  398. write_short( id )
  399. message_end()
  400. }
  401.  
  402. /************************************************************************************************************************/
  403. /******************************************************* FORWARDS *******************************************************/
  404. /************************************************************************************************************************/
  405.  
  406. public client_disconnect(id) {
  407. gAllowedHook[id]=0
  408. }
  409.  
  410. /************************************************************************************************************************/
  411. /************************************************** AMXX -> AMX funcs ***************************************************/
  412. /************************************************************************************************************************/
  413. #if USING_AMX
  414. stock get_user_button(id) return entity_get_int(id, EV_INT_button)
  415. #endif


semmi köze a anyukámhoz, elárulom. + velocity

_________________
Valami új kezdete...
Kép
Egyedi pluginok készítése pénzért (Banki átutalás, PayPal) -> Privát üzenet


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 111 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