Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. // LAST EDIT ON : 11.07.2019 / 22:54
  2.  
  3. /*
  4. set_pev(player_ent[id],pev_skin,0)//0 nr la model
  5. set_pev(player_ent[id],pev_body,0) // pe corp asta..la noob??
  6. set_pev(entity, pev_sequence,1)
  7. pev(entindex, pev_body)
  8.  
  9. entity_set_int(entindex, EV_INT_body, num)
  10. entity_get_int(entindex, EV_INT_body)
  11. set_animation(id,random_num(1,2))
  12. dllfunc( DLLFunc_ClientUserInfoChanged, id, engfunc( EngFunc_GetInfoKeyBuffer, id ) );
  13.  
  14. iWep = give_item(id, "your_weapon")
  15. engfunc(EngFunc_SetModel, iWep, "P MODEL")
  16. set_pev(iWep, pev_body, your submodel number)
  17. fm_set_entity_visibility(iWep, 1)
  18. set_pev(id, pev_viewmodel2, "")
  19.  
  20. SendWeaponAnim(id, iAnim)
  21. {
  22. set_pev(id, pev_weaponanim, iAnim)
  23.  
  24. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id)
  25. write_byte(iAnim)
  26. write_byte(pev(id,pev_body))
  27. message_end()
  28. }
  29. */
  30.  
  31. #include <amxmodx>
  32. #include <fun>
  33. #include <fakemeta>
  34. #include <engine>
  35.  
  36. #pragma tabsize 0
  37.  
  38. new ak47[33]=""
  39.  
  40. enum _:Data
  41. {
  42. Nume_Model[35],
  43. v_Model[65],
  44. p_Model[65],
  45. w_Model[65],//csf..nu e necesar, da dacă ai la model poți pune
  46. NrBMP//numerotarea e de la 1 până la X-(setat mai jos)
  47. }
  48.  
  49. new const INFOS[][Data]=
  50. { //aici e w_, da poți lăsa așa - "" dacă nu vrei să pui, sau nu are
  51. { "AK-47 MODAT", "v_ak47_mod", "p_ak47_mod", "", 10 }//10 .bmp(texturi) incluse în skin..
  52. }
  53.  
  54. public plugin_init()
  55. {
  56. register_clcmd("say /ak47","AK")
  57. register_clcmd("say_team /ak47","AK")
  58.  
  59. register_event("CurWeapon","Event_CurWeapon","be","1=1")
  60. register_forward(FM_SetModel, "fw_SetModel")
  61. }
  62.  
  63. public plugin_precache()
  64. {
  65. for(new i;i<sizeof(INFOS);i++)//charsmax
  66. {
  67. if(!equal(INFOS[i][v_Model],"")) precache_player_model(INFOS[i][v_Model])
  68. if(!equal(INFOS[i][p_Model],"")) precache_player_model(INFOS[i][p_Model])
  69. if(!equal(INFOS[i][w_Model],"")) precache_player_model(INFOS[i][w_Model])
  70. }
  71. }
  72. precache_player_model(szModel[])
  73. {
  74. static szFile[128]
  75. formatex(szFile,charsmax(szFile),"models/ak47/%s.mdl",szModel)
  76. precache_model(szFile)
  77.  
  78. //defined
  79. //if(contain(charsmax(szFile)-5,"T")!=-1)
  80. replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
  81. if(file_exists(szFile)) precache_model(szFile)
  82. }
  83.  
  84. public Event_CurWeapon(id)
  85. {
  86. if(!is_user_alive(id)||equal(ak47[id],"")) return
  87. if(!equal(INFOS[ak47[id]][v_Model],"")) set_pev(id,pev_viewmodel2,INFOS[ak47[id]][v_Model])
  88. if(!equal(INFOS[ak47[id]][p_Model],"")) set_pev(id,pev_weaponmodel2,INFOS[ak47[id]][p_Model])
  89. engclient_cmd(id,"weapon_ak47")
  90. }
  91.  
  92. public fw_SetModel(entity, model[])
  93. {
  94. if(!is_valid_ent(entity))
  95. return FMRES_IGNORED
  96.  
  97. static iOwner
  98. iOwner = entity_get_edict(entity, EV_ENT_owner)
  99.  
  100. if(!equal(model,INFOS[ak47[iOwner]][w_Model])&&!equal(INFOS[ak47[iOwner]][w_Model],""))//xd
  101. return FMRES_IGNORED
  102.  
  103. new className[33]
  104. entity_get_string(entity, EV_SZ_classname, className, 32)
  105.  
  106. if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
  107. {
  108. entity_set_model(entity,INFOS[ak47[iOwner]][w_Model])
  109. return FMRES_SUPERCEDE
  110. }
  111. return FMRES_IGNORED
  112. }
  113.  
  114. public client_putinserver(id) ak47[id]=EOS
  115. public client_disconnect(id) ak47[id]=EOS
  116.  
  117. public AK(id)
  118. {
  119. new menu=menu_create("Alege un Skin pentru AK47","choosed_options")
  120. new callback=menu_makecallback("hook_shop")//idk
  121. static text[125],i,tasta[2]
  122.  
  123. for(i=0;i<sizeof INFOS;i++)
  124. {
  125. if(ak47[id]==i) formatex(text,charsmax(text),"\d%s\w [\rSELECTAT\w]",INFOS[i][Nume_Model])
  126. else formatex(text,charsmax(text),"\r%s",INFOS[i][Nume_Model])
  127.  
  128. tasta[0]=i
  129. tasta[1]=0
  130. menu_additem(menu, text, tasta, _, callback)
  131. }
  132.  
  133. menu_display(id,menu,0)
  134. }
  135. public hook_shop(id,menu,item)
  136. {
  137. if(item==MENU_EXIT)
  138. {
  139. menu_destroy(menu)
  140. return PLUGIN_HANDLED
  141. }
  142.  
  143. if(!is_user_alive(id)||ak47[id]==item) return ITEM_DISABLED
  144.  
  145. return ITEM_ENABLED
  146. }
  147.  
  148. public choosed_options(id,menu,item)
  149. {
  150. if(item==MENU_EXIT||!is_user_alive(id))
  151. {
  152. menu_destroy(menu)
  153. return PLUGIN_HANDLED
  154. }
  155.  
  156. new rand //numărătoarea e de la 1 cică
  157. rand=random_num(1,INFOS[item][NrBMP])
  158.  
  159. if(ak47[id]==rand)
  160. {
  161. client_print(id,print_chat,"* Ai deja %s",INFOS[rand][Nume_Model])
  162. return PLUGIN_HANDLED
  163. }
  164.  
  165. client_print(id,print_chat,"* Ai ales cu succes modelul %s cu skinul %d din %d",INFOS[rand][Nume_Model],rand,INFOS[rand][NrBMP])//clamp/max/charsmax...
  166. ak47[id]=rand
  167. new iWep
  168. iWep = give_item(id, "weapon_ak47")
  169. engfunc(EngFunc_SetModel, iWep, INFOS[ak47[id]][p_Model])
  170. set_pev(iWep, pev_body, ak47[id])
  171. set_pev(INFOS[ak47[id]][p_Model],pev_skin,ak47[id])
  172. Event_CurWeapon(id)//xx
  173. //eng
  174.  
  175. menu_destroy(menu)
  176. return PLUGIN_HANDLED
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement