hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 315 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 315 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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: [ZP] Addons : GHW Követő állatok
HozzászólásElküldve: 2014.10.30. 07:33 
Offline
Senior Tag

Csatlakozott: 2013.05.22. 17:06
Hozzászólások: 205
Megköszönt másnak: 88 alkalommal
Üdv sziasztok van ez a ghw követő állatok plugin. És én láttam egy szerveren hogy ezt vip tudja csak hasznalni. És én kérném a segítségeteket. Hogy megoldható lenne hogy csak vip tudja használni?? Ha igen előre is köszönöm!
SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. * _______ _ _ __ __
  3. * | _____/ | | | | \ \ __ / /
  4. * | | | | | | | | / \ | |
  5. * | | | |____| | | |/ __ \| |
  6. * | | ___ | ______ | | / \ |
  7. * | | |_ | | | | | | / \ |
  8. * | | | | | | | | | | | |
  9. * | |____| | | | | | | | | |
  10. * |_______/ |_| |_| \_/ \_/
  11. *
  12. *
  13. *
  14. * Utols� v�ltoztat�s: 07-04-09
  15. *
  16. * ============
  17. * V�ltoztat�sok:
  18. * ============
  19. *
  20. * v2.2
  21. * -Hozz�adva a "csak adminoknak" funkci�
  22. *
  23. * v2.1
  24. * -Hozz�adva m�g n�h�ny �llat
  25. * -Fix�lva a hal�l anim�ci�k
  26. * -Fix�lva a chat sz�veg hib�k
  27. *
  28. * v2.0
  29. * -ML Hozz�adva
  30. *
  31. * v1.0
  32. * -Els� m�k�d� verzi�
  33. *
  34. *Ford�totta: ^^Silverss#
  35. *
  36. */
  37.  
  38. #define VERSION "2.2"
  39.  
  40. #include <amxmodx>
  41. #include <amxmisc>
  42. #include <chr_engine>
  43.  
  44. #define PET_NUM 17
  45.  
  46. static const pet_name[PET_NUM][32] =
  47. {
  48. "Headcrab",
  49. "Rat",
  50. "Bat",
  51. "Frog",
  52. "Floater",
  53. "Cockroach",
  54. "Hyper Bat",
  55. "Mom",
  56. "Grunt",
  57. "Fish",
  58. "Baby Headcrab",
  59. "Roach",
  60. "Gargantuan",
  61. "Bull Squid",
  62. "Hound Eye",
  63. "Loading Machine",
  64. "Controller"
  65. }
  66.  
  67. static const pet_models[PET_NUM][32] =
  68. {
  69. "models/headcrab.mdl",
  70. "models/bigrat.mdl",
  71. "models/boid.mdl",
  72. "models/chumtoad.mdl",
  73. "models/floater.mdl",
  74. "models/roach.mdl",
  75. "models/stukabat.mdl",
  76. "models/big_mom.mdl",
  77. "models/agrunt.mdl",
  78. "models/archer.mdl",
  79. "models/baby_headcrab.mdl",
  80. "models/roach.mdl",
  81. "models/garg.mdl",
  82. "models/bullsquid.mdl",
  83. "models/houndeye.mdl",
  84. "models/loader.mdl",
  85. "models/controller.mdl"
  86. }
  87.  
  88. static const pet_idle[PET_NUM] =
  89. {
  90. 0,
  91. 1,
  92. 0,
  93. 0,
  94. 0,
  95. 1,
  96. 13,
  97. 0,
  98. 0,
  99. 0,
  100. 1,
  101. 0,
  102. 7,
  103. 1,
  104. 1,
  105. 3,
  106. 3
  107. }
  108.  
  109. static const Float:pet_idle_speed[PET_NUM] =
  110. {
  111. 1.0,
  112. 1.0,
  113. 1.0,
  114. 1.0,
  115. 1.0,
  116. 1.0,
  117. 0.5,
  118. 1.0,
  119. 1.0,
  120. 1.0,
  121. 1.0,
  122. 1.0,
  123. 1.0,
  124. 1.0,
  125. 1.0,
  126. 1.0,
  127. 1.0
  128. }
  129.  
  130. static const pet_run[PET_NUM] =
  131. {
  132. 4,
  133. 4,
  134. 0,
  135. 5,
  136. 0,
  137. 0,
  138. 13,
  139. 3,
  140. 3,
  141. 6,
  142. 4,
  143. 0,
  144. 4,
  145. 0,
  146. 3,
  147. 2,
  148. 9
  149. }
  150.  
  151. static const Float:pet_run_speed[PET_NUM] =
  152. {
  153. 2.0,
  154. 6.0,
  155. 3.0,
  156. 0.75,
  157. 1.0,
  158. 1.0,
  159. 13.0,
  160. 1.0,
  161. 1.0,
  162. 0.6,
  163. 0.6,
  164. 1.0,
  165. 1.0,
  166. 2.0,
  167. 1.0,
  168. 0.4,
  169. 1.0
  170. }
  171.  
  172. static const pet_die[PET_NUM] =
  173. {
  174. 7,
  175. 7,
  176. 0,
  177. 12,
  178. 0,
  179. 0,
  180. 5,
  181. 4,
  182. 22,
  183. 9,
  184. 7,
  185. 1,
  186. 14,
  187. 16,
  188. 6,
  189. 5,
  190. 18
  191. }
  192.  
  193. static const Float:pet_die_length[PET_NUM] =
  194. {
  195. 2.4,
  196. 2.4,
  197. 0.1,
  198. 3.0,
  199. 0.1,
  200. 0.1,
  201. 3.0,
  202. 5.0,
  203. 5.0,
  204. 3.0,
  205. 3.0,
  206. 1.0,
  207. 6.0,
  208. 2.5,
  209. 2.5,
  210. 7.0,
  211. 7.0
  212. }
  213.  
  214. static const Float:pet_minus_z_standing[PET_NUM] =
  215. {
  216. 36.0,
  217. 36.0,
  218. 5.0,
  219. 36.0,
  220. 5.0,
  221. 36.0,
  222. 10.0,
  223. 36.0,
  224. 36.0,
  225. 20.0,
  226. 36.0,
  227. 36.0,
  228. 36.0,
  229. 36.0,
  230. 36.0,
  231. 36.0,
  232. 0.0
  233. }
  234.  
  235. static const Float:pet_minus_z_crouching[PET_NUM] =
  236. {
  237. 16.0,
  238. 16.0,
  239. 6.0,
  240. 16.0,
  241. 6.0,
  242. 16.0,
  243. 11.0,
  244. 16.0,
  245. 16.0,
  246. 30.0,
  247. 16.0,
  248. 16.0,
  249. 16.0,
  250. 16.0,
  251. 16.0,
  252. 16.0,
  253. 0.0
  254. }
  255.  
  256. static const Float:pet_max_distance[PET_NUM] =
  257. {
  258. 300.0,
  259. 300.0,
  260. 300.0,
  261. 300.0,
  262. 300.0,
  263. 300.0,
  264. 300.0,
  265. 1000.0,
  266. 600.0,
  267. 300.0,
  268. 300.0,
  269. 300.0,
  270. 800.0,
  271. 400.0,
  272. 400.0,
  273. 1000.0,
  274. 800.0
  275. }
  276.  
  277. static const Float:pet_min_distance[PET_NUM] =
  278. {
  279. 80.0,
  280. 80.0,
  281. 80.0,
  282. 80.0,
  283. 80.0,
  284. 80.0,
  285. 80.0,
  286. 300.0,
  287. 200.0,
  288. 80.0,
  289. 80.0,
  290. 80.0,
  291. 250.0,
  292. 100.0,
  293. 100.0,
  294. 300.0,
  295. 200.0
  296. }
  297.  
  298. new pet[33]
  299. new pettype[33]
  300. new maxplayers
  301. new pets_off_pcvar
  302. new pets_adminonly_pcvar
  303.  
  304. //menu
  305. new currently_on[33]
  306.  
  307. public plugin_init()
  308. {
  309. register_plugin("GHW Pet Followers",VERSION,"GHW_Chronic")
  310.  
  311. register_concmd("amx_pets","cmd_pets",ADMIN_SLAY," Brings up the menu to turn pets on/admin only/off")
  312. register_menu("PetsMenu",(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"menu_pressed")
  313.  
  314. register_clcmd("say","say_hook")
  315. register_clcmd("say_team","say_hook")
  316.  
  317. register_event("DeathMsg","DeathMsg","a")
  318. register_forward(FM_Think,"FM_Think_hook")
  319.  
  320. pets_off_pcvar = register_cvar("pets_off","0")
  321. pets_adminonly_pcvar = register_cvar("pets_adminonly","0")
  322.  
  323. maxplayers = get_maxplayers()
  324.  
  325. register_dictionary("GHW_Pet_Followers.txt")
  326. }
  327.  
  328. public plugin_precache()
  329. {
  330. for(new i=0;i<PET_NUM;i++) precache_model(pet_models[i])
  331. }
  332.  
  333. public cmd_pets(id,level,cid)
  334. {
  335. if(!cmd_access(id,level,cid,1))
  336. {
  337. return PLUGIN_HANDLED
  338. }
  339.  
  340. currently_on[id] = 0
  341. create_menu(id)
  342.  
  343. return PLUGIN_HANDLED
  344. }
  345.  
  346. public create_menu(id)
  347. {
  348. new Menu[1024]
  349. format(Menu,1023,"GHW Pet Mod^n^n")
  350.  
  351. new keys
  352.  
  353. new current_setting[32]
  354. for(new i=currently_on[id];i<PET_NUM && i<currently_on[id] + 7;i++)
  355. {
  356. if(get_pcvar_num(pets_off_pcvar) & power(2,i))
  357. {
  358. format(current_setting,31,"Off")
  359. }
  360. else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,i))
  361. {
  362. format(current_setting,31,"Admin")
  363. }
  364. else
  365. {
  366. format(current_setting,31,"On")
  367. }
  368. format(Menu,1023,"%s%d. %s \R%s^n",Menu,i - currently_on[id] + 1,pet_name[i],current_setting)
  369.  
  370. keys |= (1<<i - currently_on[id])
  371. }
  372.  
  373. if(currently_on[id] > 0)
  374. {
  375. format(Menu,1023,"%s^n8. Back",Menu)
  376. keys |= (1<<7)
  377. }
  378. if(currently_on[id] + 7 < PET_NUM)
  379. {
  380. format(Menu,1023,"%s^n9. Next",Menu)
  381. keys |= (1<<8)
  382. }
  383.  
  384. format(Menu,1023,"%s^n^n0. Exit",Menu)
  385. keys |= (1<<9)
  386.  
  387. show_menu(id,keys,Menu,-1,"PetsMenu")
  388. }
  389.  
  390. public menu_pressed(id,key)
  391. {
  392. switch(key)
  393. {
  394. case 7:
  395. {
  396. //Back
  397. currently_on[id] -= 7
  398. }
  399. case 8:
  400. {
  401. //Next
  402. currently_on[id] += 7
  403. }
  404. case 9:
  405. {
  406. //Nothing - Exit
  407. return PLUGIN_HANDLED
  408. }
  409. default:
  410. {
  411. //Selected a Pet
  412. if(get_pcvar_num(pets_off_pcvar) & power(2,key + currently_on[id]))
  413. {
  414. set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) - power(2,key + currently_on[id]))//Out of Off list
  415. }
  416. else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,key + currently_on[id]))
  417. {
  418. set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) - power(2,key + currently_on[id]))//Out of Admin list
  419. set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) + power(2,key + currently_on[id]))//Into Off list
  420. }
  421. else
  422. {
  423. set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) + power(2,key + currently_on[id]))//Into Admin list
  424. }
  425. }
  426. }
  427.  
  428. create_menu(id)
  429.  
  430. return PLUGIN_HANDLED
  431. }
  432.  
  433. public client_disconnect(id) handle_DeathMsg(id)
  434.  
  435. public DeathMsg() handle_DeathMsg(read_data(2))
  436.  
  437. public handle_DeathMsg(id)
  438. {
  439. if(pet[id] && pev_valid(pet[id]))
  440. {
  441. set_pev(pet[id],pev_animtime,100.0)
  442. set_pev(pet[id],pev_framerate,1.0)
  443. set_pev(pet[id],pev_sequence,pet_die[pettype[id]])
  444. set_pev(pet[id],pev_gaitsequence,pet_die[pettype[id]])
  445. set_task(pet_die_length[pettype[id]],"remove_pet",pet[id])
  446. }
  447. pet[id]=0
  448. }
  449.  
  450. public remove_pet(ent) if(pev_valid(ent)) engfunc(EngFunc_RemoveEntity,ent)
  451.  
  452. public say_hook(id)
  453. {
  454. new arg[32]
  455. read_argv(1,arg,31)
  456. if(equali(arg,"/pet Headcrab")) pet_cmd_handle(id,0)
  457. else if(equali(arg,"/pet Rat")) pet_cmd_handle(id,1)
  458. else if(equali(arg,"/pet Bat")) pet_cmd_handle(id,2)
  459. else if(equali(arg,"/pet Frog")) pet_cmd_handle(id,3)
  460. else if(equali(arg,"/pet Floater")) pet_cmd_handle(id,4)
  461. else if(equali(arg,"/pet Cockroach")) pet_cmd_handle(id,5)
  462. else if(equali(arg,"/pet Hyper") || equali(arg,"/pet Hyper Bat")) pet_cmd_handle(id,6)
  463. else if(equali(arg,"/pet Mom")) pet_cmd_handle(id,7)
  464. else if(equali(arg,"/pet Grunt")) pet_cmd_handle(id,8)
  465. else if(equali(arg,"/pet Fish")) pet_cmd_handle(id,9)
  466. else if(equali(arg,"/pet Baby Headcrab") || equali(arg,"/pet Baby")) pet_cmd_handle(id,10)
  467. else if(equali(arg,"/pet Roach") || equali(arg,"/pet Cockroach")) pet_cmd_handle(id,11)
  468. else if(equali(arg,"/pet Garg") || equali(arg,"/pet Gargantuan")) pet_cmd_handle(id,12)
  469. else if(equali(arg,"/pet Bull") || equali(arg,"/pet Bull Squid") || equali(arg,"/pet BullSquid") || equali(arg,"/pet Squid")) pet_cmd_handle(id,13)
  470. else if(equali(arg,"/pet Hound") || equali(arg,"/pet Hound Eye") || equali(arg,"/pet HoundEye") || equali(arg,"/pet Eye")) pet_cmd_handle(id,14)
  471. else if(equali(arg,"/pet Loader") || equali(arg,"/pet Loading") || equali(arg,"/pet Machine") || equali(arg,"/pet Loading Machine")) pet_cmd_handle(id,15)
  472. else if(equali(arg,"/pet Boss") || equali(arg,"/pet Controller")) pet_cmd_handle(id,16)
  473. else if(containi(arg,"/pet")==0) pet_cmd_handle(id,random_pet(id))
  474. else if(containi(arg,"/nopet")==0)
  475. {
  476. if(pet[id]) client_print(id,print_chat,"[AMXX] %L",id,"MSG_REMOVEPET")
  477. else client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOREMOVEPET")
  478. handle_DeathMsg(id)
  479. }
  480. }
  481.  
  482. public random_pet(id)
  483. {
  484. new num = random_num(0,PET_NUM-1);
  485.  
  486. if((get_pcvar_num(pets_off_pcvar) & power(2,num)) || ((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id)))
  487. num = random_pet(id)
  488.  
  489. return num;
  490. }
  491.  
  492. public pet_cmd_handle(id,num)
  493. {
  494. if(pet[id])
  495. {
  496. handle_DeathMsg(id)
  497. //client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_HAVE")
  498. }
  499. else if(!is_user_alive(id))
  500. {
  501. client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_DEAD")
  502. }
  503. else
  504. {
  505. if(get_pcvar_num(pets_off_pcvar) & power(2,num))
  506. {
  507. client_print(id,print_chat,"[AMXX] %L",id,"MSG_DISABLED")
  508. }
  509. else if((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id))
  510. {
  511. client_print(id,print_chat,"[AMXX] %L",id,"MSG_ADMINONLY")
  512. }
  513. else
  514. {
  515. pet[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
  516. set_pev(pet[id],pev_classname,"GHW_Pet")
  517. pettype[id] = num
  518. engfunc(EngFunc_SetModel,pet[id],pet_models[pettype[id]])
  519. new Float:origin[3]
  520. pev(id,pev_origin,origin)
  521. if(is_user_crouching(id)) origin[2] -= pet_minus_z_crouching[pettype[id]]
  522. else origin[2] -= pet_minus_z_standing[pettype[id]]
  523. set_pev(pet[id],pev_origin,origin)
  524. set_pev(pet[id],pev_solid,SOLID_NOT)
  525. set_pev(pet[id],pev_movetype,MOVETYPE_FLY)
  526. set_pev(pet[id],pev_owner,33)
  527. set_pev(pet[id],pev_nextthink,1.0)
  528. set_pev(pet[id],pev_sequence,0)
  529. set_pev(pet[id],pev_gaitsequence,0)
  530. set_pev(pet[id],pev_framerate,1.0)
  531. client_print(id,print_chat,"[AMXX] %L",id,"MSG_GIVEPET",pet_name[pettype[id]])
  532. }
  533. }
  534. }
  535.  
  536. public FM_Think_hook(ent)
  537. {
  538. for(new i=0;i<=maxplayers;i++)
  539. {
  540. if(ent==pet[i])
  541. {
  542. static Float:origin[3]
  543. static Float:origin2[3]
  544. static Float:velocity[3]
  545. pev(ent,pev_origin,origin2)
  546. get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
  547. if(is_user_crouching(i)) origin[2] -= pet_minus_z_crouching[pettype[i]]
  548. else origin[2] -= pet_minus_z_standing[pettype[i]]
  549.  
  550. if(get_distance_f(origin,origin2)>pet_max_distance[pettype[i]])
  551. {
  552. set_pev(ent,pev_origin,origin)
  553. }
  554. else if(get_distance_f(origin,origin2)>pet_min_distance[pettype[i]])
  555. {
  556. get_speed_vector(origin2,origin,250.0,velocity)
  557. set_pev(ent,pev_velocity,velocity)
  558. if(pev(ent,pev_sequence)!=pet_run[pettype[i]] || pev(ent,pev_framerate)!=pet_run_speed[pettype[i]])
  559. {
  560. set_pev(ent,pev_frame,1)
  561. set_pev(ent,pev_sequence,pet_run[pettype[i]])
  562. set_pev(ent,pev_gaitsequence,pet_run[pettype[i]])
  563. set_pev(ent,pev_framerate,pet_run_speed[pettype[i]])
  564. }
  565. }
  566. else if(get_distance_f(origin,origin2)<pet_min_distance[pettype[i]] - 5.0)
  567. {
  568. if(pev(ent,pev_sequence)!=pet_idle[pettype[i]] || pev(ent,pev_framerate)!=pet_idle_speed[pettype[i]])
  569. {
  570. set_pev(ent,pev_frame,1)
  571. set_pev(ent,pev_sequence,pet_idle[pettype[i]])
  572. set_pev(ent,pev_gaitsequence,pet_idle[pettype[i]])
  573. set_pev(ent,pev_framerate,pet_idle_speed[pettype[i]])
  574. }
  575. set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
  576. }
  577. pev(i,pev_origin,origin)
  578. origin[2] = origin2[2]
  579. entity_set_aim(ent,origin)
  580.  
  581. set_pev(ent,pev_nextthink,1.0)
  582. break;
  583. }
  584. }
  585. }
  586.  

_________________
Ha, segítettél mindig meg köszönöm!
De ha, segítettem köszönd meg Te is ! LIKE


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [ZP] Addons : GHW Követő állatok
HozzászólásElküldve: 2014.10.30. 09:21 
Offline
Tud valamit
Avatar

Csatlakozott: 2014.10.28. 14:08
Hozzászólások: 120
Megköszönték neki: 2 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #define VERSION "2.2"
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <chr_engine>
  6.  
  7. #define PET_NUM 17
  8.  
  9. static const pet_name[PET_NUM][32] =
  10. {
  11. "Headcrab",
  12. "Rat",
  13. "Bat",
  14. "Frog",
  15. "Floater",
  16. "Cockroach",
  17. "Hyper Bat",
  18. "Mom",
  19. "Grunt",
  20. "Fish",
  21. "Baby Headcrab",
  22. "Roach",
  23. "Gargantuan",
  24. "Bull Squid",
  25. "Hound Eye",
  26. "Loading Machine",
  27. "Controller"
  28. }
  29.  
  30. static const pet_models[PET_NUM][32] =
  31. {
  32. "models/headcrab.mdl",
  33. "models/bigrat.mdl",
  34. "models/boid.mdl",
  35. "models/chumtoad.mdl",
  36. "models/floater.mdl",
  37. "models/roach.mdl",
  38. "models/stukabat.mdl",
  39. "models/big_mom.mdl",
  40. "models/agrunt.mdl",
  41. "models/archer.mdl",
  42. "models/baby_headcrab.mdl",
  43. "models/roach.mdl",
  44. "models/garg.mdl",
  45. "models/bullsquid.mdl",
  46. "models/houndeye.mdl",
  47. "models/loader.mdl",
  48. "models/controller.mdl"
  49. }
  50.  
  51. static const pet_idle[PET_NUM] =
  52. {
  53. 0,
  54. 1,
  55. 0,
  56. 0,
  57. 0,
  58. 1,
  59. 13,
  60. 0,
  61. 0,
  62. 0,
  63. 1,
  64. 0,
  65. 7,
  66. 1,
  67. 1,
  68. 3,
  69. 3
  70. }
  71.  
  72. static const Float:pet_idle_speed[PET_NUM] =
  73. {
  74. 1.0,
  75. 1.0,
  76. 1.0,
  77. 1.0,
  78. 1.0,
  79. 1.0,
  80. 0.5,
  81. 1.0,
  82. 1.0,
  83. 1.0,
  84. 1.0,
  85. 1.0,
  86. 1.0,
  87. 1.0,
  88. 1.0,
  89. 1.0,
  90. 1.0
  91. }
  92.  
  93. static const pet_run[PET_NUM] =
  94. {
  95. 4,
  96. 4,
  97. 0,
  98. 5,
  99. 0,
  100. 0,
  101. 13,
  102. 3,
  103. 3,
  104. 6,
  105. 4,
  106. 0,
  107. 4,
  108. 0,
  109. 3,
  110. 2,
  111. 9
  112. }
  113.  
  114. static const Float:pet_run_speed[PET_NUM] =
  115. {
  116. 2.0,
  117. 6.0,
  118. 3.0,
  119. 0.75,
  120. 1.0,
  121. 1.0,
  122. 13.0,
  123. 1.0,
  124. 1.0,
  125. 0.6,
  126. 0.6,
  127. 1.0,
  128. 1.0,
  129. 2.0,
  130. 1.0,
  131. 0.4,
  132. 1.0
  133. }
  134.  
  135. static const pet_die[PET_NUM] =
  136. {
  137. 7,
  138. 7,
  139. 0,
  140. 12,
  141. 0,
  142. 0,
  143. 5,
  144. 4,
  145. 22,
  146. 9,
  147. 7,
  148. 1,
  149. 14,
  150. 16,
  151. 6,
  152. 5,
  153. 18
  154. }
  155.  
  156. static const Float:pet_die_length[PET_NUM] =
  157. {
  158. 2.4,
  159. 2.4,
  160. 0.1,
  161. 3.0,
  162. 0.1,
  163. 0.1,
  164. 3.0,
  165. 5.0,
  166. 5.0,
  167. 3.0,
  168. 3.0,
  169. 1.0,
  170. 6.0,
  171. 2.5,
  172. 2.5,
  173. 7.0,
  174. 7.0
  175. }
  176.  
  177. static const Float:pet_minus_z_standing[PET_NUM] =
  178. {
  179. 36.0,
  180. 36.0,
  181. 5.0,
  182. 36.0,
  183. 5.0,
  184. 36.0,
  185. 10.0,
  186. 36.0,
  187. 36.0,
  188. 20.0,
  189. 36.0,
  190. 36.0,
  191. 36.0,
  192. 36.0,
  193. 36.0,
  194. 36.0,
  195. 0.0
  196. }
  197.  
  198. static const Float:pet_minus_z_crouching[PET_NUM] =
  199. {
  200. 16.0,
  201. 16.0,
  202. 6.0,
  203. 16.0,
  204. 6.0,
  205. 16.0,
  206. 11.0,
  207. 16.0,
  208. 16.0,
  209. 30.0,
  210. 16.0,
  211. 16.0,
  212. 16.0,
  213. 16.0,
  214. 16.0,
  215. 16.0,
  216. 0.0
  217. }
  218.  
  219. static const Float:pet_max_distance[PET_NUM] =
  220. {
  221. 300.0,
  222. 300.0,
  223. 300.0,
  224. 300.0,
  225. 300.0,
  226. 300.0,
  227. 300.0,
  228. 1000.0,
  229. 600.0,
  230. 300.0,
  231. 300.0,
  232. 300.0,
  233. 800.0,
  234. 400.0,
  235. 400.0,
  236. 1000.0,
  237. 800.0
  238. }
  239.  
  240. static const Float:pet_min_distance[PET_NUM] =
  241. {
  242. 80.0,
  243. 80.0,
  244. 80.0,
  245. 80.0,
  246. 80.0,
  247. 80.0,
  248. 80.0,
  249. 300.0,
  250. 200.0,
  251. 80.0,
  252. 80.0,
  253. 80.0,
  254. 250.0,
  255. 100.0,
  256. 100.0,
  257. 300.0,
  258. 200.0
  259. }
  260.  
  261. new pet[33]
  262. new pettype[33]
  263. new maxplayers
  264. new pets_off_pcvar
  265. new pets_adminonly_pcvar
  266.  
  267. //menu
  268. new currently_on[33]
  269.  
  270. public plugin_init()
  271. {
  272. register_plugin("GHW Pet Followers",VERSION,"GHW_Chronic")
  273.  
  274. register_concmd("amx_pets","cmd_pets",ADMIN_SLAY," Brings up the menu to turn pets on/admin only/off")
  275. register_menu("PetsMenu",(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"menu_pressed")
  276.  
  277. register_clcmd("say","say_hook")
  278. register_clcmd("say_team","say_hook")
  279.  
  280. register_event("DeathMsg","DeathMsg","a")
  281. register_forward(FM_Think,"FM_Think_hook")
  282.  
  283. pets_off_pcvar = register_cvar("pets_off","0")
  284. pets_adminonly_pcvar = register_cvar("pets_adminonly","1")
  285.  
  286. maxplayers = get_maxplayers()
  287.  
  288. register_dictionary("GHW_Pet_Followers.txt")
  289. }
  290.  
  291. public plugin_precache()
  292. {
  293. for(new i=0;i<PET_NUM;i++) precache_model(pet_models[i])
  294. }
  295.  
  296. public cmd_pets(id,level,cid)
  297. {
  298. if(!cmd_access(id,level,cid,1))
  299. {
  300. return PLUGIN_HANDLED
  301. }
  302.  
  303. currently_on[id] = 0
  304. create_menu(id)
  305.  
  306. return PLUGIN_HANDLED
  307. }
  308.  
  309. public create_menu(id)
  310. {
  311. new Menu[1024]
  312. format(Menu,1023,"GHW Pet Mod^n^n")
  313.  
  314. new keys
  315.  
  316. new current_setting[32]
  317. for(new i=currently_on[id];i<PET_NUM && i<currently_on[id] + 7;i++)
  318. {
  319. if(get_pcvar_num(pets_off_pcvar) & power(2,i))
  320. {
  321. format(current_setting,31,"Off")
  322. }
  323. else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,i))
  324. {
  325. format(current_setting,31,"Admin")
  326. }
  327. else
  328. {
  329. format(current_setting,31,"On")
  330. }
  331. format(Menu,1023,"%s%d. %s \R%s^n",Menu,i - currently_on[id] + 1,pet_name[i],current_setting)
  332.  
  333. keys |= (1<<i - currently_on[id])
  334. }
  335.  
  336. if(currently_on[id] > 0)
  337. {
  338. format(Menu,1023,"%s^n8. Back",Menu)
  339. keys |= (1<<7)
  340. }
  341. if(currently_on[id] + 7 < PET_NUM)
  342. {
  343. format(Menu,1023,"%s^n9. Next",Menu)
  344. keys |= (1<<8)
  345. }
  346.  
  347. format(Menu,1023,"%s^n^n0. Exit",Menu)
  348. keys |= (1<<9)
  349.  
  350. show_menu(id,keys,Menu,-1,"PetsMenu")
  351. }
  352.  
  353. public menu_pressed(id,key)
  354. {
  355. switch(key)
  356. {
  357. case 7:
  358. {
  359. //Back
  360. currently_on[id] -= 7
  361. }
  362. case 8:
  363. {
  364. //Next
  365. currently_on[id] += 7
  366. }
  367. case 9:
  368. {
  369. //Nothing - Exit
  370. return PLUGIN_HANDLED
  371. }
  372. default:
  373. {
  374. //Selected a Pet
  375. if(get_pcvar_num(pets_off_pcvar) & power(2,key + currently_on[id]))
  376. {
  377. set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) - power(2,key + currently_on[id]))//Out of Off list
  378. }
  379. else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,key + currently_on[id]))
  380. {
  381. set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) - power(2,key + currently_on[id]))//Out of Admin list
  382. set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) + power(2,key + currently_on[id]))//Into Off list
  383. }
  384. else
  385. {
  386. set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) + power(2,key + currently_on[id]))//Into Admin list
  387. }
  388. }
  389. }
  390.  
  391. create_menu(id)
  392.  
  393. return PLUGIN_HANDLED
  394. }
  395.  
  396. public client_disconnect(id) handle_DeathMsg(id)
  397.  
  398. public DeathMsg() handle_DeathMsg(read_data(2))
  399.  
  400. public handle_DeathMsg(id)
  401. {
  402. if(pet[id] && pev_valid(pet[id]))
  403. {
  404. set_pev(pet[id],pev_animtime,100.0)
  405. set_pev(pet[id],pev_framerate,1.0)
  406. set_pev(pet[id],pev_sequence,pet_die[pettype[id]])
  407. set_pev(pet[id],pev_gaitsequence,pet_die[pettype[id]])
  408. set_task(pet_die_length[pettype[id]],"remove_pet",pet[id])
  409. }
  410. pet[id]=0
  411. }
  412.  
  413. public remove_pet(ent) if(pev_valid(ent)) engfunc(EngFunc_RemoveEntity,ent)
  414.  
  415. public say_hook(id)
  416. {
  417. new arg[32]
  418. read_argv(1,arg,31)
  419. if(equali(arg,"/pet Headcrab")) pet_cmd_handle(id,0)
  420. else if(equali(arg,"/pet Rat")) pet_cmd_handle(id,1)
  421. else if(equali(arg,"/pet Bat")) pet_cmd_handle(id,2)
  422. else if(equali(arg,"/pet Frog")) pet_cmd_handle(id,3)
  423. else if(equali(arg,"/pet Floater")) pet_cmd_handle(id,4)
  424. else if(equali(arg,"/pet Cockroach")) pet_cmd_handle(id,5)
  425. else if(equali(arg,"/pet Hyper") || equali(arg,"/pet Hyper Bat")) pet_cmd_handle(id,6)
  426. else if(equali(arg,"/pet Mom")) pet_cmd_handle(id,7)
  427. else if(equali(arg,"/pet Grunt")) pet_cmd_handle(id,8)
  428. else if(equali(arg,"/pet Fish")) pet_cmd_handle(id,9)
  429. else if(equali(arg,"/pet Baby Headcrab") || equali(arg,"/pet Baby")) pet_cmd_handle(id,10)
  430. else if(equali(arg,"/pet Roach") || equali(arg,"/pet Cockroach")) pet_cmd_handle(id,11)
  431. else if(equali(arg,"/pet Garg") || equali(arg,"/pet Gargantuan")) pet_cmd_handle(id,12)
  432. else if(equali(arg,"/pet Bull") || equali(arg,"/pet Bull Squid") || equali(arg,"/pet BullSquid") || equali(arg,"/pet Squid")) pet_cmd_handle(id,13)
  433. else if(equali(arg,"/pet Hound") || equali(arg,"/pet Hound Eye") || equali(arg,"/pet HoundEye") || equali(arg,"/pet Eye")) pet_cmd_handle(id,14)
  434. else if(equali(arg,"/pet Loader") || equali(arg,"/pet Loading") || equali(arg,"/pet Machine") || equali(arg,"/pet Loading Machine")) pet_cmd_handle(id,15)
  435. else if(equali(arg,"/pet Boss") || equali(arg,"/pet Controller")) pet_cmd_handle(id,16)
  436. else if(containi(arg,"/pet")==0) pet_cmd_handle(id,random_pet(id))
  437. else if(containi(arg,"/nopet")==0)
  438. {
  439. if(pet[id]) client_print(id,print_chat,"[AMXX] %L",id,"MSG_REMOVEPET")
  440. else client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOREMOVEPET")
  441. handle_DeathMsg(id)
  442. }
  443. }
  444.  
  445. public random_pet(id)
  446. {
  447. new num = random_num(0,PET_NUM-1);
  448.  
  449. if((get_pcvar_num(pets_off_pcvar) & power(2,num)) || ((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id)))
  450. num = random_pet(id)
  451.  
  452. return num;
  453. }
  454.  
  455. public pet_cmd_handle(id,num)
  456. {
  457. if(pet[id])
  458. {
  459. handle_DeathMsg(id)
  460. //client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_HAVE")
  461. }
  462. else if(!is_user_alive(id))
  463. {
  464. client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_DEAD")
  465. }
  466. else
  467. {
  468. if(get_pcvar_num(pets_off_pcvar) & power(2,num))
  469. {
  470. client_print(id,print_chat,"[AMXX] %L",id,"MSG_DISABLED")
  471. }
  472. else if((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id))
  473. {
  474. client_print(id,print_chat,"[AMXX] %L",id,"MSG_ADMINONLY")
  475. }
  476. else
  477. {
  478. pet[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
  479. set_pev(pet[id],pev_classname,"GHW_Pet")
  480. pettype[id] = num
  481. engfunc(EngFunc_SetModel,pet[id],pet_models[pettype[id]])
  482. new Float:origin[3]
  483. pev(id,pev_origin,origin)
  484. if(is_user_crouching(id)) origin[2] -= pet_minus_z_crouching[pettype[id]]
  485. else origin[2] -= pet_minus_z_standing[pettype[id]]
  486. set_pev(pet[id],pev_origin,origin)
  487. set_pev(pet[id],pev_solid,SOLID_NOT)
  488. set_pev(pet[id],pev_movetype,MOVETYPE_FLY)
  489. set_pev(pet[id],pev_owner,33)
  490. set_pev(pet[id],pev_nextthink,1.0)
  491. set_pev(pet[id],pev_sequence,0)
  492. set_pev(pet[id],pev_gaitsequence,0)
  493. set_pev(pet[id],pev_framerate,1.0)
  494. client_print(id,print_chat,"[AMXX] %L",id,"MSG_GIVEPET",pet_name[pettype[id]])
  495. }
  496. }
  497. }
  498.  
  499. public FM_Think_hook(ent)
  500. {
  501. for(new i=0;i<=maxplayers;i++)
  502. {
  503. if(ent==pet[i])
  504. {
  505. static Float:origin[3]
  506. static Float:origin2[3]
  507. static Float:velocity[3]
  508. pev(ent,pev_origin,origin2)
  509. get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
  510. if(is_user_crouching(i)) origin[2] -= pet_minus_z_crouching[pettype[i]]
  511. else origin[2] -= pet_minus_z_standing[pettype[i]]
  512.  
  513. if(get_distance_f(origin,origin2)>pet_max_distance[pettype[i]])
  514. {
  515. set_pev(ent,pev_origin,origin)
  516. }
  517. else if(get_distance_f(origin,origin2)>pet_min_distance[pettype[i]])
  518. {
  519. get_speed_vector(origin2,origin,250.0,velocity)
  520. set_pev(ent,pev_velocity,velocity)
  521. if(pev(ent,pev_sequence)!=pet_run[pettype[i]] || pev(ent,pev_framerate)!=pet_run_speed[pettype[i]])
  522. {
  523. set_pev(ent,pev_frame,1)
  524. set_pev(ent,pev_sequence,pet_run[pettype[i]])
  525. set_pev(ent,pev_gaitsequence,pet_run[pettype[i]])
  526. set_pev(ent,pev_framerate,pet_run_speed[pettype[i]])
  527. }
  528. }
  529. else if(get_distance_f(origin,origin2)<pet_min_distance[pettype[i]] - 5.0)
  530. {
  531. if(pev(ent,pev_sequence)!=pet_idle[pettype[i]] || pev(ent,pev_framerate)!=pet_idle_speed[pettype[i]])
  532. {
  533. set_pev(ent,pev_frame,1)
  534. set_pev(ent,pev_sequence,pet_idle[pettype[i]])
  535. set_pev(ent,pev_gaitsequence,pet_idle[pettype[i]])
  536. set_pev(ent,pev_framerate,pet_idle_speed[pettype[i]])
  537. }
  538. set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
  539. }
  540. pev(i,pev_origin,origin)
  541. origin[2] = origin2[2]
  542. entity_set_aim(ent,origin)
  543.  
  544. set_pev(ent,pev_nextthink,1.0)
  545. break;
  546. }
  547. }
  548. }

_________________
új accom---> raziq.

ezt a "babapiskóta.~" néven lévő hülyeséget töröljétek kérlek.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: [ZP] Addons : GHW Követő állatok
HozzászólásElküldve: 2014.11.10. 07:35 
Offline
Senior Tag

Csatlakozott: 2013.05.22. 17:06
Hozzászólások: 205
Megköszönt másnak: 88 alkalommal
babapiskóta.~ írta:
SMA Forráskód: [ Mindet kijelol ]#define VERSION "2.2"
 
#include <amxmodx>
#include <amxmisc>
#include <chr_engine>
 
#define PET_NUM 17
 
static const pet_name[PET_NUM][32] =
{
"Headcrab",
"Rat",
"Bat",
"Frog",
"Floater",
"Cockroach",
"Hyper Bat",
"Mom",
"Grunt",
"Fish",
"Baby Headcrab",
"Roach",
"Gargantuan",
"Bull Squid",
"Hound Eye",
"Loading Machine",
"Controller"
}
 
static const pet_models[PET_NUM][32] =
{
"models/headcrab.mdl",
"models/bigrat.mdl",
"models/boid.mdl",
"models/chumtoad.mdl",
"models/floater.mdl",
"models/roach.mdl",
"models/stukabat.mdl",
"models/big_mom.mdl",
"models/agrunt.mdl",
"models/archer.mdl",
"models/baby_headcrab.mdl",
"models/roach.mdl",
"models/garg.mdl",
"models/bullsquid.mdl",
"models/houndeye.mdl",
"models/loader.mdl",
"models/controller.mdl"
}
 
static const pet_idle[PET_NUM] =
{
0,
1,
0,
0,
0,
1,
13,
0,
0,
0,
1,
0,
7,
1,
1,
3,
3
}
 
static const Float:pet_idle_speed[PET_NUM] =
{
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
0.5,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0
}
 
static const pet_run[PET_NUM] =
{
4,
4,
0,
5,
0,
0,
13,
3,
3,
6,
4,
0,
4,
0,
3,
2,
9
}
 
static const Float:pet_run_speed[PET_NUM] =
{
2.0,
6.0,
3.0,
0.75,
1.0,
1.0,
13.0,
1.0,
1.0,
0.6,
0.6,
1.0,
1.0,
2.0,
1.0,
0.4,
1.0
}
 
static const pet_die[PET_NUM] =
{
7,
7,
0,
12,
0,
0,
5,
4,
22,
9,
7,
1,
14,
16,
6,
5,
18
}
 
static const Float:pet_die_length[PET_NUM] =
{
2.4,
2.4,
0.1,
3.0,
0.1,
0.1,
3.0,
5.0,
5.0,
3.0,
3.0,
1.0,
6.0,
2.5,
2.5,
7.0,
7.0
}
 
static const Float:pet_minus_z_standing[PET_NUM] =
{
36.0,
36.0,
5.0,
36.0,
5.0,
36.0,
10.0,
36.0,
36.0,
20.0,
36.0,
36.0,
36.0,
36.0,
36.0,
36.0,
0.0
}
 
static const Float:pet_minus_z_crouching[PET_NUM] =
{
16.0,
16.0,
6.0,
16.0,
6.0,
16.0,
11.0,
16.0,
16.0,
30.0,
16.0,
16.0,
16.0,
16.0,
16.0,
16.0,
0.0
}
 
static const Float:pet_max_distance[PET_NUM] =
{
300.0,
300.0,
300.0,
300.0,
300.0,
300.0,
300.0,
1000.0,
600.0,
300.0,
300.0,
300.0,
800.0,
400.0,
400.0,
1000.0,
800.0
}
 
static const Float:pet_min_distance[PET_NUM] =
{
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
300.0,
200.0,
80.0,
80.0,
80.0,
250.0,
100.0,
100.0,
300.0,
200.0
}
 
new pet[33]
new pettype[33]
new maxplayers
new pets_off_pcvar
new pets_adminonly_pcvar
 
//menu
new currently_on[33]
 
public plugin_init()
{
register_plugin("GHW Pet Followers",VERSION,"GHW_Chronic")
 
register_concmd("amx_pets","cmd_pets",ADMIN_SLAY," Brings up the menu to turn pets on/admin only/off")
register_menu("PetsMenu",(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"menu_pressed")
 
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")
 
register_event("DeathMsg","DeathMsg","a")
register_forward(FM_Think,"FM_Think_hook")
 
pets_off_pcvar = register_cvar("pets_off","0")
pets_adminonly_pcvar = register_cvar("pets_adminonly","1")
 
maxplayers = get_maxplayers()
 
register_dictionary("GHW_Pet_Followers.txt")
}
 
public plugin_precache()
{
for(new i=0;i<PET_NUM;i++) precache_model(pet_models[i])
}
 
public cmd_pets(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
 
currently_on[id] = 0
create_menu(id)
 
return PLUGIN_HANDLED
}
 
public create_menu(id)
{
new Menu[1024]
format(Menu,1023,"GHW Pet Mod^n^n")
 
new keys
 
new current_setting[32]
for(new i=currently_on[id];i<PET_NUM && i<currently_on[id] + 7;i++)
{
if(get_pcvar_num(pets_off_pcvar) & power(2,i))
{
format(current_setting,31,"Off")
}
else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,i))
{
format(current_setting,31,"Admin")
}
else
{
format(current_setting,31,"On")
}
format(Menu,1023,"%s%d. %s \R%s^n",Menu,i - currently_on[id] + 1,pet_name[i],current_setting)
 
keys |= (1<<i - currently_on[id])
}
 
if(currently_on[id] > 0)
{
format(Menu,1023,"%s^n8. Back",Menu)
keys |= (1<<7)
}
if(currently_on[id] + 7 < PET_NUM)
{
format(Menu,1023,"%s^n9. Next",Menu)
keys |= (1<<8)
}
 
format(Menu,1023,"%s^n^n0. Exit",Menu)
keys |= (1<<9)
 
show_menu(id,keys,Menu,-1,"PetsMenu")
}
 
