hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 446 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 446 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  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Ejtőernyő hiba
HozzászólásElküldve: 2015.01.21. 17:33 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.03.10. 11:42
Hozzászólások: 240
Megköszönt másnak: 52 alkalommal
Megköszönték neki: 9 alkalommal
Sziasztok!
Az alap ejtőernyő plugin Runtime ozik.
Log:
SMA Forráskód: [ Mindet kijelol ]
  1. Run time error 4: index out of bounds
  2. 13216.attach::parachute_reset (line 157)
  3. 13216.attach::death_event (line 152)


forráskód:
SMA Forráskód: [ Mindet kijelol ]
  1. /*******************************************************************************
  2.  
  3.   Parachute
  4.  
  5.   Version: 1.3
  6.   Author: KRoTaL/JTP10181
  7.  
  8.   0.1 Release
  9.   0.1.1 Players can't buy a parachute if they already own one
  10.   0.1.2 Release for AMX MOD X
  11.   0.1.3 Minor changes
  12.   0.1.4 Players lose their parachute if they die
  13.   0.1.5 Added amx_parachute cvar
  14.   0.1.6 Changed set_origin to movetype_follow (you won't see your own parachute)
  15.   0.1.7 Added amx_parachute <name> | admins with admin level a get a free parachute
  16.   0.1.8 JTP - Cleaned up code, fixed runtime error
  17.   1.0 JTP - Should be final version, made it work on basically any mod
  18.   1.1 JTP - Added Changes from AMX Version 0.1.8
  19. Added say give_parachute and parachute_fallspeed cvar
  20.   Plays the release animation when you touch the ground
  21.   Added chat responder for automatic help
  22.   1.2 JTP - Added cvar to disable the detach animation
  23.   Redid animation code to improve organization
  24.   Force "walk" animation on players when falling
  25.   Change users gravity when falling to avoid choppiness
  26.   1.3 JTP - Upgraded to pCVARs
  27.  
  28.   Commands:
  29.  
  30. say buy_parachute - buys a parachute (CStrike ONLY)
  31. saw sell_parachute - sells your parachute (75% of the purchase price)
  32. say give_parachute <nick, #userid or @team> - gives your parachute to the player
  33.  
  34. amx_parachute <nick, #userid or @team> - gives a player a free parachute (CStrike ONLY)
  35. amx_parachute @all - gives everyone a free parachute (CStrike ONLY)
  36.  
  37. Press +use to slow down your fall.
  38.  
  39.   Cvars:
  40.  
  41. sv_parachute "1" - 0: disables the plugin - 1: enables the plugin
  42.  
  43. parachute_cost "1000" - cost of the parachute (CStrike ONLY)
  44.  
  45. parachute_payback "75" - how many percent of the parachute cost you get when you sell your parachute
  46. (ie. (75/100) * 1000 = 750$)
  47.  
  48. parachute_fallspeed "100" - speed of the fall when you use the parachute
  49.  
  50.  
  51.   Setup (AMXX 1.x):
  52.  
  53. Install the amxx file.
  54. Enable engine and cstrike (for cs only) in the amxx modules.ini
  55. Put the parachute.mdl file in the modname/models/ folder
  56.  
  57. *******************************************************************************/
  58.  
  59. #include <amxmodx>
  60. #include <amxmisc>
  61. #include <engine>
  62. #include <cstrike>
  63. #include <fun>
  64.  
  65. new bool:has_parachute[33]
  66. new para_ent[33]
  67. new gCStrike = 0
  68. new pDetach, pFallSpeed, pEnabled, pCost, pPayback
  69.  
  70. #define PARACHUTE_LEVEL ADMIN_LEVEL_A
  71.  
  72. public plugin_init()
  73. {
  74. register_plugin("Parachute", "1.3", "KRoT@L/JTP10181")
  75. pEnabled = register_cvar("sv_parachute", "1" )
  76. pFallSpeed = register_cvar("parachute_fallspeed", "100")
  77. pDetach = register_cvar("parachute_detach", "1")
  78.  
  79. if (cstrike_running()) gCStrike = true
  80.  
  81. if (gCStrike) {
  82.  
  83. pCost = register_cvar("parachute_cost", "1000")
  84. pPayback = register_cvar("parachute_payback", "75")
  85.  
  86. register_concmd("amx_parachute", "admin_give_parachute", PARACHUTE_LEVEL, "<nick, #userid or @team>" )
  87. }
  88.  
  89. register_clcmd("say", "HandleSay")
  90. register_clcmd("say_team", "HandleSay")
  91.  
  92. register_event("ResetHUD", "newSpawn", "be")
  93. register_event("DeathMsg", "death_event", "a")
  94.  
  95. //Setup jtp10181 CVAR
  96. new cvarString[256], shortName[16]
  97. copy(shortName,15,"chute")
  98.  
  99. register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY)
  100. get_cvar_string("jtp10181",cvarString,255)
  101.  
  102. if (strlen(cvarString) == 0) {
  103. formatex(cvarString,255,shortName)
  104. set_cvar_string("jtp10181",cvarString)
  105. }
  106. else if (contain(cvarString,shortName) == -1) {
  107. format(cvarString,255,"%s,%s",cvarString, shortName)
  108. set_cvar_string("jtp10181",cvarString)
  109. }
  110. }
  111.  
  112. public plugin_natives()
  113. {
  114. set_module_filter("module_filter")
  115. set_native_filter("native_filter")
  116. }
  117.  
  118. public module_filter(const module[])
  119. {
  120. if (!cstrike_running() && equali(module, "cstrike")) {
  121. return PLUGIN_HANDLED
  122. }
  123.  
  124. return PLUGIN_CONTINUE
  125. }
  126.  
  127. public native_filter(const name[], index, trap)
  128. {
  129. if (!trap) return PLUGIN_HANDLED
  130.  
  131. return PLUGIN_CONTINUE
  132. }
  133.  
  134. public plugin_precache()
  135. {
  136. precache_model("models/parachute.mdl")
  137. }
  138.  
  139. public client_connect(id)
  140. {
  141. parachute_reset(id)
  142. }
  143.  
  144. public client_disconnect(id)
  145. {
  146. parachute_reset(id)
  147. }
  148.  
  149. public death_event()
  150. {
  151. new id = read_data(2)
  152. parachute_reset(id)
  153. }
  154.  
  155. parachute_reset(id)
  156. {
  157. if(para_ent[id] > 0) {
  158. if (is_valid_ent(para_ent[id])) {
  159. remove_entity(para_ent[id])
  160. }
  161. }
  162.  
  163. if (is_user_alive(id)) set_user_gravity(id, 1.0)
  164.  
  165. has_parachute[id] = false
  166. para_ent[id] = 0
  167. }
  168.  
  169. public newSpawn(id)
  170. {
  171. if(para_ent[id] > 0) {
  172. remove_entity(para_ent[id])
  173. set_user_gravity(id, 1.0)
  174. para_ent[id] = 0
  175. }
  176.  
  177. if (!gCStrike || access(id,PARACHUTE_LEVEL) || get_pcvar_num(pCost) <= 0) {
  178. has_parachute[id] = true
  179. //set_view(id, CAMERA_3RDPERSON)
  180. }
  181. }
  182.  
  183. public HandleSay(id)
  184. {
  185. if(!is_user_connected(id)) return PLUGIN_CONTINUE
  186.  
  187. new args[128]
  188. read_args(args, 127)
  189. remove_quotes(args)
  190.  
  191. if (gCStrike) {
  192. if (equali(args, "buy_parachute")) {
  193. buy_parachute(id)
  194. return PLUGIN_HANDLED
  195. }
  196. else if (equali(args, "sell_parachute")) {
  197. sell_parachute(id)
  198. return PLUGIN_HANDLED
  199. }
  200. else if (containi(args, "give_parachute") == 0) {
  201. give_parachute(id,args[15])
  202. return PLUGIN_HANDLED
  203. }
  204. }
  205.  
  206. if (containi(args, "parachute") != -1) {
  207. if (gCStrike) client_print(id, print_chat, "[AMXX] Ejtőernyő parancsok: buy_parachute, sell_parachute, give_parachute")
  208. client_print(id, print_chat, "[AMXX] Az ejtőernyő használatához nyomd meg az E betűt")
  209. }
  210.  
  211. return PLUGIN_CONTINUE
  212. }
  213.  
  214. public buy_parachute(id)
  215. {
  216. if (!gCStrike) return PLUGIN_CONTINUE
  217. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  218.  
  219. if (!get_pcvar_num(pEnabled)) {
  220. client_print(id, print_chat, "[AMXX] Ejtőernyő plugin kikapcsolva")
  221. return PLUGIN_HANDLED
  222. }
  223.  
  224. if (has_parachute[id]) {
  225. client_print(id, print_chat, "[AMXX] Neked már van ejtőernyőd")
  226. return PLUGIN_HANDLED
  227. }
  228.  
  229. new money = cs_get_user_money(id)
  230. new cost = get_pcvar_num(pCost)
  231.  
  232. if (money < cost) {
  233. client_print(id, print_chat, "[AMXX] Nincs elég pénzed az ejtőernyő vásárlásához - Costs $%i", cost)
  234. return PLUGIN_HANDLED
  235. }
  236.  
  237. cs_set_user_money(id, money - cost)
  238. client_print(id, print_chat, "[AMXX] Vettél egy ejtőernyőt Használathoz nyomd meg az E betűt")
  239. has_parachute[id] = true
  240.  
  241. return PLUGIN_HANDLED
  242. }
  243.  
  244. public sell_parachute(id)
  245. {
  246. if (!gCStrike) return PLUGIN_CONTINUE
  247. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  248.  
  249. if (!get_pcvar_num(pEnabled)) {
  250. client_print(id, print_chat, "[AMXX] Ejtőernyő plugin kikapcsolva")
  251. return PLUGIN_HANDLED
  252. }
  253.  
  254. if (!has_parachute[id]) {
  255. client_print(id, print_chat, "[AMXX] Neked nincs ejtőernyőd ezért nem tudod eladni")
  256. return PLUGIN_HANDLED
  257. }
  258.  
  259. if (access(id,PARACHUTE_LEVEL)) {
  260. client_print(id, print_chat, "[AMXX] Te nem adhatod el az admin által adott ingyen ejtőernyőt!")
  261. return PLUGIN_HANDLED
  262. }
  263.  
  264. parachute_reset(id)
  265.  
  266. new money = cs_get_user_money(id)
  267. new cost = get_pcvar_num(pCost)
  268.  
  269. new sellamt = floatround(cost * (get_pcvar_num(pPayback) / 100.0))
  270. cs_set_user_money(id, money + sellamt)
  271.  
  272. client_print(id, print_chat, "[AMX] Eladtad a használt ejtőernyőd ennyiért: $%d", sellamt)
  273.  
  274. return PLUGIN_CONTINUE
  275. }
  276.  
  277. public give_parachute(id,args[])
  278. {
  279. if (!gCStrike) return PLUGIN_CONTINUE
  280. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  281.  
  282. if (!get_pcvar_num(pEnabled)) {
  283. client_print(id, print_chat, "[AMXX] Ejtőernyő plugin bekapcsolva")
  284. return PLUGIN_HANDLED
  285. }
  286.  
  287. if (!has_parachute[id]) {
  288. client_print(id, print_chat, "[AMXX] Te nem tudod használni az ejtőernyőd mert nincs.")
  289. return PLUGIN_HANDLED
  290. }
  291.  
  292. new player = cmd_target(id, args, 4)
  293. if (!player) return PLUGIN_HANDLED
  294.  
  295. new id_name[32], pl_name[32]
  296. get_user_name(id, id_name, 31)
  297. get_user_name(player, pl_name, 31)
  298.  
  299. if(has_parachute[player]) {
  300. client_print(id, print_chat, "[AMXX] %s már van ejtőernyője.", pl_name)
  301. return PLUGIN_HANDLED
  302. }
  303.  
  304. parachute_reset(id)
  305. has_parachute[player] = true
  306.  
  307. client_print(id, print_chat, "[AMXX] Adtál ejtőernyöt neki : %s.", pl_name)
  308. client_print(player, print_chat, "[AMXX] %s használja az ejtőernyőt amit te adtál neki.", id_name)
  309.  
  310. return PLUGIN_HANDLED
  311. }
  312.  
  313. public admin_give_parachute(id, level, cid) {
  314.  
  315. if (!gCStrike) return PLUGIN_CONTINUE
  316.  
  317. if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED
  318.  
  319. if (!get_pcvar_num(pEnabled)) {
  320. client_print(id, print_chat, "[AMXX] ejtőernyő plugin kikapcsolva")
  321. return PLUGIN_HANDLED
  322. }
  323.  
  324. new arg[32], name[32], name2[32], authid[35], authid2[35]
  325. read_argv(1,arg,31)
  326. get_user_name(id,name,31)
  327. get_user_authid(id,authid,34)
  328.  
  329. if (arg[0]=='@'){
  330. new players[32], inum
  331. if (equali("T",arg[1])) copy(arg[1],31,"TERRORIST")
  332. if (equali("ALL",arg[1])) get_players(players,inum)
  333. else get_players(players,inum,"e",arg[1])
  334.  
  335. if (inum == 0) {
  336. console_print(id,"No clients in such team")
  337. return PLUGIN_HANDLED
  338. }
  339.  
  340. for(new a = 0; a < inum; a++) {
  341. has_parachute[players[a]] = true
  342. }
  343.  
  344. switch(get_cvar_num("amx_show_activity")) {
  345. case 2: client_print(0,print_chat,"ADMIN %s: adott egy ejtőernyőt ^"%s^" playernek",name,arg[1])
  346. case 1: client_print(0,print_chat,"ADMIN: Adott egy ejtőernyőt ^"%s^" playernek",arg[1])
  347. }
  348.  
  349. console_print(id,"[AMXX] Te adtál egy ejtőernyőt ^"%s^" playernek",arg[1])
  350. log_amx("^"%s<%d><%s><>^" adtál ejtőernyőt ^"%s^"", name,get_user_userid(id),authid,arg[1])
  351. }
  352. else {
  353.  
  354. new player = cmd_target(id,arg,6)
  355. if (!player) return PLUGIN_HANDLED
  356.  
  357. has_parachute[player] = true
  358.  
  359. get_user_name(player,name2,31)
  360. get_user_authid(player,authid2,34)
  361.  
  362. switch(get_cvar_num("amx_show_activity")) {
  363. case 2: client_print(0,print_chat,"ADMIN %s: adtál ejtőernyőt ^"%s^"",name,name2)
  364. case 1: client_print(0,print_chat,"ADMIN: adtál ejtőernyőt ^"%s^"",name2)
  365. }
  366.  
  367. console_print(id,"[AMXX] te adtál ejtőernyőt ^"%s^"", name2)
  368. log_amx("^"%s<%d><%s><>^" adtál ejtőernyőt ^"%s<%d><%s><>^"", name,get_user_userid(id),authid,name2,get_user_userid(player),authid2)
  369. }
  370. return PLUGIN_HANDLED
  371. }
  372.  
  373. public client_PreThink(id)
  374. {
  375. //parachute.mdl animation information
  376. //0 - deploy - 84 frames
  377. //1 - idle - 39 frames
  378. //2 - detach - 29 frames
  379.  
  380. if (!get_pcvar_num(pEnabled)) return
  381. if (!is_user_alive(id) || !has_parachute[id]) return
  382.  
  383. new Float:fallspeed = get_pcvar_float(pFallSpeed) * -1.0
  384. new Float:frame
  385.  
  386. new button = get_user_button(id)
  387. new oldbutton = get_user_oldbutton(id)
  388. new flags = get_entity_flags(id)
  389.  
  390. if (para_ent[id] > 0 && (flags & FL_ONGROUND)) {
  391.  
  392. if (get_pcvar_num(pDetach)) {
  393.  
  394. if (get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
  395.  
  396. if (entity_get_int(para_ent[id],EV_INT_sequence) != 2) {
  397. entity_set_int(para_ent[id], EV_INT_sequence, 2)
  398. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  399. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  400. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  401. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  402. entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
  403. return
  404. }
  405.  
  406. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
  407. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  408. entity_set_float(para_ent[id],EV_FL_frame,frame)
  409.  
  410. if (frame > 254.0) {
  411. remove_entity(para_ent[id])
  412. para_ent[id] = 0
  413. }
  414. }
  415. else {
  416. remove_entity(para_ent[id])
  417. set_user_gravity(id, 1.0)
  418. para_ent[id] = 0
  419. }
  420.  
  421. return
  422. }
  423.  
  424. if (button & IN_USE) {
  425.  
  426. new Float:velocity[3]
  427. entity_get_vector(id, EV_VEC_velocity, velocity)
  428.  
  429. if (velocity[2] < 0.0) {
  430.  
  431. if(para_ent[id] <= 0) {
  432. para_ent[id] = create_entity("info_target")
  433. if(para_ent[id] > 0) {
  434. entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
  435. entity_set_edict(para_ent[id], EV_ENT_aiment, id)
  436. entity_set_edict(para_ent[id], EV_ENT_owner, id)
  437. entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  438. entity_set_model(para_ent[id], "models/parachute.mdl")
  439. entity_set_int(para_ent[id], EV_INT_sequence, 0)
  440. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  441. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  442. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  443. }
  444. }
  445.  
  446. if (para_ent[id] > 0) {
  447.  
  448. entity_set_int(id, EV_INT_sequence, 3)
  449. entity_set_int(id, EV_INT_gaitsequence, 1)
  450. entity_set_float(id, EV_FL_frame, 1.0)
  451. entity_set_float(id, EV_FL_framerate, 1.0)
  452. set_user_gravity(id, 0.1)
  453.  
  454. velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
  455. entity_set_vector(id, EV_VEC_velocity, velocity)
  456.  
  457. if (entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
  458.  
  459. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
  460. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  461. entity_set_float(para_ent[id],EV_FL_frame,frame)
  462.  
  463. if (frame > 100.0) {
  464. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  465. entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
  466. entity_set_int(para_ent[id], EV_INT_sequence, 1)
  467. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  468. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  469. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  470. }
  471. }
  472. }
  473. }
  474. else if (para_ent[id] > 0) {
  475. remove_entity(para_ent[id])
  476. set_user_gravity(id, 1.0)
  477. para_ent[id] = 0
  478. }
  479. }
  480. else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) {
  481. remove_entity(para_ent[id])
  482. set_user_gravity(id, 1.0)
  483. para_ent[id] = 0
  484. }
  485. }
  486.  

 

_________________
NEW IP:
Kép


A hozzászólást 1 alkalommal szerkesztették, utoljára TraneTommy 2015.01.21. 17:35-kor.

Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ejtőernyő hiba
HozzászólásElküldve: 2015.01.21. 17:35 
Offline
Senior Tag

Csatlakozott: 2014.06.23. 10:48
Hozzászólások: 221
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 14 alkalommal
Próbáld meg ezt! :) sokkal kevesebbet eszik a szerver.
viewtopic.php?f=22&t=5343


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