hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.27. 15:41



Jelenlévő felhasználók

Jelenleg 546 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 545 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ő


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Csak embernek
HozzászólásElküldve: 2013.01.11. 12:32 
Offline
Őstag
Avatar

Csatlakozott: 2011.11.15. 16:29
Hozzászólások: 1142
Megköszönt másnak: 8 alkalommal
Megköszönték neki: 24 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /* Copyright © 2008, ConnorMcLeod
  2.  
  3. Custom Flashligh is free software;
  4. you can redistribute it and/or modify it under the terms of the
  5. GNU General Public License as published by the Free Software Foundation.
  6.  
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11.  
  12. You should have received a copy of the GNU General Public License
  13. along with Custom Flashligh; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. /*
  19. * v0.5.4 (10.20.09)
  20. * attempt to fix the bug when you can re-activate fl when empty
  21. *
  22. * v0.5.3 (09/01/09)
  23. * -fixed little errors due to version change
  24. * -added player range check in death event
  25. *
  26. * v0.5.2 (07/23/09)
  27. * -fixed inverted teams colors
  28. *
  29. * v0.5.1 (04/04/09)
  30. * -haven't realised i can remove FM include
  31. *
  32. * v0.5.0 (04/03/09)
  33. * - use register_think instead of FM_CmdStart
  34. * - use client_PreThink instead of FM_PlayerPreThink
  35. * - use get_user_origin mode 1 and 3 instead of fakemeta stock
  36. * - replaced some FM natives+enums with amxx natives (emit_sound, write_coord)
  37. *
  38. * v0.4.0 (07/27/08)
  39. * - replaced cvars with commands
  40. * - .ini file now supports prefix/per map configs
  41. *
  42. * v0.3.1 (06/29/08)
  43. * - fixed bug when you could have seen normal flashlight
  44. *
  45. * v0.3.0 (06/21/08)
  46. *
  47. * - some code optimizations (thanks to simon logic and jim_yang)
  48. * - changes cvars flashlight_drainfreq and flashlight_chargefreq to
  49. * flashlight_fulldrain_time and flashlight_fullcharge_time
  50. * (simon logic suggestion)
  51. * - moved random colors into $CONFIGSDIR/flashlight_colors.ini
  52. *
  53. * v0.2.0
  54. * First public release
  55. */
  56.  
  57. #include <amxmodx>
  58. #include <amxmisc>
  59. #include <engine>
  60.  
  61. #define PLUGIN "Custom Flashlight"
  62. #define AUTHOR "ConnorMcLeod"
  63. #define VERSION "0.5.4"
  64.  
  65. /* **************************** CUSTOMIZATION AREA ******************************** */
  66.  
  67. new const SOUND_FLASHLIGHT_ON[] = "items/flashlight1.wav"
  68. new const SOUND_FLASHLIGHT_OFF[] = "items/flashlight1.wav"
  69.  
  70. #define LIFE 1 // try 2 if light is flickering
  71.  
  72. /* ******************************************************************************** */
  73.  
  74. #define MAX_PLAYERS 32
  75.  
  76. enum {
  77. Red,
  78. Green,
  79. Blue
  80. }
  81.  
  82. new Array:g_aColors
  83. new g_iColorsNum
  84.  
  85. new g_iMaxPlayers
  86.  
  87. new bool:g_bFlashLight[MAX_PLAYERS+1]
  88. new g_iFlashBattery[MAX_PLAYERS+1]
  89. new Float:g_flFlashLightTime[MAX_PLAYERS+1]
  90.  
  91. new g_iColor[MAX_PLAYERS+1][3]
  92. new g_iTeamColor[2][3]
  93.  
  94. new g_msgidFlashlight, g_msgidFlashBat
  95.  
  96. new g_bEnabled = true
  97. new g_iShowAll = 1
  98. new g_iColorType = 0
  99. new g_iRadius = 11
  100. new g_iAttenuation = 5
  101. new g_iDistanceMax = 2000
  102.  
  103. new Float:g_flDrain = 1.2
  104. new Float:g_flCharge = 0.2
  105.  
  106. public plugin_precache()
  107. {
  108. precache_sound(SOUND_FLASHLIGHT_ON)
  109. precache_sound(SOUND_FLASHLIGHT_OFF)
  110. }
  111.  
  112. public plugin_init()
  113. {
  114. register_plugin( PLUGIN, VERSION, AUTHOR )
  115.  
  116. register_concmd("flashlight_set", "plugin_settings", ADMIN_CFG)
  117.  
  118. register_impulse(100, "Impulse_100")
  119.  
  120. register_event("HLTV", "Event_HLTV_newround", "a", "1=0", "2=0")
  121. register_event("DeathMsg", "Event_DeathMsg", "a")
  122.  
  123. plugin_precfg()
  124. }
  125.  
  126. plugin_precfg()
  127. {
  128. g_iTeamColor[1] = {255,0,0}
  129. g_iTeamColor[0] = {0,0,255}
  130.  
  131. g_msgidFlashlight = get_user_msgid("Flashlight")
  132. g_msgidFlashBat = get_user_msgid("FlashBat")
  133.  
  134. g_iMaxPlayers = get_maxplayers()
  135.  
  136. new szConfigFile[128], szCurMap[64], szConfigDir[128], i, szTemp[128]
  137.  
  138. get_localinfo("amxx_configsdir", szConfigDir, charsmax(szConfigDir))
  139. formatex(szConfigFile, 127, "%s/flashlight_colors.ini", szConfigDir)
  140. get_mapname(szCurMap, 63)
  141.  
  142. while(szCurMap[i] != '_' && szCurMap[i++] != '^0') {/*do nothing*/}
  143.  
  144. if (szCurMap[i]=='_')
  145. {
  146. // this map has a prefix
  147. szCurMap[i]='^0';
  148. formatex(szTemp, 127, "%s/flashlight/prefix_%s.ini", szConfigDir, szCurMap)
  149. if(file_exists(szTemp))
  150. {
  151. copy(szConfigFile, 127, szTemp)
  152. }
  153. }
  154.  
  155. get_mapname(szCurMap, 63)
  156. formatex(szTemp, 127, "%s/flashlight/%s.ini", szConfigDir, szCurMap)
  157. if (file_exists(szTemp))
  158. {
  159. copy(szConfigFile, 127, szTemp)
  160. }
  161.  
  162. new iFile = fopen(szConfigFile, "rt")
  163. if(!iFile)
  164. {
  165. return
  166. }
  167.  
  168. g_aColors = ArrayCreate(3)
  169.  
  170. new szColors[12], szRed[4], szGreen[4], szBlue[4], iColor[3]
  171. while(!feof(iFile))
  172. {
  173. fgets(iFile, szColors, 11)
  174. trim(szColors)
  175. if(!szColors[0] || szColors[0] == ';' || (szColors[0] == '/' && szColors[1] == '/'))
  176. continue
  177. parse(szColors, szRed, 3, szGreen, 3, szBlue, 3)
  178. iColor[Red] = str_to_num(szRed)
  179. iColor[Green] = str_to_num(szGreen)
  180. iColor[Blue] = str_to_num(szBlue)
  181. ArrayPushArray(g_aColors, iColor)
  182. }
  183. fclose(iFile)
  184.  
  185. g_iColorsNum = ArraySize(g_aColors)
  186. }
  187.  
  188. public plugin_settings(id, level, cid)
  189. {
  190. if( !cmd_access(id, level, cid, 3) )
  191. {
  192. return PLUGIN_HANDLED
  193. }
  194.  
  195. new szCommand[8], szValue[10]
  196. read_argv(1, szCommand, 7)
  197. read_argv(2, szValue, 9)
  198. switch( szCommand[0] )
  199. {
  200. case 'a': g_iAttenuation = str_to_num(szValue)
  201. case 'c':
  202. {
  203. switch( szCommand[5] )
  204. {
  205. case 'c':
  206. {
  207. new iColor
  208. iColor = str_to_num(szValue)
  209. g_iTeamColor[0][Red] = (iColor / 1000000)
  210. iColor %= 1000000
  211. g_iTeamColor[0][Green] = (iColor / 1000)
  212. g_iTeamColor[0][Blue] = (iColor % 1000)
  213. }
  214. case 'e': g_flCharge = str_to_float(szValue) / 100
  215. case 'm': g_bEnabled = str_to_num(szValue)
  216. case 't':
  217. {
  218. if( szCommand[6] == 'e' )
  219. {
  220. new iColor
  221. iColor = str_to_num(szValue)
  222. g_iTeamColor[1][Red] = (iColor / 1000000)
  223. iColor %= 1000000
  224. g_iTeamColor[1][Green] = (iColor / 1000)
  225. g_iTeamColor[1][Blue] = (iColor % 1000)
  226. }
  227. else
  228. {
  229. g_iColorType = str_to_num(szValue)
  230. }
  231. }
  232. }
  233. }
  234. case 'd':
  235. {
  236. if( szCommand[1] == 'i' )
  237. {
  238. g_iDistanceMax = str_to_num(szValue)
  239. }
  240. else
  241. {
  242. g_flDrain = str_to_float(szValue) / 100
  243. }
  244. }
  245. case 'r': g_iRadius = str_to_num(szValue)
  246. case 's': g_iShowAll = str_to_num(szValue)
  247. }
  248. return PLUGIN_HANDLED
  249. }
  250.  
  251. public client_putinserver(id)
  252. {
  253. reset(id)
  254. }
  255.  
  256. public Event_HLTV_newround()
  257. {
  258. for(new id=1; id<=g_iMaxPlayers; id++)
  259. {
  260. reset(id)
  261. }
  262. }
  263.  
  264. public Event_DeathMsg()
  265. {
  266. reset(read_data(2))
  267. }
  268.  
  269. reset(id)
  270. {
  271. if( 1 <= id <= g_iMaxPlayers )
  272. {
  273. g_iFlashBattery[id] = 100
  274. g_bFlashLight[id] = false
  275. g_flFlashLightTime[id] = 0.0
  276. }
  277. }
  278.  
  279. public Impulse_100( id )
  280. {
  281. if( g_bEnabled )
  282. {
  283. if(is_user_alive(id))
  284. {
  285. if( g_bFlashLight[id] )
  286. {
  287. FlashlightTurnOff(id)
  288. }
  289. else if( g_iFlashBattery[id] )
  290. {
  291. FlashlightTurnOn(id)
  292. }
  293. }
  294. return PLUGIN_HANDLED_MAIN
  295. }
  296. return PLUGIN_CONTINUE
  297. }
  298.  
  299. public client_PreThink(id)
  300. {
  301. static Float:flTime
  302. flTime = get_gametime()
  303.  
  304. if(g_flDrain && g_flFlashLightTime[id] && g_flFlashLightTime[id] <= flTime)
  305. {
  306. if(g_bFlashLight[id])
  307. {
  308. if(g_iFlashBattery[id])
  309. {
  310. g_flFlashLightTime[id] = g_flDrain + flTime
  311. g_iFlashBattery[id]--
  312.  
  313. if(!g_iFlashBattery[id])
  314. {
  315. FlashlightTurnOff(id)
  316. }
  317. }
  318. }
  319. else
  320. {
  321. if(g_iFlashBattery[id] < 100)
  322. {
  323. g_flFlashLightTime[id] = g_flCharge + flTime
  324. g_iFlashBattery[id]++
  325. }
  326. else
  327. g_flFlashLightTime[id] = 0.0
  328. }
  329.  
  330. message_begin(MSG_ONE_UNRELIABLE, g_msgidFlashBat, _, id)
  331. write_byte(g_iFlashBattery[id])
  332. message_end()
  333.  
  334. }
  335. if(g_bFlashLight[id])
  336. {
  337. Make_FlashLight(id)
  338. }
  339. }
  340.  
  341. Make_FlashLight(id)
  342. {
  343. static iOrigin[3], iAim[3], iDist
  344. get_user_origin(id, iOrigin, 1)
  345. get_user_origin(id, iAim, 3)
  346.  
  347. iDist = get_distance(iOrigin, iAim)
  348.  
  349. if( iDist > g_iDistanceMax )
  350. return
  351.  
  352. static iDecay, iAttn
  353.  
  354. iDecay = iDist * 255 / g_iDistanceMax
  355. iAttn = 256 + iDecay * g_iAttenuation // barney/dontaskme
  356.  
  357. if( g_iShowAll )
  358. {
  359. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  360. }
  361. else
  362. {
  363. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
  364. }
  365. write_byte( TE_DLIGHT )
  366. write_coord( iAim[0] )
  367. write_coord( iAim[1] )
  368. write_coord( iAim[2] )
  369. write_byte( g_iRadius )
  370. write_byte( (g_iColor[id][Red]<<8) / iAttn )
  371. write_byte( (g_iColor[id][Green]<<8) / iAttn )
  372. write_byte( (g_iColor[id][Blue]<<8) / iAttn )
  373. write_byte( LIFE )
  374. write_byte( iDecay )
  375. message_end()
  376. }
  377.  
  378. FlashlightTurnOff(id)
  379. {
  380. emit_sound(id, CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  381.  
  382. g_bFlashLight[id] = false
  383.  
  384. FlashlightHudDraw(id, 0)
  385.  
  386. g_flFlashLightTime[id] = g_flCharge + get_gametime()
  387. }
  388.  
  389. FlashlightTurnOn(id)
  390. {
  391. emit_sound(id, CHAN_WEAPON, SOUND_FLASHLIGHT_ON, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  392.  
  393. g_bFlashLight[id] = true
  394.  
  395. FlashlightHudDraw(id, 1)
  396.  
  397. if( g_iColorType || !g_iColorsNum )
  398. {
  399. g_iColor[id] = g_iTeamColor[2-get_user_team(id)]
  400. }
  401. else
  402. {
  403. ArrayGetArray(g_aColors, random(g_iColorsNum), g_iColor[id])
  404. }
  405.  
  406. g_flFlashLightTime[id] = g_flDrain + get_gametime()
  407. }
  408.  
  409. FlashlightHudDraw(id, iFlag)
  410. {
  411. if( g_iShowAll )
  412. {
  413. emessage_begin(MSG_ONE_UNRELIABLE, g_msgidFlashlight, _, id)
  414. ewrite_byte(iFlag)
  415. ewrite_byte(g_iFlashBattery[id])
  416. emessage_end()
  417. }
  418. else
  419. {
  420. message_begin(MSG_ONE_UNRELIABLE, g_msgidFlashlight, _, id)
  421. write_byte(iFlag)
  422. write_byte(g_iFlashBattery[id])
  423. message_end()
  424. }
  425. }


Hogy lehetne megoldani , hogy csak ember használhassa, tehát zm ne tudja bekapcsolni !
Ha embernél bevan kapcsolva, és átváltozik zm-re ki birja kapcsolni de be már ne (!?)

_________________
[url=http://www.gametracker.com/server_info/188.227.227.114:27286/][img]http://cache.www.gametracker.com/server_info/188.227.227.114:27286/b_350_20_323957_202743_F19A15_111111.png[/img][/url]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak embernek
HozzászólásElküldve: 2013.01.11. 13:52 
Offline
Félisten

Csatlakozott: 2012.01.07. 21:10
Hozzászólások: 850
Megköszönt másnak: 9 alkalommal
Megköszönték neki: 154 alkalommal
Próbáld ki:
SMA Forráskód: [ Mindet kijelol ]
  1. /* Copyright © 2008, ConnorMcLeod
  2.  
  3. Custom Flashligh is free software;
  4. you can redistribute it and/or modify it under the terms of the
  5. GNU General Public License as published by the Free Software Foundation.
  6.  
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11.  
  12. You should have received a copy of the GNU General Public License
  13. along with Custom Flashligh; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. /*
  19. * v0.5.4 (10.20.09)
  20. * attempt to fix the bug when you can re-activate fl when empty
  21. *
  22. * v0.5.3 (09/01/09)
  23. * -fixed little errors due to version change
  24. * -added player range check in death event
  25. *
  26. * v0.5.2 (07/23/09)
  27. * -fixed inverted teams colors
  28. *
  29. * v0.5.1 (04/04/09)
  30. * -haven't realised i can remove FM include
  31. *
  32. * v0.5.0 (04/03/09)
  33. * - use register_think instead of FM_CmdStart
  34. * - use client_PreThink instead of FM_PlayerPreThink
  35. * - use get_user_origin mode 1 and 3 instead of fakemeta stock
  36. * - replaced some FM natives+enums with amxx natives (emit_sound, write_coord)
  37. *
  38. * v0.4.0 (07/27/08)
  39. * - replaced cvars with commands
  40. * - .ini file now supports prefix/per map configs
  41. *
  42. * v0.3.1 (06/29/08)
  43. * - fixed bug when you could have seen normal flashlight
  44. *
  45. * v0.3.0 (06/21/08)
  46. *
  47. * - some code optimizations (thanks to simon logic and jim_yang)
  48. * - changes cvars flashlight_drainfreq and flashlight_chargefreq to
  49. * flashlight_fulldrain_time and flashlight_fullcharge_time
  50. * (simon logic suggestion)
  51. * - moved random colors into $CONFIGSDIR/flashlight_colors.ini
  52. *
  53. * v0.2.0
  54. * First public release
  55. */
  56.  
  57. #include <amxmodx>
  58. #include <amxmisc>
  59. #include <engine>
  60. #include <zombieplague>
  61.  
  62. #define PLUGIN "Custom Flashlight"
  63. #define AUTHOR "ConnorMcLeod"
  64. #define VERSION "0.5.4"
  65.  
  66. /* **************************** CUSTOMIZATION AREA ******************************** */
  67.  
  68. new const SOUND_FLASHLIGHT_ON[] = "items/flashlight1.wav"
  69. new const SOUND_FLASHLIGHT_OFF[] = "items/flashlight1.wav"
  70.  
  71. #define LIFE 1 // try 2 if light is flickering
  72.  
  73. /* ******************************************************************************** */
  74.  
  75. #define MAX_PLAYERS 32
  76.  
  77. enum {
  78. Red,
  79. Green,
  80. Blue
  81. }
  82.  
  83. new Array:g_aColors
  84. new g_iColorsNum
  85.  
  86. new g_iMaxPlayers
  87.  
  88. new bool:g_bFlashLight[MAX_PLAYERS+1]
  89. new g_iFlashBattery[MAX_PLAYERS+1]
  90. new Float:g_flFlashLightTime[MAX_PLAYERS+1]
  91.  
  92. new g_iColor[MAX_PLAYERS+1][3]
  93. new g_iTeamColor[2][3]
  94.  
  95. new g_msgidFlashlight, g_msgidFlashBat
  96.  
  97. new g_bEnabled = true
  98. new g_iShowAll = 1
  99. new g_iColorType = 0
  100. new g_iRadius = 11
  101. new g_iAttenuation = 5
  102. new g_iDistanceMax = 2000
  103.  
  104. new Float:g_flDrain = 1.2
  105. new Float:g_flCharge = 0.2
  106.  
  107. public plugin_precache()
  108. {
  109. precache_sound(SOUND_FLASHLIGHT_ON)
  110. precache_sound(SOUND_FLASHLIGHT_OFF)
  111. }
  112.  
  113. public plugin_init()
  114. {
  115. register_plugin( PLUGIN, VERSION, AUTHOR )
  116.  
  117. register_concmd("flashlight_set", "plugin_settings", ADMIN_CFG)
  118.  
  119. register_impulse(100, "Impulse_100")
  120.  
  121. register_event("HLTV", "Event_HLTV_newround", "a", "1=0", "2=0")
  122. register_event("DeathMsg", "Event_DeathMsg", "a")
  123.  
  124. plugin_precfg()
  125. }
  126.  
  127. plugin_precfg()
  128. {
  129. g_iTeamColor[1] = {255,0,0}
  130. g_iTeamColor[0] = {0,0,255}
  131.  
  132. g_msgidFlashlight = get_user_msgid("Flashlight")
  133. g_msgidFlashBat = get_user_msgid("FlashBat")
  134.  
  135. g_iMaxPlayers = get_maxplayers()
  136.  
  137. new szConfigFile[128], szCurMap[64], szConfigDir[128], i, szTemp[128]
  138.  
  139. get_localinfo("amxx_configsdir", szConfigDir, charsmax(szConfigDir))
  140. formatex(szConfigFile, 127, "%s/flashlight_colors.ini", szConfigDir)
  141. get_mapname(szCurMap, 63)
  142.  
  143. while(szCurMap[i] != '_' && szCurMap[i++] != '^0') {/*do nothing*/}
  144.  
  145. if (szCurMap[i]=='_')
  146. {
  147. // this map has a prefix
  148. szCurMap[i]='^0';
  149. formatex(szTemp, 127, "%s/flashlight/prefix_%s.ini", szConfigDir, szCurMap)
  150. if(file_exists(szTemp))
  151. {
  152. copy(szConfigFile, 127, szTemp)
  153. }
  154. }
  155.  
  156. get_mapname(szCurMap, 63)
  157. formatex(szTemp, 127, "%s/flashlight/%s.ini", szConfigDir, szCurMap)
  158. if (file_exists(szTemp))
  159. {
  160. copy(szConfigFile, 127, szTemp)
  161. }
  162.  
  163. new iFile = fopen(szConfigFile, "rt")
  164. if(!iFile)
  165. {
  166. return
  167. }
  168.  
  169. g_aColors = ArrayCreate(3)
  170.  
  171. new szColors[12], szRed[4], szGreen[4], szBlue[4], iColor[3]
  172. while(!feof(iFile))
  173. {
  174. fgets(iFile, szColors, 11)
  175. trim(szColors)
  176. if(!szColors[0] || szColors[0] == ';' || (szColors[0] == '/' && szColors[1] == '/'))
  177. continue
  178. parse(szColors, szRed, 3, szGreen, 3, szBlue, 3)
  179. iColor[Red] = str_to_num(szRed)
  180. iColor[Green] = str_to_num(szGreen)
  181. iColor[Blue] = str_to_num(szBlue)
  182. ArrayPushArray(g_aColors, iColor)
  183. }
  184. fclose(iFile)
  185.  
  186. g_iColorsNum = ArraySize(g_aColors)
  187. }
  188.  
  189. public plugin_settings(id, level, cid)
  190. {
  191. if( !cmd_access(id, level, cid, 3) )
  192. {
  193. return PLUGIN_HANDLED
  194. }
  195.  
  196. new szCommand[8], szValue[10]
  197. read_argv(1, szCommand, 7)
  198. read_argv(2, szValue, 9)
  199. switch( szCommand[0] )
  200. {
  201. case 'a': g_iAttenuation = str_to_num(szValue)
  202. case 'c':
  203. {
  204. switch( szCommand[5] )
  205. {
  206. case 'c':
  207. {
  208. new iColor
  209. iColor = str_to_num(szValue)
  210. g_iTeamColor[0][Red] = (iColor / 1000000)
  211. iColor %= 1000000
  212. g_iTeamColor[0][Green] = (iColor / 1000)
  213. g_iTeamColor[0][Blue] = (iColor % 1000)
  214. }
  215. case 'e': g_flCharge = str_to_float(szValue) / 100
  216. case 'm': g_bEnabled = str_to_num(szValue)
  217. case 't':
  218. {
  219. if( szCommand[6] == 'e' )
  220. {
  221. new iColor
  222. iColor = str_to_num(szValue)
  223. g_iTeamColor[1][Red] = (iColor / 1000000)
  224. iColor %= 1000000
  225. g_iTeamColor[1][Green] = (iColor / 1000)
  226. g_iTeamColor[1][Blue] = (iColor % 1000)
  227. }
  228. else
  229. {
  230. g_iColorType = str_to_num(szValue)
  231. }
  232. }
  233. }
  234. }
  235. case 'd':
  236. {
  237. if( szCommand[1] == 'i' )
  238. {
  239. g_iDistanceMax = str_to_num(szValue)
  240. }
  241. else
  242. {
  243. g_flDrain = str_to_float(szValue) / 100
  244. }
  245. }
  246. case 'r': g_iRadius = str_to_num(szValue)
  247. case 's': g_iShowAll = str_to_num(szValue)
  248. }
  249. return PLUGIN_HANDLED
  250. }
  251.  
  252. public client_putinserver(id)
  253. {
  254. reset(id)
  255. }
  256.  
  257. public Event_HLTV_newround()
  258. {
  259. for(new id=1; id<=g_iMaxPlayers; id++)
  260. {
  261. reset(id)
  262. }
  263. }
  264.  
  265. public Event_DeathMsg()
  266. {
  267. reset(read_data(2))
  268. }
  269.  
  270. reset(id)
  271. {
  272. if( 1 <= id <= g_iMaxPlayers )
  273. {
  274. g_iFlashBattery[id] = 100
  275. g_bFlashLight[id] = false
  276. g_flFlashLightTime[id] = 0.0
  277. }
  278. }
  279.  
  280. public Impulse_100( id )
  281. {
  282. if( g_bEnabled )
  283. {
  284. if(is_user_alive(id))
  285. {
  286. if( g_bFlashLight[id] )
  287. {
  288. FlashlightTurnOff(id)
  289. }
  290. else if( g_iFlashBattery[id] && !zp_get_user_zombie(id) )
  291. {
  292. FlashlightTurnOn(id)
  293. }
  294. }
  295. return PLUGIN_HANDLED_MAIN
  296. }
  297. return PLUGIN_CONTINUE
  298. }
  299.  
  300. public client_PreThink(id)
  301. {
  302. static Float:flTime
  303. flTime = get_gametime()
  304.  
  305. if(g_flDrain && g_flFlashLightTime[id] && g_flFlashLightTime[id] <= flTime)
  306. {
  307. if(g_bFlashLight[id])
  308. {
  309. if(g_iFlashBattery[id])
  310. {
  311. g_flFlashLightTime[id] = g_flDrain + flTime
  312. g_iFlashBattery[id]--
  313.  
  314. if(!g_iFlashBattery[id])
  315. {
  316. FlashlightTurnOff(id)
  317. }
  318. }
  319. }
  320. else
  321. {
  322. if(g_iFlashBattery[id] < 100)
  323. {
  324. g_flFlashLightTime[id] = g_flCharge + flTime
  325. g_iFlashBattery[id]++
  326. }
  327. else
  328. g_flFlashLightTime[id] = 0.0
  329. }
  330.  
  331. message_begin(MSG_ONE_UNRELIABLE, g_msgidFlashBat, _, id)
  332. write_byte(g_iFlashBattery[id])
  333. message_end()
  334.  
  335. }
  336. if(g_bFlashLight[id])
  337. {
  338. Make_FlashLight(id)
  339. }
  340. }
  341.  
  342. Make_FlashLight(id)
  343. {
  344. static iOrigin[3], iAim[3], iDist
  345. get_user_origin(id, iOrigin, 1)
  346. get_user_origin(id, iAim, 3)
  347.  
  348. iDist = get_distance(iOrigin, iAim)
  349.  
  350. if( iDist > g_iDistanceMax )
  351. return
  352.  
  353. static iDecay, iAttn
  354.  
  355. iDecay = iDist * 255 / g_iDistanceMax
  356. iAttn = 256 + iDecay * g_iAttenuation // barney/dontaskme
  357.  
  358. if( g_iShowAll )
  359. {
  360. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  361. }
  362. else
  363. {
  364. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
  365. }
  366. write_byte( TE_DLIGHT )
  367. write_coord( iAim[0] )
  368. write_coord( iAim[1] )
  369. write_coord( iAim[2] )
  370. write_byte( g_iRadius )
  371. write_byte( (g_iColor[id][Red]<<8) / iAttn )
  372. write_byte( (g_iColor[id][Green]<<8) / iAttn )
  373. write_byte( (g_iColor[id][Blue]<<8) / iAttn )
  374. write_byte( LIFE )
  375. write_byte( iDecay )
  376. message_end()
  377. }
  378.  
  379. FlashlightTurnOff(id)
  380. {
  381. emit_sound(id, CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  382.  
  383. g_bFlashLight[id] = false
  384.  
  385. FlashlightHudDraw(id, 0)
  386.  
  387. g_flFlashLightTime[id] = g_flCharge + get_gametime()
  388. }
  389.  
  390. FlashlightTurnOn(id)
  391. {
  392. emit_sound(id, CHAN_WEAPON, SOUND_FLASHLIGHT_ON, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  393.  
  394. g_bFlashLight[id] = true
  395.  
  396. FlashlightHudDraw(id, 1)
  397.  
  398. if( g_iColorType || !g_iColorsNum )
  399. {
  400. g_iColor[id] = g_iTeamColor[2-get_user_team(id)]
  401. }
  402. else
  403. {
  404. ArrayGetArray(g_aColors, random(g_iColorsNum), g_iColor[id])
  405. }
  406.  
  407. g_flFlashLightTime[id] = g_flDrain + get_gametime()
  408. }
  409.  
  410. FlashlightHudDraw(id, iFlag)
  411. {
  412. if( g_iShowAll )
  413. {
  414. emessage_begin(MSG_ONE_UNRELIABLE, g_msgidFlashlight, _, id)
  415. ewrite_byte(iFlag)
  416. ewrite_byte(g_iFlashBattery[id])
  417. emessage_end()
  418. }
  419. else
  420. {
  421. message_begin(MSG_ONE_UNRELIABLE, g_msgidFlashlight, _, id)
  422. write_byte(iFlag)
  423. write_byte(g_iFlashBattery[id])
  424. message_end()
  425. }
  426. }
  427.  

_________________
Megköszönni nem szégyen!
Csak kattints a Kép jelre. --->

Ők köszönték meg HunGamer nek ezt a hozzászólást: GhostRyder (2013.01.11. 14:01)
  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  [ 2 hozzászólás ] 


Ki van itt

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