public menu_pressed(id,key)
{
switch(key)
{
case 7:
{
//Back
currently_on[id] -= 7
}
case 8:
{
//Next
currently_on[id] += 7
}
case 9:
{
//Nothing - Exit
return PLUGIN_HANDLED
}
default:
{
//Selected a Pet
if(get_pcvar_num(pets_off_pcvar) & power(2,key + currently_on[id]))
{
set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) - power(2,key + currently_on[id]))//Out of Off list
}
else if(get_pcvar_num(pets_adminonly_pcvar) & power(2,key + currently_on[id]))
{
set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) - power(2,key + currently_on[id]))//Out of Admin list
set_pcvar_num(pets_off_pcvar,get_pcvar_num(pets_off_pcvar) + power(2,key + currently_on[id]))//Into Off list
}
else
{
set_pcvar_num(pets_adminonly_pcvar,get_pcvar_num(pets_adminonly_pcvar) + power(2,key + currently_on[id]))//Into Admin list
}
}
}
 
create_menu(id)
 
return PLUGIN_HANDLED
}
 
public client_disconnect(id) handle_DeathMsg(id)
 
public DeathMsg() handle_DeathMsg(read_data(2))
 
public handle_DeathMsg(id)
{
if(pet[id] && pev_valid(pet[id]))
{
set_pev(pet[id],pev_animtime,100.0)
set_pev(pet[id],pev_framerate,1.0)
set_pev(pet[id],pev_sequence,pet_die[pettype[id]])
set_pev(pet[id],pev_gaitsequence,pet_die[pettype[id]])
set_task(pet_die_length[pettype[id]],"remove_pet",pet[id])
}
pet[id]=0
}
 
