hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [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ő


Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Miért teleportál bele a falba?!
HozzászólásElküldve: 2012.12.12. 09:45 
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
MEGOLDOTTAM!
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4.  
  5. #define VERSION "1.2"
  6.  
  7. #define MAX_DOORS 500
  8.  
  9. #define TSK_BHOP 50
  10. #define TSK_CLEAR_FAIL 100
  11.  
  12. //func_doors[x]{ id, speed, angles }
  13. new door_count = 0, func_doors[MAX_DOORS][3], Float:door_tp_pos[MAX_DOORS][3]
  14. new bhop_failid[32], bool:bhop_fail[32]
  15. new p_enabled
  16. new MAXPLAYERS
  17.  
  18. public plugin_init( )
  19. {
  20. MAXPLAYERS = get_maxplayers( )
  21.  
  22. register_plugin( "MP Bhops", VERSION, "Ian Cammarata" )
  23. register_cvar( "mpbhops_version", VERSION, FCVAR_SERVER )
  24.  
  25. p_enabled = register_cvar( "mpbhops", "0", FCVAR_SERVER )
  26. }
  27.  
  28. public pfn_keyvalue( ent )
  29. {
  30. static last_ent
  31. new class[31], key[31], val[31]
  32. copy_keyvalue( class, 30, key, 30, val, 30 )
  33.  
  34. if( ent != last_ent && func_doors[door_count][0] && door_count < MAX_DOORS )
  35. door_count++
  36.  
  37. if( equal( class, "func_door" ) )
  38. {
  39. if( ent != last_ent ) func_doors[door_count][0] = ent
  40.  
  41. if( equal( key, "speed" ) )
  42. func_doors[door_count][1] = str_to_num(val)
  43. if( equal( key, "dmg" ) )
  44. func_doors[door_count][0] = 0
  45. if( equal( key, "angles" ) )
  46. {
  47. new angles[5]
  48. parse( val, angles, 4 )
  49. func_doors[door_count][2] = str_to_num( angles )
  50. }
  51. last_ent = ent
  52. }
  53.  
  54. return PLUGIN_CONTINUE
  55. }
  56.  
  57. public plugin_cfg( )
  58. {
  59. if( func_doors[door_count][0] && door_count < MAX_DOORS )
  60. door_count++
  61.  
  62. new ent, ent2, tmpstr[33]
  63. new Float:dmins[3], Float:dmaxs[3]
  64.  
  65. //Find tp spots for doors, in case they're used for bhop
  66. for( new i = 0; i < door_count; i++ )
  67. {
  68. ent = func_doors[i][0]
  69. if( !is_valid_ent( ent ) ) func_doors[i][0] = 0
  70. else
  71. {
  72. entity_get_vector( ent, EV_VEC_mins, dmins )
  73. entity_get_vector( ent, EV_VEC_maxs, dmaxs )
  74.  
  75. new dwid = floatround( dmaxs[0] - dmins[0] )
  76. new dlen = floatround( dmaxs[1] - dmins[1] )
  77.  
  78. //If the door moves up, or is thin, remove it's id from the array
  79. if( func_doors[i][2] < 0 || dwid < 24 || dlen < 24 )
  80. func_doors[i][0] = 0
  81. //Otherwise find a safe tp spot in case it's a bhop door
  82. else
  83. {
  84. //If it has a targetname, change the id in array to targeter
  85. entity_get_string( ent, EV_SZ_targetname, tmpstr, 32 )
  86. if( strlen( tmpstr ) )
  87. {
  88. ent2 = find_ent_by_target( -1, tmpstr )
  89. if( ent2 )
  90. {
  91. func_doors[i][0] = ent2
  92.  
  93. //If targeter is a button, remove it's id from the array
  94. entity_get_string( ent2, EV_SZ_classname, tmpstr, 32 )
  95. if( equal( tmpstr, "func_button" ) )
  96. func_doors[i][0] = 0
  97. }
  98. }
  99.  
  100. new Float:tmpvec[3], Float:tmpvec2[3]
  101.  
  102. new Float:dr_tc[3]
  103. dr_tc[0] = ( dmaxs[0] + dmins[0] ) / 2
  104. dr_tc[1] = ( dmaxs[1] + dmins[1] ) / 2
  105. dr_tc[2] = dmaxs[2]
  106.  
  107. tmpvec[0] = ( dmaxs[0] + dmins[0] ) / 2
  108. tmpvec[1] = dmaxs[1] + 20
  109. tmpvec[2] = dmaxs[2] + 20
  110. trace_line( ent, dr_tc, tmpvec, tmpvec2 )
  111. if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] )
  112. door_tp_pos[i] = tmpvec
  113. else
  114. {
  115. tmpvec[1] = dmins[1] - 20
  116. trace_line( ent, dr_tc, tmpvec, tmpvec2 )
  117. if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] )
  118. door_tp_pos[i] = tmpvec
  119. else
  120. {
  121. tmpvec[0] = dmaxs[0] + 20
  122. tmpvec[1] = ( dmaxs[1] + dmins[1] ) / 2
  123. trace_line( ent, dr_tc, tmpvec, tmpvec2 )
  124. if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] )
  125. door_tp_pos[i] = tmpvec
  126. else
  127. {
  128. tmpvec[0] = dmins[0] - 20
  129. door_tp_pos[i] = tmpvec
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137.  
  138. //This is a semiclip fix
  139. public client_PreThink( id )
  140. {
  141. //If they're on the ground and not solid...
  142. if( ( pev( id, pev_flags ) & FL_ONGROUND ) && !pev( id, pev_solid ) )
  143. {
  144. new Float:orig[3]
  145. entity_get_vector( id, EV_VEC_origin, orig )
  146.  
  147. //do a hull trace 1 unit below their origin
  148. orig[2] -= 1
  149. engfunc( EngFunc_TraceHull, orig, orig, DONT_IGNORE_MONSTERS, HULL_HUMAN, id, 0 )
  150. new ent = get_tr2( 0, TR_pHit )
  151.  
  152. //if all we hit is world or another player, who cares, exit
  153. if( ent <= MAXPLAYERS ) return PLUGIN_CONTINUE
  154.  
  155. //if we hit a door in the array, send it to the handler then exit
  156. new dpos = door_in_array( ent )
  157. if( dpos > -1 )
  158. {
  159. bhop_check_fail( id, ent, dpos )
  160. return PLUGIN_CONTINUE
  161. }
  162.  
  163. //if we hit a BCM entity, force touch so the BCM plugin can handle it
  164. new class[32]
  165. entity_get_string( ent, EV_SZ_classname, class, 31 )
  166. if( equal( class, "bcm" ) || equal( class, "bm_block" ) )
  167. fake_touch( ent, id )
  168. }
  169.  
  170. return PLUGIN_CONTINUE
  171. }
  172.  
  173. public pfn_touch( ent, id )
  174. {
  175. if( !get_pcvar_num( p_enabled ) || !ent || !id )
  176. return PLUGIN_CONTINUE
  177.  
  178. //Make sure id is player and ent is object
  179. if( 0 < ent <= MAXPLAYERS )
  180. {
  181. new tmp = id
  182. id = ent
  183. ent = tmp
  184. }
  185. else if( !( 0 < id <= MAXPLAYERS ) )
  186. return PLUGIN_CONTINUE
  187.  
  188. //Bhop stuff
  189. new dpos = door_in_array( ent )
  190. if( dpos > -1 )
  191. {
  192. bhop_check_fail( id, ent, dpos )
  193. return PLUGIN_HANDLED
  194. }
  195.  
  196. return PLUGIN_CONTINUE
  197. }
  198.  
  199. public bhop_check_fail( id, ent, dpos )
  200. {
  201. if( bhop_failid[id-1] != ent )
  202. {
  203. bhop_failid[id-1] = ent
  204. bhop_fail[id-1] = false
  205.  
  206. new tskid = TSK_BHOP + id
  207. if( task_exists( tskid ) )
  208. remove_task( tskid )
  209. set_task( 0.2, "bhop_set_fail", tskid )
  210. tskid = TSK_CLEAR_FAIL + id
  211. if( task_exists( tskid ) )
  212. remove_task( tskid )
  213. set_task( 0.7, "bhop_clear_fail", tskid )
  214. }
  215. else if( bhop_fail[id-1] )
  216. {
  217. //Teleport to fail position
  218. entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} )
  219. entity_set_vector( id, EV_VEC_origin, door_tp_pos[dpos] )
  220.  
  221. //Reset fail vars
  222. bhop_failid[id-1] = 0
  223. bhop_fail[id-1] = false
  224. }
  225. }
  226.  
  227. public door_in_array( door )
  228. {
  229. for( new i = 0; i < door_count; i++ )
  230. if( func_doors[i][0] == door )
  231. return i
  232. return -1
  233. }
  234.  
  235. public bhop_set_fail( tskid )
  236. {
  237. bhop_fail[ tskid - TSK_BHOP - 1 ] = true
  238. return PLUGIN_HANDLED
  239. }
  240.  
  241. public bhop_clear_fail( tskid )
  242. {
  243. new id = tskid - TSK_CLEAR_FAIL
  244. bhop_failid[id-1] = 0
  245. bhop_fail[id-1] = false
  246. return PLUGIN_HANDLED
  247. }

_________________
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  
Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 1 hozzászólás ] 


Ki van itt

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


Nem nyithatsz témákat ebben a fórumban.
Nem 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