hlmod.hu
https://hlmod.hu/

Kick jogra ejtőernyő cvar?
https://hlmod.hu/viewtopic.php?f=29&t=13427
Oldal: 1 / 1

Szerző:  Papalo'. [2013.12.23. 17:47 ]
Hozzászólás témája:  Kick jogra ejtőernyő cvar?

Sziasztok!

Az lehetséges, hogy amelyik adminnak van kick joga, annak legyen egy egyedi cvarja? :)
Ezt szeretném:
parachute_fallspeed 75 -ezvan alapból mindenkinek
és azt szeretném hogy csak a kick joggal rendelkező adminoknak
parachute_fallspeed 0 -legyen

Ez megoldható lenne? Ha igen akkor megírjátok nekem ezt a plugint?

Szerző:  CrB [2013.12.23. 18:06 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

sma?

Szerző:  Papalo'. [2013.12.23. 19:31 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

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] Parachute commands: buy_parachute, sell_parachute, give_parachute")
  208. client_print(id, print_chat, "[AMXX] To use your parachute press and hold your +use button while falling")
  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] Parachute plugin is disabled")
  221. return PLUGIN_HANDLED
  222. }
  223.  
  224. if (has_parachute[id]) {
  225. client_print(id, print_chat, "[AMXX] You already have a parachute")
  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] You don't have enough moneyfor a parachute - Costs $%i", cost)
  234. return PLUGIN_HANDLED
  235. }
  236.  
  237. cs_set_user_money(id, money - cost)
  238. client_print(id, print_chat, "[AMXX] You have bought a parachute. To use it, press +use while falling.")
  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] Parachute plugin is disabled")
  251. return PLUGIN_HANDLED
  252. }
  253.  
  254. if (!has_parachute[id]) {
  255. client_print(id, print_chat, "[AMXX] You don't have a parachute to sell")
  256. return PLUGIN_HANDLED
  257. }
  258.  
  259. if (access(id,PARACHUTE_LEVEL)) {
  260. client_print(id, print_chat, "[AMXX] You cannot sell your free admin parachute")
  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] You have sold your used parachute for $%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] Parachute plugin is disabled")
  284. return PLUGIN_HANDLED
  285. }
  286.  
  287. if (!has_parachute[id]) {
  288. client_print(id, print_chat, "[AMXX] You don't have a parachute to give")
  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 already has a parachute.", 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] You have given your parachute to %s.", pl_name)
  308. client_print(player, print_chat, "[AMXX] %s has given thier parachute to you.", 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] Parachute plugin is disabled")
  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: gave a parachute to ^"%s^" players",name,arg[1])
  346. case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^" players",arg[1])
  347. }
  348.  
  349. console_print(id,"[AMXX] You gave a parachute to ^"%s^" players",arg[1])
  350. log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%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: gave a parachute to ^"%s^"",name,name2)
  364. case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^"",name2)
  365. }
  366.  
  367. console_print(id,"[AMXX] You gave a parachute to ^"%s^"", name2)
  368. log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%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. }