public remove_pet(ent) if(pev_valid(ent)) engfunc(EngFunc_RemoveEntity,ent)
 
public say_hook(id)
{
new arg[32]
read_argv(1,arg,31)
if(equali(arg,"/pet Headcrab")) pet_cmd_handle(id,0)
else if(equali(arg,"/pet Rat")) pet_cmd_handle(id,1)
else if(equali(arg,"/pet Bat")) pet_cmd_handle(id,2)
else if(equali(arg,"/pet Frog")) pet_cmd_handle(id,3)
else if(equali(arg,"/pet Floater")) pet_cmd_handle(id,4)
else if(equali(arg,"/pet Cockroach")) pet_cmd_handle(id,5)
else if(equali(arg,"/pet Hyper") || equali(arg,"/pet Hyper Bat")) pet_cmd_handle(id,6)
else if(equali(arg,"/pet Mom")) pet_cmd_handle(id,7)
else if(equali(arg,"/pet Grunt")) pet_cmd_handle(id,8)
else if(equali(arg,"/pet Fish")) pet_cmd_handle(id,9)
else if(equali(arg,"/pet Baby Headcrab") || equali(arg,"/pet Baby")) pet_cmd_handle(id,10)
else if(equali(arg,"/pet Roach") || equali(arg,"/pet Cockroach")) pet_cmd_handle(id,11)
else if(equali(arg,"/pet Garg") || equali(arg,"/pet Gargantuan")) pet_cmd_handle(id,12)
else if(equali(arg,"/pet Bull") || equali(arg,"/pet Bull Squid") || equali(arg,"/pet BullSquid") || equali(arg,"/pet Squid")) pet_cmd_handle(id,13)
else if(equali(arg,"/pet Hound") || equali(arg,"/pet Hound Eye") || equali(arg,"/pet HoundEye") || equali(arg,"/pet Eye")) pet_cmd_handle(id,14)
else if(equali(arg,"/pet Loader") || equali(arg,"/pet Loading") || equali(arg,"/pet Machine") || equali(arg,"/pet Loading Machine")) pet_cmd_handle(id,15)
else if(equali(arg,"/pet Boss") || equali(arg,"/pet Controller")) pet_cmd_handle(id,16)
else if(containi(arg,"/pet")==0) pet_cmd_handle(id,random_pet(id))
else if(containi(arg,"/nopet")==0)
{
if(pet[id]) client_print(id,print_chat,"[AMXX] %L",id,"MSG_REMOVEPET")
else client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOREMOVEPET")
handle_DeathMsg(id)
}
}
 
