hlmod.hu
https://hlmod.hu/

Parachute Model
https://hlmod.hu/viewtopic.php?f=9&t=10421
Oldal: 1 / 1

Szerző:  R3C [2013.08.24. 00:43 ]
Hozzászólás témája:  Parachute Model

Üdv!Valaki tudja,hoyg az alap ejtőernyő modelljét hogyan tudom lecserélni egyedire?
Válaszát előre is köszönöm :)

Szerző:  norbee.16 [2013.08.24. 01:12 ]
Hozzászólás témája:  Re: Parachute Model

R3C írta:
Üdv!Valaki tudja,hoyg az alap ejtőernyő modelljét hogyan tudom lecserélni egyedire?
Válaszát előre is köszönöm :)

Ezt a sort keresd meg és írd át arra ami az új modell neve.
Idézet:
precache_model("models/parachute.mdl")

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

Szerző:  kiki [2013.08.24. 08:21 ]
Hozzászólás témája:  Re: Parachute Model

Az csak a letöltés, a beállítást is:

SMA Forráskód: [ Mindet kijelol ]
  1. entity_set_model(para_ent[id], "models/parachute.mdl")


Szal összességében ezt a két sort kell átírnod:

SMA Forráskód: [ Mindet kijelol ]
  1. precache_model("models/parachute.mdl")
  2. entity_set_model(para_ent[id], "models/parachute.mdl")


viszont más legyen, ne parachute, hanem valami nevet találj ki, ami még nincs meg a klienseknek, pl: parachute_klannev.mdl

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/