Szerző:  CrB [2013.12.23. 20:07 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

tessék
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] Parachute commands: buy_parachute, sell_parachute, give_parachute")
  208. client_print(id, print_chat, "[AMXX] To use your parachute press and hold your +use button while falling")
  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] Parachute plugin is disabled")
  221. return PLUGIN_HANDLED
  222. }
  223.  
  224. if (has_parachute[id]) {
  225. client_print(id, print_chat, "[AMXX] You already have a parachute")
  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] You don't have enough moneyfor a parachute - Costs $%i", cost)
  234. return PLUGIN_HANDLED
  235. }
  236.  
  237. cs_set_user_money(id, money - cost)
  238. client_print(id, print_chat, "[AMXX] You have bought a parachute. To use it, press +use while falling.")
  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] Parachute plugin is disabled")
  251. return PLUGIN_HANDLED
  252. }
  253.  
  254. if (!has_parachute[id]) {
  255. client_print(id, print_chat, "[AMXX] You don't have a parachute to sell")
  256. return PLUGIN_HANDLED
  257. }
  258.  
  259. if (access(id,PARACHUTE_LEVEL)) {
  260. client_print(id, print_chat, "[AMXX] You cannot sell your free admin parachute")
  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] You have sold your used parachute for $%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] Parachute plugin is disabled")
  284. return PLUGIN_HANDLED
  285. }
  286.  
  287. if (!has_parachute[id]) {
  288. client_print(id, print_chat, "[AMXX] You don't have a parachute to give")
  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 already has a parachute.", 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] You have given your parachute to %s.", pl_name)
  308. client_print(player, print_chat, "[AMXX] %s has given thier parachute to you.", 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] Parachute plugin is disabled")
  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: gave a parachute to ^"%s^" players",name,arg[1])
  346. case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^" players",arg[1])
  347. }
  348.  
  349. console_print(id,"[AMXX] You gave a parachute to ^"%s^" players",arg[1])
  350. log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%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: gave a parachute to ^"%s^"",name,name2)
  364. case 1: client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^"",name2)
  365. }
  366.  
  367. console_print(id,"[AMXX] You gave a parachute to ^"%s^"", name2)
  368. log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%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. new Float:fallspeed
  383. if(get_user_flags(id) & ADMIN_KICK)
  384. {
  385. fallspeed = 0.0
  386. }
  387. else
  388. {
  389. fallspeed = get_pcvar_float(pFallSpeed) * -1.0
  390. }
  391. new Float:frame
  392.  
  393. new button = get_user_button(id)
  394. new oldbutton = get_user_oldbutton(id)
  395. new flags = get_entity_flags(id)
  396.  
  397. if (para_ent[id] > 0 && (flags & FL_ONGROUND)) {
  398.  
  399. if (get_pcvar_num(pDetach)) {
  400.  
  401. if (get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
  402.  
  403. if (entity_get_int(para_ent[id],EV_INT_sequence) != 2) {
  404. entity_set_int(para_ent[id], EV_INT_sequence, 2)
  405. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  406. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  407. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  408. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  409. entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
  410. return
  411. }
  412.  
  413. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
  414. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  415. entity_set_float(para_ent[id],EV_FL_frame,frame)
  416.  
  417. if (frame > 254.0) {
  418. remove_entity(para_ent[id])
  419. para_ent[id] = 0
  420. }
  421. }
  422. else {
  423. remove_entity(para_ent[id])
  424. set_user_gravity(id, 1.0)
  425. para_ent[id] = 0
  426. }
  427.  
  428. return
  429. }
  430.  
  431. if (button & IN_USE) {
  432.  
  433. new Float:velocity[3]
  434. entity_get_vector(id, EV_VEC_velocity, velocity)
  435.  
  436. if (velocity[2] < 0.0) {
  437.  
  438. if(para_ent[id] <= 0) {
  439. para_ent[id] = create_entity("info_target")
  440. if(para_ent[id] > 0) {
  441. entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
  442. entity_set_edict(para_ent[id], EV_ENT_aiment, id)
  443. entity_set_edict(para_ent[id], EV_ENT_owner, id)
  444. entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  445. entity_set_model(para_ent[id], "models/parachute.mdl")
  446. entity_set_int(para_ent[id], EV_INT_sequence, 0)
  447. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  448. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  449. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  450. }
  451. }
  452.  
  453. if (para_ent[id] > 0) {
  454.  
  455. entity_set_int(id, EV_INT_sequence, 3)
  456. entity_set_int(id, EV_INT_gaitsequence, 1)
  457. entity_set_float(id, EV_FL_frame, 1.0)
  458. entity_set_float(id, EV_FL_framerate, 1.0)
  459. set_user_gravity(id, 0.1)
  460.  
  461. velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
  462. entity_set_vector(id, EV_VEC_velocity, velocity)
  463.  
  464. if (entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
  465.  
  466. frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
  467. entity_set_float(para_ent[id],EV_FL_fuser1,frame)
  468. entity_set_float(para_ent[id],EV_FL_frame,frame)
  469.  
  470. if (frame > 100.0) {
  471. entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
  472. entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
  473. entity_set_int(para_ent[id], EV_INT_sequence, 1)
  474. entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
  475. entity_set_float(para_ent[id], EV_FL_frame, 0.0)
  476. entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
  477. }
  478. }
  479. }
  480. }
  481. else if (para_ent[id] > 0) {
  482. remove_entity(para_ent[id])
  483. set_user_gravity(id, 1.0)
  484. para_ent[id] = 0
  485. }
  486. }
  487. else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) {
  488. remove_entity(para_ent[id])
  489. set_user_gravity(id, 1.0)
  490. para_ent[id] = 0
  491. }
  492. }

Szerző:  Papalo'. [2013.12.23. 20:42 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

De én úgy akarom, hogy a játékosoknak maradjon:
parachute_fallspeed 75
az adminoknak akinek van kickjoguk:
parachute_fallspeed 0

érted?

Szerző:  CrB [2013.12.23. 21:21 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

úgyvan
SMA Forráskód: [ Mindet kijelol ]
  1. if(get_user_flags(id) & ADMIN_KICK)
  2. {
  3. fallspeed = 0.0
  4. }
  5. else
  6. {
  7. fallspeed = get_pcvar_float(pFallSpeed) * -1.0

Szerző:  Papalo'. [2013.12.24. 11:10 ]
Hozzászólás témája:  Re: Kick jogra ejtőernyő cvar?

Sikerült! Nagyon köszi! ;)
A meg köszönés gombot még mindig nem találom, de amint meglesz.. ;)

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