public random_pet(id)
{
new num = random_num(0,PET_NUM-1);
 
if((get_pcvar_num(pets_off_pcvar) & power(2,num)) || ((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id)))
num = random_pet(id)
 
return num;
}
 
public pet_cmd_handle(id,num)
{
if(pet[id])
{
handle_DeathMsg(id)
//client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_HAVE")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat,"[AMXX] %L",id,"MSG_NOGIVEPET_DEAD")
}
else
{
if(get_pcvar_num(pets_off_pcvar) & power(2,num))
{
client_print(id,print_chat,"[AMXX] %L",id,"MSG_DISABLED")
}
else if((get_pcvar_num(pets_adminonly_pcvar) & power(2,num)) && !is_user_admin(id))
{
client_print(id,print_chat,"[AMXX] %L",id,"MSG_ADMINONLY")
}
else
{
pet[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
set_pev(pet[id],pev_classname,"GHW_Pet")
pettype[id] = num
engfunc(EngFunc_SetModel,pet[id],pet_models[pettype[id]])
new Float:origin[3]
pev(id,pev_origin,origin)
if(is_user_crouching(id)) origin[2] -= pet_minus_z_crouching[pettype[id]]
else origin[2] -= pet_minus_z_standing[pettype[id]]
set_pev(pet[id],pev_origin,origin)
set_pev(pet[id],pev_solid,SOLID_NOT)
set_pev(pet[id],pev_movetype,MOVETYPE_FLY)
set_pev(pet[id],pev_owner,33)
set_pev(pet[id],pev_nextthink,1.0)
set_pev(pet[id],pev_sequence,0)
set_pev(pet[id],pev_gaitsequence,0)
set_pev(pet[id],pev_framerate,1.0)
client_print(id,print_chat,"[AMXX] %L",id,"MSG_GIVEPET",pet_name[pettype[id]])
}
}
}
 
public FM_Think_hook(ent)
{
for(new i=0;i<=maxplayers;i++)
{
if(ent==pet[i])
{
static Float:origin[3]
static Float:origin2[3]
static Float:velocity[3]
pev(ent,pev_origin,origin2)
get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
if(is_user_crouching(i)) origin[2] -= pet_minus_z_crouching[pettype[i]]
else origin[2] -= pet_minus_z_standing[pettype[i]]
 
if(get_distance_f(origin,origin2)>pet_max_distance[pettype[i]])
{
set_pev(ent,pev_origin,origin)
}
else if(get_distance_f(origin,origin2)>pet_min_distance[pettype[i]])
{
get_speed_vector(origin2,origin,250.0,velocity)
set_pev(ent,pev_velocity,velocity)
if(pev(ent,pev_sequence)!=pet_run[pettype[i]] || pev(ent,pev_framerate)!=pet_run_speed[pettype[i]])
{
set_pev(ent,pev_frame,1)
set_pev(ent,pev_sequence,pet_run[pettype[i]])
set_pev(ent,pev_gaitsequence,pet_run[pettype[i]])
set_pev(ent,pev_framerate,pet_run_speed[pettype[i]])
}
}
else if(get_distance_f(origin,origin2)<pet_min_distance[pettype[i]] - 5.0)
{
if(pev(ent,pev_sequence)!=pet_idle[pettype[i]] || pev(ent,pev_framerate)!=pet_idle_speed[pettype[i]])
{
set_pev(ent,pev_frame,1)
set_pev(ent,pev_sequence,pet_idle[pettype[i]])
set_pev(ent,pev_gaitsequence,pet_idle[pettype[i]])
set_pev(ent,pev_framerate,pet_idle_speed[pettype[i]])
}
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
}
pev(i,pev_origin,origin)
origin[2] = origin2[2]
entity_set_aim(ent,origin)
 
set_pev(ent,pev_nextthink,1.0)
break;
}
}
}


őszintén ebben mit csináltál ? mert lehet használni mindenkinek :D valaki meg csinálná hogy csak vip-nek lehessen ? ZOMBIE PLAGUE MÓD! meg köszönnöm! :mrgreen:

_________________
Ha, segítettél mindig meg köszönöm!
De ha, segítettem köszönd meg Te is ! LIKE


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  [ 3 hozzászólás ] 


Ki van itt

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