hlmod.hu

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



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: siska15 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ő csak ctnek.
HozzászólásElküldve: 2016.04.30. 15:01 
Offline
Újonc

Csatlakozott: 2016.04.30. 14:51
Hozzászólások: 13
Megköszönt másnak: 9 alkalommal
Megköszönték neki: 1 alkalommal
Sziasztok.

Azt szeretném kérni hogy abban segítsettek hogy csak a ctnek legyen ejtőernyője.
A parachute plugint használom.

A választ előre is köszönöm.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ejtőernyő csak ctnek.
HozzászólásElküldve: 2016.04.30. 16:08 
Offline
Félisten
Avatar

Csatlakozott: 2016.03.06. 14:20
Hozzászólások: 964
Megköszönt másnak: 102 alkalommal
Megköszönték neki: 134 alkalommal
Róka123 írta:
Sziasztok.

Azt szeretném kérni hogy abban segítsettek hogy csak a ctnek legyen ejtőernyője.
A parachute plugint használom.

A választ előre is köszönöm.


  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <cstrike>
  5. #include <fun>
  6.  
  7. new bool:has_parachute[33]
  8. new para_ent[33]
  9. new gCStrike = 0
  10. new pDetach, pFallSpeed, pEnabled, pCost, pPayback
  11.  
  12. #define PARACHUTE_LEVEL ADMIN_LEVEL_A
  13.  
  14. public plugin_init()
  15. {
  16.     register_plugin("Parachute", "1.3", "KRoT@L/JTP10181")
  17.     pEnabled = register_cvar("sv_parachute", "1" )
  18.     pFallSpeed = register_cvar("parachute_fallspeed", "100")
  19.     pDetach = register_cvar("parachute_detach", "1")
  20.  
  21.     if (cstrike_running()) gCStrike = true
  22.  
  23.     if (gCStrike) {
  24.  
  25.         pCost = register_cvar("parachute_cost", "0")
  26.         pPayback = register_cvar("parachute_payback", "75")
  27.  
  28.         register_concmd("amx_parachute", "admin_give_parachute", PARACHUTE_LEVEL, "<nick, #userid or @team>" )
  29.     }
  30.  
  31.     register_clcmd("say", "HandleSay")
  32.     register_clcmd("say_team", "HandleSay")
  33.  
  34.     register_event("ResetHUD", "newSpawn", "be")
  35.     register_event("DeathMsg", "death_event", "a")
  36.  
  37.     //Setup jtp10181 CVAR
  38.     new cvarString[256], shortName[16]
  39.     copy(shortName,15,"chute")
  40.  
  41.     register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY)
  42.     get_cvar_string("jtp10181",cvarString,255)
  43.  
  44.     if (strlen(cvarString) == 0) {
  45.         formatex(cvarString,255,shortName)
  46.         set_cvar_string("jtp10181",cvarString)
  47.     }
  48.     else if (contain(cvarString,shortName) == -1) {
  49.         format(cvarString,255,"%s,%s",cvarString, shortName)
  50.         set_cvar_string("jtp10181",cvarString)
  51.     }
  52. }
  53.  
  54. public plugin_natives()
  55. {
  56.     set_module_filter("module_filter")
  57.     set_native_filter("native_filter")
  58. }
  59.  
  60. public module_filter(const module[])
  61. {
  62.     if (!cstrike_running() && equali(module, "cstrike")) {
  63.         return PLUGIN_HANDLED
  64.     }
  65.  
  66.     return PLUGIN_CONTINUE
  67. }
  68.  
  69. public native_filter(const name[], index, trap)
  70. {
  71.     if (!trap) return PLUGIN_HANDLED
  72.  
  73.     return PLUGIN_CONTINUE
  74. }
  75.  
  76. public plugin_precache()
  77. {
  78.     precache_model("models/parachute.mdl")
  79. }
  80.  
  81. public client_connect(id)
  82. {
  83.     parachute_reset(id)
  84. }
  85.  
  86. public client_disconnect(id)
  87. {
  88.     parachute_reset(id)
  89. }
  90.  
  91. public death_event()
  92. {
  93.     new id = read_data(2)
  94.     parachute_reset(id)
  95. }
  96.  
  97. parachute_reset(id)
  98. {
  99.     if(para_ent[id] > 0) {
  100.         if (is_valid_ent(para_ent[id])) {
  101.             remove_entity(para_ent[id])
  102.         }
  103.     }
  104.  
  105.     if (is_user_alive(id)) set_user_gravity(id, 1.0)
  106.  
  107.     has_parachute[id] = false
  108.     para_ent[id] = 0
  109. }
  110.  
  111. public newSpawn(id)
  112. {
  113.     if(para_ent[id] > 0) {
  114.         remove_entity(para_ent[id])
  115.         set_user_gravity(id, 1.0)
  116.         para_ent[id] = 0
  117.     }
  118.  
  119.     if (!gCStrike || access(id,PARACHUTE_LEVEL) || get_pcvar_num(pCost) <= 0) {
  120.         has_parachute[id] = true
  121.         //set_view(id, CAMERA_3RDPERSON)
  122.     }
  123. }
  124.  
  125. public HandleSay(id)
  126. {
  127.     if(!is_user_connected(id))
  128.         return PLUGIN_CONTINUE
  129.  
  130.     if( cs_get_user_team(id) == CS_TEAM_CT )
  131.     {
  132.         new args[128]
  133.         read_args(args, 127)
  134.         remove_quotes(args)
  135.  
  136.         if (gCStrike) {
  137.             if (equali(args, "buy_parachute")) {
  138.                 buy_parachute(id)
  139.                 return PLUGIN_HANDLED
  140.             }
  141.             else if (equali(args, "sell_parachute")) {
  142.                 sell_parachute(id)
  143.                 return PLUGIN_HANDLED
  144.             }
  145.             else if (containi(args, "give_parachute") == 0) {
  146.                 give_parachute(id,args[15])
  147.                 return PLUGIN_HANDLED
  148.             }
  149.         }
  150.  
  151.         if (containi(args, "parachute") != -1) {
  152.             if (gCStrike) client_print(id, print_chat, "[AMXX] Parachute commands: buy_parachute, sell_parachute, give_parachute")
  153.             client_print(id, print_chat, "[AMXX] To use your parachute press and hold your +use button while falling")
  154.         }
  155.     }
  156.     return PLUGIN_CONTINUE
  157. }
  158.  
  159. public buy_parachute(id)
  160. {
  161.     if (!gCStrike) return PLUGIN_CONTINUE
  162.     if (!is_user_connected(id)) return PLUGIN_CONTINUE
  163.  
  164.     if (!get_pcvar_num(pEnabled)) {
  165.         client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
  166.         return PLUGIN_HANDLED
  167.     }
  168.  
  169.     if (has_parachute[id]) {
  170.         client_print(id, print_chat, "[AMXX] You already have a parachute")
  171.         return PLUGIN_HANDLED
  172.     }
  173.  
  174.     new money = cs_get_user_money(id)
  175.     new cost = get_pcvar_num(pCost)
  176.  
  177.     if (money < cost) {
  178.         client_print(id, print_chat, "[AMXX] You don't have enough moneyfor a parachute - Costs $%i", cost)
  179.         return PLUGIN_HANDLED
  180.     }
  181.  
  182.     cs_set_user_money(id, money - cost)
  183.     client_print(id, print_chat, "[AMXX] You have bought a parachute. To use it, press +use while falling.")
  184.     has_parachute[id] = true
  185.  
  186.     return PLUGIN_HANDLED
  187. }
  188.  
  189. public sell_parachute(id)
  190. {
  191.     if (!gCStrike) return PLUGIN_CONTINUE
  192.     if (!is_user_connected(id)) return PLUGIN_CONTINUE
  193.  
  194.     if (!get_pcvar_num(pEnabled)) {
  195.         client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
  196.         return PLUGIN_HANDLED
  197.     }
  198.  
  199.     if (!has_parachute[id]) {
  200.         client_print(id, print_chat, "[AMXX] You don't have a parachute to sell")
  201.         return PLUGIN_HANDLED
  202.     }
  203.  
  204.     if (access(id,PARACHUTE_LEVEL)) {
  205.         client_print(id, print_chat, "[AMXX] You cannot sell your free admin parachute")
  206.         return PLUGIN_HANDLED
  207.     }
  208.  
  209.     parachute_reset(id)
  210.  
  211.     new money = cs_get_user_money(id)
  212.     new cost = get_pcvar_num(pCost)
  213.  
  214.     new sellamt = floatround(cost * (get_pcvar_num(pPayback) / 100.0))
  215.     cs_set_user_money(id, money + sellamt)
  216.  
  217.     client_print(id, print_chat, "[AMX] You have sold your used parachute for $%d", sellamt)
  218.  
  219.     return PLUGIN_CONTINUE
  220. }
  221.  
  222. public give_parachute(id,args[])
  223. {
  224.     if (!gCStrike) return PLUGIN_CONTINUE
  225.     if (!is_user_connected(id)) return PLUGIN_CONTINUE
  226.  
  227.     if (!get_pcvar_num(pEnabled)) {
  228.         client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
  229.         return PLUGIN_HANDLED
  230.     }
  231.  
  232.     if (!has_parachute[id]) {
  233.         client_print(id, print_chat, "[AMXX] You don't have a parachute to give")
  234.         return PLUGIN_HANDLED
  235.     }
  236.  
  237.     new player = cmd_target(id, args, 4)
  238.     if (!player) return PLUGIN_HANDLED
  239.  
  240.     new id_name[32], pl_name[32]
  241.     get_user_name(id, id_name, 31)
  242.     get_user_name(player, pl_name, 31)
  243.  
  244.     if(has_parachute[player]) {
  245.         client_print(id, print_chat, "[AMXX] %s already has a parachute.", pl_name)
  246.         return PLUGIN_HANDLED
  247.     }
  248.  
  249.     parachute_reset(id)
  250.     has_parachute[player] = true
  251.  
  252.     client_print(id, print_chat, "[AMXX] You have given your parachute to %s.", pl_name)
  253.     client_print(player, print_chat, "[AMXX] %s has given thier parachute to you.", id_name)
  254.  
  255.     return PLUGIN_HANDLED
  256. }
  257.  
  258. public admin_give_parachute(id, level, cid) {
  259.  
  260.     if (!gCStrike) return PLUGIN_CONTINUE
  261.  
  262.     if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED
  263.  
  264.     if (!get_pcvar_num(pEnabled)) {
  265.         client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
  266.         return PLUGIN_HANDLED
  267.     }
  268.  
  269.     new arg[32], name[32], name2[32], authid[35], authid2[35]
  270.     read_argv(1,arg,31)
  271.     get_user_name(id,name,31)
  272.     get_user_authid(id,authid,34)
  273.  
  274.     if (arg[0]=='@'){
  275.         new players[32], inum
  276.         if (equali("T",arg[1]))     copy(arg[1],31,"TERRORIST")
  277.         if (equali("ALL",arg[1]))   get_players(players,inum)
  278.         else                        get_players(players,inum,"e",arg[1])
  279.  
  280.         if (inum == 0) {
  281.             console_print(id,"No clients in such team")
  282.             return PLUGIN_HANDLED
  283.         }
  284.  
  285.         for(new a = 0; a < inum; a++) {
  286.             has_parachute[players[a]] = true
  287.         }
  288.  
  289.         switch(get_cvar_num("amx_show_activity"))   {
  290.             case 2: client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^" players",name,arg[1])
  291.             case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^" players",arg[1])
  292.         }
  293.  
  294.         console_print(id,"[AMXX] You gave a parachute to ^"%s^" players",arg[1])
  295.         log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s^"", name,get_user_userid(id),authid,arg[1])
  296.     }
  297.     else {
  298.  
  299.         new player = cmd_target(id,arg,6)
  300.         if (!player) return PLUGIN_HANDLED
  301.  
  302.         has_parachute[player] = true
  303.  
  304.         get_user_name(player,name2,31)
  305.         get_user_authid(player,authid2,34)
  306.  
  307.         switch(get_cvar_num("amx_show_activity")) {
  308.             case 2: client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^"",name,name2)
  309.             case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^"",name2)
  310.         }
  311.  
  312.         console_print(id,"[AMXX] You gave a parachute to ^"%s^"", name2)
  313.         log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s<%d><%s><>^"", name,get_user_userid(id),authid,name2,get_user_userid(player),authid2)
  314.     }
  315.     return PLUGIN_HANDLED
  316. }
  317.  
  318. public client_PreThink(id)
  319. {
  320.     //parachute.mdl animation information
  321.     //0 - deploy - 84 frames
  322.     //1 - idle - 39 frames
  323.     //2 - detach - 29 frames
  324.  
  325.     if (!get_pcvar_num(pEnabled)) return
  326.     if (!is_user_alive(id) || !has_parachute[id]) return
  327.  
  328.     new Float:fallspeed = get_pcvar_float(pFallSpeed) * -1.0
  329.     new Float:frame
  330.  
  331.     new button = get_user_button(id)
  332.     new oldbutton = get_user_oldbutton(id)
  333.     new flags = get_entity_flags(id)
  334.  
  335.     if (para_ent[id] > 0 && (flags & FL_ONGROUND)) {
  336.  
  337.         if (get_pcvar_num(pDetach)) {
  338.  
  339.             if (get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
  340.  
  341.             if (entity_get_int(para_ent[id],EV_INT_sequence) != 2) {
  342.                 entity_set_int(para_ent[id], EV_INT_sequence, 2)
  343.                 entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  344.                 entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  345.                 entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  346.                 entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  347.                 entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
  348.                 return
  349.             }
  350.  
  351.             frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
  352.             entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  353.             entity_set_float(para_ent[id],EV_FL_frame,frame)
  354.  
  355.             if (frame > 254.0) {
  356.                 remove_entity(para_ent[id])
  357.                 para_ent[id] = 0
  358.             }
  359.         }
  360.         else {
  361.             remove_entity(para_ent[id])
  362.             set_user_gravity(id, 1.0)
  363.             para_ent[id] = 0
  364.         }
  365.  
  366.         return
  367.     }
  368.  
  369.     if (button & IN_USE) {
  370.  
  371.         new Float:velocity[3]
  372.         entity_get_vector(id, EV_VEC_velocity, velocity)
  373.  
  374.         if (velocity[2] < 0.0) {
  375.  
  376.             if(para_ent[id] <= 0) {
  377.                 para_ent[id] = create_entity("info_target")
  378.                 if(para_ent[id] > 0) {
  379.                     entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
  380.                     entity_set_edict(para_ent[id], EV_ENT_aiment, id)
  381.                     entity_set_edict(para_ent[id], EV_ENT_owner, id)
  382.                     entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  383.                     entity_set_model(para_ent[id], "models/parachute.mdl")
  384.                     entity_set_int(para_ent[id], EV_INT_sequence, 0)
  385.                     entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  386.                     entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  387.                     entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  388.                 }
  389.             }
  390.  
  391.             if (para_ent[id] > 0) {
  392.  
  393.                 entity_set_int(id, EV_INT_sequence, 3)
  394.                 entity_set_int(id, EV_INT_gaitsequence, 1)
  395.                 entity_set_float(id, EV_FL_frame, 1.0)
  396.                 entity_set_float(id, EV_FL_framerate, 1.0)
  397.                 set_user_gravity(id, 0.1)
  398.  
  399.                 velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
  400.                 entity_set_vector(id, EV_VEC_velocity, velocity)
  401.  
  402.                 if (entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
  403.  
  404.                     frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
  405.                     entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  406.                     entity_set_float(para_ent[id],EV_FL_frame,frame)
  407.  
  408.                     if (frame > 100.0) {
  409.                         entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  410.                         entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
  411.                         entity_set_int(para_ent[id], EV_INT_sequence, 1)
  412.                         entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  413.                         entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  414.                         entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  415.                     }
  416.                 }
  417.             }
  418.         }
  419.         else if (para_ent[id] > 0) {
  420.             remove_entity(para_ent[id])
  421.             set_user_gravity(id, 1.0)
  422.             para_ent[id] = 0
  423.         }
  424.     }
  425.     else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) {
  426.         remove_entity(para_ent[id])
  427.         set_user_gravity(id, 1.0)
  428.         para_ent[id] = 0
  429.     }
  430. }


tessék.

_________________
 ! Moderátori megjegyzés (kiki):
Kérlek csekkold az aláírásra vonatkozó szabályokat!

Ők köszönték meg The Peace nek ezt a hozzászólást: Róka123 (2016.04.30. 16:28)
  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 65 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