Solved help

Unpaid Requests, Public Plugins
Post Reply
playcs
Member
Member
Posts: 5
Joined: 7 years ago
Contact:

help

#1

Post by playcs » 7 years ago

how to convert a extra item from zp to ze? some tutrial ?

Also Is there a plugin can make vip have a minigun on a flag I have level systeem to, so they need 2slots for it. I tryed everything but not working.
Its not allowing to have 2weapons.

Thanks if I can be helped!

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 7 years ago

-I don't need to make TUT for this as the steps is in some plugins will be different so i prefer not to do. I'll now give you example but please make sure this is only is example and things maybe different in some other cases. Basicly you will be able to convert from ZP5.0 to our Mod simple than convert ZP4.3 one. Anyway try follow these steps.

1- Zombie Plague 4.3 >> Zombie Escape Convert Forwards:
  • Remove these lines:

    1. #include <amxmodx>
    2. #include <fakemeta>
    3. #include <fun>
    4. #include <hamsandwich>
    5. #include <cstrike>
    6. #include <zombieplague>

    And add these ones instead:

    1. #include <zombie_escape>
    2. #include <cstrike>

    This simply because these includes is already included in our zombie_escape.inc
  • Add these lines anywhere, And these lines which decide if this item for Humans or for Zombies:

    1. public ze_select_item_pre(id, itemid)
    2. {
    3.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    4.     if (itemid != g_itemid)
    5.         return ZE_ITEM_AVAILABLE
    6.    
    7.     // Available for Humans only, So don't show it for zombies
    8.     if (ze_is_user_zombie(id))
    9.         return ZE_ITEM_DONT_SHOW
    10.    
    11.     return ZE_ITEM_AVAILABLE
    12. }
  • Change these lines:

    1. public zp_extra_item_selected(player, itemid)
    2. {
    3.     if ( itemid == g_itemid )
    4.     {
    5.         if ( user_has_weapon(player, CSW_M4A1) )
    6.         {
    7.             drop_prim(player)
    8.         }
    9.        
    10.         give_item(player, "weapon_m4a1")
    11.         client_print(player, print_chat, "[ZP] You bought Golden M4A1")
    12.         g_HasM4[player] = true;
    13.     }
    14. }

    To:

    1. public ze_select_item_post(player, itemid)
    2. {
    3.     if (itemid != g_itemid)
    4.         return
    5.    
    6.     if (user_has_weapon(player, CSW_M4A1))
    7.     {
    8.         drop_prim(player)
    9.     }
    10.        
    11.     give_item(player, "weapon_m4a1")
    12.     client_print(player, print_chat, "[ZP] You bought Golden M4A1")
    13.     g_HasM4[player] = true;
    14. }
Convert Natives:
Final Code:
    1. #include <zombie_escape>
    2. #include <cstrike>
    3.  
    4. #define is_valid_player(%1) (1 <= %1 <= 32)
    5.  
    6. new M4_V_MODEL[64] = "models/zombie_plague/v_golden_m4a1_UP.mdl"
    7. new M4_P_MODEL[64] = "models/zombie_plague/p_golden_m4a1_UP.mdl"
    8.  
    9. /* Pcvars */
    10. new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip
    11.  
    12. // Item ID
    13. new g_itemid
    14.  
    15. new bool:g_HasM4[33]
    16.  
    17. new g_hasZoom[ 33 ]
    18. new bullets[ 33 ]
    19.  
    20. // Sprite
    21. new m_spriteTexture
    22.  
    23. const Wep_m4a1 = ((1<<CSW_M4A1))
    24.  
    25. public plugin_init()
    26. {
    27.    
    28.     /* CVARS */
    29.     cvar_dmgmultiplier = register_cvar("zp_goldenm4_dmg_multiplier", "12")
    30.     cvar_custommodel = register_cvar("zp_goldenm4_custom_model", "1")
    31.     cvar_goldbullets = register_cvar("zp_goldenm4_gold_bullets", "1")
    32.     cvar_uclip = register_cvar("zp_goldenm4_unlimited_clip", "1")
    33.    
    34.     // Register The Plugin
    35.     register_plugin("[ZE] Extra: Golden M4A1", "1.1", "Bill=Thailand=[UP]")
    36.     // Register Zombie Plague extra item
    37.    
    38.     g_itemid = ze_register_item("Golden M4A1", 20)
    39.     // Death Msg
    40.     register_event("DeathMsg", "Death", "a")
    41.     // Weapon Pick Up
    42.     register_event("WeapPickup","checkModel","b","1=19")
    43.     // Current Weapon Event
    44.     register_event("CurWeapon","checkWeapon","be","1=1")
    45.     register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
    46.     // Ham TakeDamage
    47.     RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    48.     register_forward( FM_CmdStart, "fw_CmdStart" )
    49.     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
    50.    
    51. }
    52.  
    53. public client_connect(id)
    54. {
    55.     g_HasM4[id] = false
    56. }
    57.  
    58. public client_disconnect(id)
    59. {
    60.     g_HasM4[id] = false
    61. }
    62.  
    63. public Death()
    64. {
    65.     g_HasM4[read_data(2)] = false
    66. }
    67.  
    68. public fwHamPlayerSpawnPost(id)
    69. {
    70.     g_HasM4[id] = false
    71. }
    72.  
    73. public plugin_precache()
    74. {
    75.     precache_model(M4_V_MODEL)
    76.     precache_model(M4_P_MODEL)
    77.     m_spriteTexture = precache_model("sprites/dot.spr")
    78.     precache_sound("weapons/zoom.wav")
    79. }
    80.  
    81. public ze_user_infected(id, iInfector)
    82. {
    83.     if (ze_is_user_zombie(id))
    84.     {
    85.         g_HasM4[id] = false
    86.     }
    87. }
    88.  
    89. public checkModel(id)
    90. {
    91.     if (ze_is_user_zombie(id))
    92.         return PLUGIN_HANDLED
    93.    
    94.     new szWeapID = read_data(2)
    95.    
    96.     if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && get_pcvar_num(cvar_custommodel) )
    97.     {
    98.         set_pev(id, pev_viewmodel2, M4_V_MODEL)
    99.         set_pev(id, pev_weaponmodel2, M4_P_MODEL)
    100.     }
    101.     return PLUGIN_HANDLED
    102. }
    103.  
    104. public checkWeapon(id)
    105. {
    106.     new plrClip, plrAmmo, plrWeap[32]
    107.     new plrWeapId
    108.    
    109.     plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
    110.    
    111.     if (plrWeapId == CSW_M4A1 && g_HasM4[id])
    112.     {
    113.         checkModel(id)
    114.     }
    115.     else
    116.     {
    117.         return PLUGIN_CONTINUE
    118.     }
    119.    
    120.     if (plrClip == 0 && get_pcvar_num(cvar_uclip))
    121.     {
    122.         // If the user is out of ammo..
    123.         get_weaponname(plrWeapId, plrWeap, 31)
    124.         // Get the name of their weapon
    125.         give_item(id, plrWeap)
    126.         engclient_cmd(id, plrWeap)
    127.         engclient_cmd(id, plrWeap)
    128.         engclient_cmd(id, plrWeap)
    129.     }
    130.     return PLUGIN_HANDLED
    131. }
    132.  
    133.  
    134.  
    135. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
    136. {
    137.     if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_M4A1 && g_HasM4[attacker] )
    138.     {
    139.         SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
    140.     }
    141. }
    142.  
    143. public fw_CmdStart( id, uc_handle, seed )
    144. {
    145.     if( !is_user_alive( id ) )
    146.         return PLUGIN_HANDLED
    147.    
    148.     if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
    149.     {
    150.         new szClip, szAmmo
    151.         new szWeapID = get_user_weapon( id, szClip, szAmmo )
    152.        
    153.         if( szWeapID == CSW_M4A1 && g_HasM4[id] == true && !g_hasZoom[id] == true)
    154.         {
    155.             g_hasZoom[id] = true
    156.             cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
    157.             emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
    158.         }
    159.        
    160.         else if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && g_hasZoom[id])
    161.         {
    162.             g_hasZoom[ id ] = false
    163.             cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
    164.            
    165.         }
    166.        
    167.     }
    168.     return PLUGIN_HANDLED
    169. }
    170.  
    171.  
    172. public make_tracer(id)
    173. {
    174.     if (get_pcvar_num(cvar_goldbullets))
    175.     {
    176.         new clip,ammo
    177.         new wpnid = get_user_weapon(id,clip,ammo)
    178.         new pteam[16]
    179.        
    180.         get_user_team(id, pteam, 15)
    181.        
    182.         if ((bullets[id] > clip) && (wpnid == CSW_M4A1) && g_HasM4[id])
    183.         {
    184.             new vec1[3], vec2[3]
    185.             get_user_origin(id, vec1, 1) // origin; your camera point.
    186.             get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
    187.            
    188.            
    189.             //BEAMENTPOINTS
    190.             message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
    191.             write_byte (0)     //TE_BEAMENTPOINTS 0
    192.             write_coord(vec1[0])
    193.             write_coord(vec1[1])
    194.             write_coord(vec1[2])
    195.             write_coord(vec2[0])
    196.             write_coord(vec2[1])
    197.             write_coord(vec2[2])
    198.             write_short( m_spriteTexture )
    199.             write_byte(1) // framestart
    200.             write_byte(5) // framerate
    201.             write_byte(2) // life
    202.             write_byte(10) // width
    203.             write_byte(0) // noise
    204.             write_byte( 255 )     // r, g, b
    205.             write_byte( 215 )       // r, g, b
    206.             write_byte( 0 )       // r, g, b
    207.             write_byte(200) // brightness
    208.             write_byte(150) // speed
    209.             message_end()
    210.         }
    211.    
    212.         bullets[id] = clip
    213.     }
    214.    
    215. }
    216.  
    217. public ze_select_item_pre(id, itemid)
    218. {
    219.     // Return Available and we will block it in Post, So it dosen't affect other plugins
    220.     if (itemid != g_itemid)
    221.         return ZE_ITEM_AVAILABLE
    222.    
    223.     // Available for Humans only, So don't show it for zombies
    224.     if (ze_is_user_zombie(id))
    225.         return ZE_ITEM_DONT_SHOW
    226.    
    227.     return ZE_ITEM_AVAILABLE
    228. }
    229.  
    230. public ze_select_item_post(player, itemid)
    231. {
    232.     if (itemid != g_itemid)
    233.         return
    234.    
    235.     if (user_has_weapon(player, CSW_M4A1))
    236.     {
    237.         drop_prim(player)
    238.     }
    239.        
    240.     give_item(player, "weapon_m4a1")
    241.     client_print(player, print_chat, "[ZP] You bought Golden M4A1")
    242.     g_HasM4[player] = true;
    243. }
    244.  
    245. stock drop_prim(id)
    246. {
    247.     new weapons[32], num
    248.     get_user_weapons(id, weapons, num)
    249.     for (new i = 0; i < num; i++) {
    250.         if (Wep_m4a1 & (1<<weapons[i]))
    251.         {
    252.             static wname[32]
    253.             get_weaponname(weapons[i], wname, sizeof wname - 1)
    254.             engclient_cmd(id, "drop", wname)
    255.         }
    256.     }
    257. }

    [ZE] Extra-Golden M4A1.zip
    Golden M4A1
    (7.43 KiB) Downloaded 354 times
    [ZE] Extra-Golden M4A1.zip
    Golden M4A1
    (7.43 KiB) Downloaded 354 times

1- Zombie Plague 5.0 >> Zombie Escape
  • We will try convert this Item: Skull-3
Convert Forwards:
  • Remove these lines:

    1. #include <amxmodx>
    2. #include <engine>
    3. #include <fakemeta>
    4. #include <fakemeta_util>
    5. #include <hamsandwich>
    6. #include <cstrike>
    7. #include <fun>
    8. #include <zp50_core>
    9. #include <zp50_items>

    And add these ones instead:

    1. #include <zombie_escape>
    2. #include <cstrike>

    This simply because these includes is already included in our zombie_escape.inc
  • Change these lines:

    1. public zp_fw_items_select_pre(id, itemid, ignorecost)
    2. {
    3.     if (itemid != g_skull3_id)
    4.         return ZP_ITEM_AVAILABLE;
    5.     if (zp_core_is_zombie(id))
    6.         return ZP_ITEM_DONT_SHOW
    7.    
    8.     return ZP_ITEM_AVAILABLE;
    9. }
    10.  
    11. public zp_fw_items_select_post(id, itemid, ignorecost)
    12. {
    13.     if(itemid != g_skull3_id)
    14.         return PLUGIN_HANDLED
    15.    
    16.     drop_weapons(id, 1)
    17.    
    18.     g_had_skull3[id] = 1
    19.     g_skull3_mode[id] = 1
    20.     g_skull3_ammo[id] = 200
    21.     g_skull3_changing[id] = 0
    22.     g_zoomed[id] = 0
    23.     g_oldspeed[id] = get_user_maxspeed(id)
    24.    
    25.     give_item(id, weapon_skull3_m1)
    26.     give_item(id, weapon_skull3_m2)
    27.    
    28.     static skull3_ent
    29.    
    30.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m1, id)
    31.     set_pev(skull3_ent, pev_iuser4, SKULL3_M1_KEY)
    32.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m1))
    33.     cs_set_user_bpammo(id, CSW_SKULL3_M1, g_skull3_ammo[id])
    34.    
    35.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m2, id)
    36.     set_pev(skull3_ent, pev_iuser4, SKULL3_M2_KEY)
    37.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m2))
    38.     cs_set_user_bpammo(id, CSW_SKULL3_M2, g_skull3_ammo[id])
    39.    
    40.     engclient_cmd(id, weapon_skull3_m1)
    41.    
    42.     return PLUGIN_CONTINUE
    43. }

    To:

    1. public ze_select_item_pre(id, itemid, ignorecost)
    2. {
    3.     if (itemid != g_skull3_id)
    4.         return ZE_ITEM_AVAILABLE;
    5.    
    6.     if (ze_is_user_zombie(id))
    7.         return ZE_ITEM_DONT_SHOW
    8.    
    9.     return ZE_ITEM_AVAILABLE;
    10. }
    11.  
    12. public ze_select_item_post(id, itemid, ignorecost)
    13. {
    14.     if(itemid != g_skull3_id)
    15.         return
    16.    
    17.     drop_weapons(id, 1)
    18.    
    19.     g_had_skull3[id] = 1
    20.     g_skull3_mode[id] = 1
    21.     g_skull3_ammo[id] = 200
    22.     g_skull3_changing[id] = 0
    23.     g_zoomed[id] = 0
    24.     g_oldspeed[id] = get_user_maxspeed(id)
    25.    
    26.     give_item(id, weapon_skull3_m1)
    27.     give_item(id, weapon_skull3_m2)
    28.    
    29.     static skull3_ent
    30.    
    31.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m1, id)
    32.     set_pev(skull3_ent, pev_iuser4, SKULL3_M1_KEY)
    33.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m1))
    34.     cs_set_user_bpammo(id, CSW_SKULL3_M1, g_skull3_ammo[id])
    35.    
    36.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m2, id)
    37.     set_pev(skull3_ent, pev_iuser4, SKULL3_M2_KEY)
    38.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m2))
    39.     cs_set_user_bpammo(id, CSW_SKULL3_M2, g_skull3_ammo[id])
    40.    
    41.     engclient_cmd(id, weapon_skull3_m1)
    42. }
Convert Natives:
Final Code:
    1. #include <zombie_escape>
    2. #include <cstrike>
    3.  
    4. #define PLUGIN "[ZE] Primary Weapon: Skull-3"
    5. #define VERSION "1.0"
    6. #define AUTHOR "Dias"
    7.  
    8. #define weapon_skull3_m1 "weapon_mp5navy"
    9. #define weapon_skull3_m2 "weapon_p90"
    10. #define CSW_SKULL3_M1 CSW_MP5NAVY
    11. #define CSW_SKULL3_M2 CSW_P90
    12. #define SKULL3_M1_KEY 2082
    13. #define SKULL3_M2_KEY 2086
    14.  
    15. const SILENT_BS = ((1<<CSW_USP)|(1<<CSW_SKULL3_M1))
    16. const SILENT_BS2 = ((1<<CSW_USP)|(1<<CSW_SKULL3_M2))
    17. stock const g_iDftMaxClip[CSW_P90+1] = {
    18.     -1,  13, -1, 10,  1,  7,    1, 30, 30,  1,  30,
    19.     20, 25, 30, 35, 25,   12, 20, 10, 30, 100,
    20. 8 , 30, 30, 20,  2,    7, 30, 30, -1,  50}
    21. stock const Float:g_fDelay[CSW_P90+1] = {
    22.     0.00, 2.70, 0.00, 2.00, 0.00, 0.55,   0.00, 3.15, 3.30, 0.00, 4.50,
    23.     2.70, 3.50, 3.35, 2.45, 3.30,   2.70, 2.20, 2.50, 2.63, 4.70,
    24.     0.55, 3.05, 2.12, 3.50, 0.00,   2.20, 3.00, 2.45, 0.00, 3.40
    25. }
    26.  
    27. new const WEAPONENTNAMES[][] =
    28. {
    29.     "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
    30.     "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
    31.     "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_m249",
    32.     "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
    33.     "weapon_ak47", "weapon_knife"
    34. }
    35.  
    36. const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
    37.  
    38. new g_skull3_id
    39. new g_had_skull3[33], g_skull3_mode[33], g_skull3_ammo[33], g_skull3_changing[33],
    40. g_zoomed[33], g_remove_ent[33], g_blood, g_bloodspray, g_pbe_skull3_m1,
    41. g_pbe_skull3_m2, g_is_attacking[33],  Float:g_zoom_time[33], g_skull3_m2_ammo[33],
    42. Float:g_recoil[33], g_shot_anim[33], g_skull3_clip[33], g_reload[33], g_reg
    43. new cvar_recoil_m1, cvar_recoil_m2, cvar_clip_m1, cvar_clip_m2, cvar_speed_m1, cvar_speed_m2,
    44. cvar_damage_m1, cvar_damage_m2, cvar_decrease_speed
    45. new Float:g_oldspeed[33]
    46.  
    47. new const v_model[] = "models/zombie_plague/v_skull3.mdl"
    48. new const v_model2[] = "models/zombie_plague/v_skull3_2.mdl"
    49. new const p_model[] = "models/zombie_plague/p_skull3.mdl"
    50. new const p_model2[] = "models/zombie_plague/p_skull3dual.mdl"
    51. new const w_model[] = "models/zombie_plague/w_skull3.mdl"
    52.  
    53. new const skull3_sound[5][] =
    54. {
    55.     "weapons/skull3_shoot.wav",
    56.     "weapons/skull3_shoot_2.wav",
    57.     "weapons/skull3_idle.wav",
    58.     "weapons/skull3_clipin.wav",
    59.     "weapons/skull3_boltpull.wav"
    60. }
    61.  
    62. public plugin_init()
    63. {
    64.     register_plugin(PLUGIN, VERSION, AUTHOR)
    65.    
    66.     g_skull3_id = ze_register_item("Skull-3 (Double Weapon)", 30)
    67.    
    68.     register_forward(FM_CmdStart, "fw_CmdStart")
    69.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)   
    70.     register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
    71.     register_forward(FM_SetModel, "fw_SetModel")   
    72.    
    73.     RegisterHam(Ham_Spawn, "player", "ham_spawn_player_post", 1)
    74.     RegisterHam(Ham_Item_AddToPlayer, weapon_skull3_m1, "ham_add_skull3_m1", 1)
    75.     RegisterHam(Ham_Item_AddToPlayer, weapon_skull3_m2, "ham_add_skull3_m2", 1)
    76.     RegisterHam(Ham_CS_Weapon_SendWeaponAnim, weapon_skull3_m1, "ham_anim_skull3_m1", 1)
    77.     RegisterHam(Ham_CS_Weapon_SendWeaponAnim, weapon_skull3_m2, "ham_anim_skull3_m2", 1)
    78.     RegisterHam(Ham_Item_Deploy, weapon_skull3_m1, "ham_deploy_skull3_m1", 1)
    79.     RegisterHam(Ham_Item_Deploy, weapon_skull3_m2, "ham_deploy_skull3_m2", 1)
    80.    
    81.     for (new i = 1; i <= CSW_P90 - 2; i++)
    82.     {
    83.         if (strlen(WEAPONENTNAMES[i]) && !equal(WEAPONENTNAMES[i], "weapon_knife"))
    84.             RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Ham_Item_Deploy_Post", 1)
    85.     }
    86.    
    87.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_skull3_m1, "ham_attack_skull3")
    88.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_skull3_m2, "ham_attack_skull3")
    89.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_skull3_m1, "ham_attack_skull3_post", 1)   
    90.     RegisterHam(Ham_Weapon_PrimaryAttack, weapon_skull3_m2, "ham_attack_skull3_post", 1)   
    91.     RegisterHam(Ham_Weapon_Reload, weapon_skull3_m1, "ham_reload_skull3")
    92.     RegisterHam(Ham_Weapon_Reload, weapon_skull3_m2, "ham_reload_skull3")
    93.     RegisterHam(Ham_Weapon_Reload, weapon_skull3_m1, "ham_reload_skull3_post", 1)
    94.     RegisterHam(Ham_Weapon_Reload, weapon_skull3_m2, "ham_reload_skull3_post", 1)
    95.     RegisterHam(Ham_Item_PostFrame, weapon_skull3_m1, "ham_postframe_skull3")
    96.     RegisterHam(Ham_Item_PostFrame, weapon_skull3_m2, "ham_postframe_skull3")
    97.    
    98.     RegisterHam(Ham_TraceAttack, "worldspawn", "ham_traceattack")
    99.     RegisterHam(Ham_TraceAttack, "player", "ham_traceattack")
    100.    
    101.     cvar_recoil_m1 = register_cvar("skull3_recoil_m1", "0.46")
    102.     cvar_recoil_m2 = register_cvar("skull3_recoil_m2", "0.56")
    103.     cvar_clip_m1 = register_cvar("skull3_clip_m1", "35")
    104.     cvar_clip_m2 = register_cvar("skull3_clip_m2", "70")
    105.     cvar_speed_m1 = register_cvar("skull3_speed_m1", "1.35")
    106.     cvar_speed_m2 = register_cvar("skull3_speed_m2", "1.28")
    107.     cvar_damage_m1 = register_cvar("skull3_damage_m1", "27")
    108.     cvar_damage_m2 = register_cvar("skull3_damage_m2", "31")
    109.     cvar_decrease_speed = register_cvar("skull3_decrease_speed", "110.0")
    110.    
    111.     register_event("CurWeapon", "event_checkweapon", "be", "1=1")
    112.    
    113.     register_clcmd("drop", "cmd_drop")
    114.     register_clcmd("weapon_skull3", "hook_change_weapon1")
    115.     register_clcmd("weapon_skull3_2", "hook_change_weapon2")
    116. }
    117.  
    118. public plugin_precache()
    119. {
    120.     engfunc(EngFunc_PrecacheModel, v_model)
    121.     engfunc(EngFunc_PrecacheModel, v_model2)
    122.     engfunc(EngFunc_PrecacheModel, p_model)
    123.     engfunc(EngFunc_PrecacheModel, p_model2)
    124.     engfunc(EngFunc_PrecacheModel, w_model)
    125.    
    126.     for(new i = 0; i < sizeof(skull3_sound); i++)
    127.         engfunc(EngFunc_PrecacheSound, skull3_sound[i])
    128.    
    129.     engfunc(EngFunc_PrecacheGeneric, "sprites/skull3_hud.spr")
    130.     engfunc(EngFunc_PrecacheGeneric, "sprites/skull3_ammo.spr")
    131.     engfunc(EngFunc_PrecacheGeneric, "sprites/weapon_skull3.txt")
    132.     engfunc(EngFunc_PrecacheGeneric, "sprites/weapon_skull3_2.txt")
    133.    
    134.     g_blood = precache_model("sprites/blood.spr")
    135.     g_bloodspray = precache_model("sprites/bloodspray.spr")        
    136.    
    137.     register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1)
    138. }
    139.  
    140. public fw_PrecacheEvent_Post(type, const name[])
    141. {
    142.     if(equal("events/mp5n.sc", name))
    143.     {
    144.         g_pbe_skull3_m1 = get_orig_retval()
    145.         return FMRES_HANDLED
    146.     } else if(equal("events/p90.sc", name)) {
    147.         g_pbe_skull3_m2 = get_orig_retval()
    148.         return FMRES_HANDLED
    149.     }
    150.  
    151.     return FMRES_IGNORED
    152. }
    153.  
    154. public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
    155. {
    156.     if (!(1 <= invoker <= get_maxplayers()))
    157.         return FMRES_IGNORED   
    158.     if(!g_is_attacking[invoker])
    159.         return FMRES_IGNORED
    160.     if(eventid == g_pbe_skull3_m1 || eventid == g_pbe_skull3_m2)
    161.         playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
    162.    
    163.     return FMRES_SUPERCEDE
    164. }
    165.  
    166. public ze_select_item_pre(id, itemid, ignorecost)
    167. {
    168.     if (itemid != g_skull3_id)
    169.         return ZE_ITEM_AVAILABLE;
    170.    
    171.     if (ze_is_user_zombie(id))
    172.         return ZE_ITEM_DONT_SHOW
    173.    
    174.     return ZE_ITEM_AVAILABLE;
    175. }
    176.  
    177. public ze_select_item_post(id, itemid, ignorecost)
    178. {
    179.     if(itemid != g_skull3_id)
    180.         return
    181.    
    182.     drop_weapons(id, 1)
    183.    
    184.     g_had_skull3[id] = 1
    185.     g_skull3_mode[id] = 1
    186.     g_skull3_ammo[id] = 200
    187.     g_skull3_changing[id] = 0
    188.     g_zoomed[id] = 0
    189.     g_oldspeed[id] = get_user_maxspeed(id)
    190.    
    191.     give_item(id, weapon_skull3_m1)
    192.     give_item(id, weapon_skull3_m2)
    193.    
    194.     static skull3_ent
    195.    
    196.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m1, id)
    197.     set_pev(skull3_ent, pev_iuser4, SKULL3_M1_KEY)
    198.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m1))
    199.     cs_set_user_bpammo(id, CSW_SKULL3_M1, g_skull3_ammo[id])
    200.    
    201.     skull3_ent = fm_find_ent_by_owner(-1, weapon_skull3_m2, id)
    202.     set_pev(skull3_ent, pev_iuser4, SKULL3_M2_KEY)
    203.     cs_set_weapon_ammo(skull3_ent, get_pcvar_num(cvar_clip_m2))
    204.     cs_set_user_bpammo(id, CSW_SKULL3_M2, g_skull3_ammo[id])
    205.    
    206.     engclient_cmd(id, weapon_skull3_m1)
    207. }
    208.  
    209. public ham_spawn_player_post(id)
    210. {
    211.     remove_skull3(id)
    212. }
    213.  
    214. public ze_user_infected(id, iInfector)
    215. {
    216.     remove_skull3(id)
    217. }
    218.  
    219. public remove_skull3(id)
    220. {
    221.     if(!is_user_connected(id))
    222.         return
    223.    
    224.     g_had_skull3[id] = 0
    225.     g_skull3_mode[id] = 0
    226.     g_skull3_ammo[id] = 0
    227.     g_skull3_changing[id] = 0
    228.     g_zoomed[id] = 0   
    229. }
    230.  
    231. public hook_change_weapon1(id)
    232. {
    233.     if(g_had_skull3[id])
    234.     {
    235.         engclient_cmd(id, weapon_skull3_m1)
    236.     }
    237. }
    238.  
    239. public hook_change_weapon2(id)
    240. {
    241.     if(g_had_skull3[id])
    242.     {
    243.         engclient_cmd(id, weapon_skull3_m2)
    244.     }
    245. }
    246.  
    247. public client_putinserver(id)
    248. {
    249.     if(!g_reg && is_user_bot(id))
    250.     {
    251.         g_reg = 1
    252.         set_task(0.1, "do_register", id)
    253.     }
    254. }
    255.  
    256. public do_register(id)
    257. {
    258.     RegisterHamFromEntity(Ham_TraceAttack, id, "ham_traceattack")  
    259.     RegisterHamFromEntity(Ham_Spawn, id, "ham_spawn_player")   
    260. }
    261.  
    262. public event_checkweapon(id)
    263. {
    264.     if(!is_user_alive(id) || !is_user_connected(id))
    265.         return PLUGIN_HANDLED
    266.     if(ze_is_user_zombie(id))
    267.         return PLUGIN_HANDLED
    268.     if(!g_had_skull3[id])
    269.         return PLUGIN_HANDLED
    270.    
    271.     static CurWeapon
    272.     CurWeapon = get_user_weapon(id)
    273.    
    274.     if(CurWeapon == CSW_SKULL3_M1 && g_skull3_mode[id] == 1)
    275.     {
    276.         set_pev(id, pev_viewmodel2, v_model)
    277.         set_pev(id, pev_weaponmodel2, p_model)
    278.        
    279.         check_weapon_speed(id, 1)
    280.     } else if(CurWeapon == CSW_SKULL3_M2 && g_skull3_mode[id] == 2) {
    281.         set_pev(id, pev_viewmodel2, v_model2)
    282.         set_pev(id, pev_weaponmodel2, p_model2)
    283.        
    284.         check_weapon_speed(id, 2)
    285.     }
    286.    
    287.     return PLUGIN_CONTINUE
    288. }
    289.  
    290. public check_weapon_speed(id, mode)
    291. {
    292.     static Float:iSpeed
    293.    
    294.     if(mode == 1)
    295.         iSpeed = get_pcvar_float(cvar_speed_m1)
    296.     else if(mode == 2)
    297.         iSpeed = get_pcvar_float(cvar_speed_m2)
    298.    
    299.     static weapon_name[32], ent
    300.    
    301.     if(mode == 1)
    302.         get_weaponname(CSW_SKULL3_M1, weapon_name, sizeof(weapon_name))
    303.     else if(mode == 2)
    304.         get_weaponname(CSW_SKULL3_M2, weapon_name, sizeof(weapon_name))
    305.    
    306.     ent = find_ent_by_owner(-1, weapon_name, id)
    307.     if(ent)
    308.     {
    309.         static Float:Delay, Float:M_Delay
    310.         Delay = get_pdata_float(ent, 46, 4) * iSpeed
    311.         M_Delay = get_pdata_float(ent, 47, 4) * iSpeed
    312.         if (Delay > 0.0)
    313.         {
    314.             set_pdata_float(ent, 46, Delay, 4)
    315.             set_pdata_float(ent, 47, M_Delay, 4)
    316.         }
    317.     }  
    318. }
    319.  
    320. public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
    321. {
    322.     if(!is_user_alive(id) || !is_user_connected(id))
    323.         return FMRES_IGNORED
    324.     if(ze_is_user_zombie(id))
    325.         return FMRES_IGNORED       
    326.     if(!g_had_skull3[id])
    327.         return FMRES_IGNORED
    328.    
    329.     if(get_user_weapon(id) == CSW_SKULL3_M1 || get_user_weapon(id) == CSW_SKULL3_M2)
    330.     {
    331.         set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001)
    332.        
    333.         if(get_user_weapon(id) == CSW_SKULL3_M2)
    334.         {
    335.             switch(pev(id, pev_sequence))
    336.             {
    337.                 case 10: set_pev(id, pev_sequence, 22)
    338.                 case 11:
    339.                 {
    340.                     if(g_shot_anim[id] == 0)
    341.                     {
    342.                         set_pev(id, pev_sequence, 23)
    343.                     } else if(g_shot_anim[id] == 1) {
    344.                         set_pev(id, pev_sequence, 24)
    345.                     }
    346.                 }
    347.                 case 12: set_pev(id, pev_sequence, 25)             
    348.                 case 13: set_pev(id, pev_sequence, 26)
    349.                 case 14:
    350.                 {
    351.                     if(g_shot_anim[id] == 0)
    352.                     {
    353.                         set_pev(id, pev_sequence, 27)
    354.                     } else if(g_shot_anim[id] == 1) {
    355.                         set_pev(id, pev_sequence, 28)
    356.                     }
    357.                 }
    358.                 case 15: set_pev(id, pev_sequence, 29)
    359.             }
    360.         }
    361.     }
    362.    
    363.     return FMRES_HANDLED
    364. }
    365.  
    366. public cmd_drop(id)
    367. {
    368.     if(get_user_weapon(id) == CSW_SKULL3_M1 || get_user_weapon(id) == CSW_SKULL3_M2 && g_had_skull3[id])
    369.     {
    370.         //return PLUGIN_HANDLED
    371.     }
    372.        
    373.     return PLUGIN_CONTINUE
    374. }
    375.  
    376. public fw_SetModel(entity, model[])
    377. {
    378.     if(!is_valid_ent(entity))
    379.         return FMRES_IGNORED;
    380.    
    381.     static szClassName[33]
    382.     entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
    383.    
    384.     if(!equal(szClassName, "weaponbox"))
    385.         return FMRES_IGNORED;
    386.    
    387.     static id
    388.     id = entity_get_edict(entity, EV_ENT_owner)
    389.    
    390.     if(equal(model, "models/w_mp5.mdl"))
    391.     {
    392.         static weapon
    393.         weapon = find_ent_by_owner(-1, weapon_skull3_m1, entity)   
    394.        
    395.         if(!pev_valid(weapon))
    396.             return FMRES_IGNORED
    397.        
    398.         if(g_had_skull3[id])
    399.         {
    400.             static weapon2
    401.             weapon2 = find_ent_by_owner(-1, weapon_skull3_m2, id)          
    402.            
    403.             if(pev_valid(weapon2))
    404.             {
    405.                 reset_player_maxspeed(id)                  
    406.                
    407.                 g_skull3_m2_ammo[id] = cs_get_weapon_ammo(weapon2)
    408.                 g_remove_ent[id] = entity
    409.                 //ham_strip_weapon(id, weapon_skull3_m2)
    410.                 //fm_strip_user_gun(id, CSW_SKULL3_M2, weapon_skull3_m2)
    411.                 remove_gun(id, CSW_SKULL3_M2)
    412.                 client_cmd(id, "slot3")
    413.                
    414.                 g_had_skull3[id] = 0
    415.                 entity_set_model(entity, w_model)
    416.                
    417.                 entity_set_int(weapon, EV_INT_impulse, 2085)
    418.                
    419.                 return FMRES_SUPERCEDE
    420.             }
    421.         }
    422.     }
    423.     if(equal(model, "models/w_p90.mdl"))
    424.     {
    425.         static weapon
    426.         weapon = find_ent_by_owner(-1, weapon_skull3_m2, entity)   
    427.        
    428.         if(!pev_valid(weapon))
    429.             return FMRES_IGNORED
    430.        
    431.         if(g_had_skull3[id])
    432.         {
    433.             static weapon1
    434.             weapon1 = find_ent_by_owner(-1, weapon_skull3_m1, id)          
    435.            
    436.             reset_player_maxspeed(id)  
    437.            
    438.             if(pev_valid(weapon1))
    439.             {
    440.                 g_skull3_m2_ammo[id] = cs_get_weapon_ammo(weapon1)
    441.                 g_remove_ent[id] = entity
    442.                 //ham_strip_weapon(id, weapon_skull3_m1)
    443.                 //fm_strip_user_gun(id, CSW_SKULL3_M1, weapon_skull3_m1)
    444.                 remove_gun(id, CSW_SKULL3_M1)
    445.                 client_cmd(id, "slot3")
    446.                
    447.                 g_had_skull3[id] = 0
    448.                 entity_set_model(entity, w_model)
    449.                
    450.                 entity_set_int(weapon, EV_INT_impulse, 2085)
    451.                
    452.                 return FMRES_SUPERCEDE
    453.             }
    454.         }
    455.     }  
    456.    
    457.    
    458.     return FMRES_IGNORED;
    459. }
    460.  
    461. public remove_gun(id, CSW)
    462. {
    463.     new wpnList[32]
    464.     new number
    465.     get_user_weapons(id,wpnList,number)
    466.     for (new i = 0;i < number ;i++) {
    467.         if (wpnList[i] == CSW) {
    468.             fm_strip_user_gun(id, wpnList[i])
    469.         }
    470.     }
    471. }
    472.  
    473. public fw_CmdStart(id, uc_handle, seed)
    474. {
    475.     if(!is_user_alive(id) || !is_user_connected(id))
    476.         return FMRES_IGNORED   
    477.     if(ze_is_user_zombie(id))
    478.         return FMRES_IGNORED       
    479.     if(!g_had_skull3[id])
    480.         return FMRES_IGNORED   
    481.     if(get_user_weapon(id) != CSW_SKULL3_M1 || g_skull3_mode[id] != 1)
    482.         return FMRES_IGNORED
    483.    
    484.     static CurButton
    485.     CurButton = get_uc(uc_handle, UC_Buttons)
    486.    
    487.     if(CurButton & IN_ATTACK2)
    488.     {
    489.         static Float:CurTime
    490.         CurTime = get_gametime()
    491.        
    492.         if(CurTime - 0.5 > g_zoom_time[id])
    493.         {
    494.             if(!g_zoomed[id])
    495.             {
    496.                 cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 1)
    497.                 g_zoomed[id] = 1
    498.                 } else {
    499.                 cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
    500.                 g_zoomed[id] = 0
    501.             }
    502.            
    503.             g_zoom_time[id] = CurTime
    504.         }
    505.     }
    506.    
    507.     return FMRES_HANDLED
    508. }
    509.  
    510. public ham_traceattack(ent, attacker, Float:Damage, Float:fDir[3], ptr, iDamageType)
    511. {
    512.     if(!is_user_alive(attacker) || !is_user_connected(attacker))
    513.         return HAM_IGNORED 
    514.     if(ze_is_user_zombie(attacker))
    515.         return HAM_IGNORED     
    516.     if(!g_had_skull3[attacker])
    517.         return HAM_IGNORED
    518.    
    519.     static Float:flEnd[3]
    520.     get_tr2(ptr, TR_vecEndPos, flEnd)
    521.    
    522.     if(get_user_weapon(attacker) == CSW_SKULL3_M1)
    523.     {
    524.         make_bullet(attacker, flEnd)
    525.        
    526.         static Damage_New
    527.         Damage_New = get_damage_body(get_tr2(ptr, TR_iHitgroup), get_pcvar_float(cvar_damage_m1))
    528.    
    529.         SetHamParamFloat(3, float(Damage_New)) 
    530.     } else if(get_user_weapon(attacker) == CSW_SKULL3_M2) {
    531.         static Damage_New
    532.         Damage_New = get_damage_body(get_tr2(ptr, TR_iHitgroup), get_pcvar_float(cvar_damage_m2))
    533.    
    534.         SetHamParamFloat(3, float(Damage_New))         
    535.     }
    536.    
    537.     return HAM_HANDLED
    538. }
    539.  
    540. public get_damage_body(body, Float:damage)
    541. {
    542.     switch(body)
    543.     {
    544.         case HIT_HEAD: damage *= 4.0
    545.         case HIT_CHEST: damage *= 1.5
    546.         case HIT_STOMACH: damage *= 1.25
    547.         default: damage *= 1.0
    548.     }
    549.  
    550.     return floatround(damage)
    551. }
    552.  
    553. public ham_add_skull3_m1(ent, id)
    554. {
    555.     if(entity_get_int(ent, EV_INT_impulse) == 2085)
    556.     {
    557.         if(pev_valid(g_remove_ent[id]))
    558.         {
    559.             set_pev(g_remove_ent[id], pev_renderfx, kRenderFxGlowShell)
    560.             set_pev(g_remove_ent[id], pev_rendermode, kRenderTransAlpha)
    561.             set_pev(g_remove_ent[id], pev_renderamt, 0)
    562.            
    563.             set_pev(g_remove_ent[id], pev_solid, SOLID_NOT)
    564.             //remove_entity(g_remove_ent[id])
    565.         }
    566.            
    567.         g_had_skull3[id] = 1
    568.         entity_set_int(id, EV_INT_impulse, 0)
    569.        
    570.         fm_give_item(id, weapon_skull3_m2)
    571.        
    572.         g_skull3_mode[id] = 1
    573.         client_cmd(id, weapon_skull3_m1)
    574.        
    575.         static weapon
    576.         weapon = find_ent_by_owner(-1, weapon_skull3_m2, id)       
    577.         cs_set_weapon_ammo(weapon, g_skull3_m2_ammo[id])
    578.        
    579.         set_pev(id, pev_viewmodel2, v_model)
    580.     }          
    581.    
    582.     if(g_had_skull3[id])
    583.     {
    584.         message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, id)
    585.         write_string("weapon_skull3")
    586.         write_byte(10)
    587.         write_byte(120)
    588.         write_byte(-1)
    589.         write_byte(-1)
    590.         write_byte(0)
    591.         write_byte(7)
    592.         write_byte(CSW_SKULL3_M1)
    593.         write_byte(0)
    594.         message_end()          
    595.     }
    596. }
    597.  
    598. public ham_add_skull3_m2(ent, id)
    599. {
    600.     if(entity_get_int(ent, EV_INT_impulse) == 2085)
    601.     {
    602.         if(pev_valid(g_remove_ent[id]))
    603.         {
    604.             set_pev(g_remove_ent[id], pev_renderfx, kRenderFxGlowShell)
    605.             set_pev(g_remove_ent[id], pev_rendermode, kRenderTransAlpha)
    606.             set_pev(g_remove_ent[id], pev_renderamt, 0)
    607.            
    608.             set_pev(g_remove_ent[id], pev_solid, SOLID_NOT)
    609.             //remove_entity(g_remove_ent[id])
    610.         }
    611.            
    612.         g_had_skull3[id] = 1
    613.         entity_set_int(id, EV_INT_impulse, 0)
    614.        
    615.         fm_give_item(id, weapon_skull3_m1)
    616.        
    617.         g_skull3_mode[id] = 2
    618.         client_cmd(id, weapon_skull3_m2)
    619.        
    620.         static weapon
    621.         weapon = find_ent_by_owner(-1, weapon_skull3_m1, id)       
    622.         cs_set_weapon_ammo(weapon, g_skull3_m2_ammo[id])
    623.        
    624.         set_pev(id, pev_viewmodel2, v_model2)
    625.     }  
    626.    
    627.     if(g_had_skull3[id])
    628.     {
    629.         message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, id)
    630.         write_string("weapon_skull3_2")
    631.         write_byte(7)
    632.         write_byte(100)
    633.         write_byte(-1)
    634.         write_byte(-1)
    635.         write_byte(0)
    636.         write_byte(8)
    637.         write_byte(CSW_SKULL3_M2)
    638.         write_byte(0)
    639.         message_end()  
    640.     }
    641. }
    642.  
    643. public ham_anim_skull3_m1(ent, anim, skiplocal, body)
    644. {
    645.     if(!pev_valid(ent))
    646.         return HAM_IGNORED
    647.    
    648.     static id
    649.     id = pev(ent, pev_owner)   
    650.    
    651.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    652.     {
    653.         if(anim == 2)
    654.         {
    655.             if(g_skull3_mode[id] == 2)
    656.             {
    657.                 g_skull3_changing[id] = 1
    658.                
    659.                 set_pev(id, pev_viewmodel2, v_model)
    660.                 set_weapon_anim(id, 6)
    661.                 set_pdata_int(id, 83, 3, 5)
    662.                
    663.                 set_task(3.0, "change_complete1", id)
    664.                 set_nextattack(ent, id, 3.0)
    665.                
    666.                 //event_checkweapon(id)
    667.                
    668.                 reset_player_maxspeed(id)
    669.             } else if(g_skull3_mode[id] == 1) {
    670.                 if(!g_skull3_changing[id])
    671.                 {
    672.                     set_pev(id, pev_viewmodel2, v_model)
    673.                     set_weapon_anim(id, 2)
    674.                    
    675.                     set_nextattack(ent, id, 1.0)
    676.                 } else {
    677.                     set_pev(id, pev_viewmodel2, v_model)
    678.                     set_weapon_anim(id, 2)
    679.                     set_nextattack(ent, id, 1.0)
    680.                    
    681.                     remove_task(id)
    682.                    
    683.                     reset_player_maxspeed(id)
    684.                 }
    685.             }
    686.         }  
    687.         if(anim == 0)
    688.         {
    689.             if(g_skull3_mode[id] == 1)
    690.             {
    691.                 cs_set_user_bpammo(id, CSW_SKULL3_M2, cs_get_user_bpammo(id, CSW_SKULL3_M1))
    692.                 g_skull3_ammo[id] = cs_get_user_bpammo(id, CSW_SKULL3_M2)
    693.                 } else if(g_skull3_mode[id] == 2) {
    694.                 cs_set_user_bpammo(id, CSW_SKULL3_M1, cs_get_user_bpammo(id, CSW_SKULL3_M2))
    695.                 g_skull3_ammo[id] = cs_get_user_bpammo(id, CSW_SKULL3_M1)
    696.             }
    697.         }
    698.     }
    699.    
    700.     return HAM_HANDLED
    701. }
    702.  
    703. public ham_anim_skull3_m2(ent, anim, skiplocal, body)
    704. {
    705.     if(!pev_valid(ent))
    706.         return HAM_IGNORED
    707.    
    708.     static id
    709.     id = pev(ent, pev_owner)
    710.    
    711.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    712.     {
    713.         if(anim == 2)
    714.         {
    715.             if(g_skull3_mode[id] == 1)
    716.             {
    717.                 g_skull3_changing[id] = 1
    718.                
    719.                 set_pev(id, pev_viewmodel2, v_model2)
    720.                 set_weapon_anim(id, 6)
    721.                 set_pdata_int(id, 83, 3, 5)
    722.                
    723.                 set_task(3.0, "change_complete2", id)
    724.                 set_nextattack(ent, id, 3.0)
    725.            
    726.                 //event_checkweapon(id)
    727.                
    728.                 if(pev(id, pev_maxspeed) != get_pcvar_float(cvar_decrease_speed))
    729.                     set_user_maxspeed(id, get_pcvar_float(cvar_decrease_speed))
    730.             } else if(g_skull3_mode[id] == 2) {
    731.                 set_pev(id, pev_viewmodel2, v_model2)
    732.                 set_weapon_anim(id, 2)
    733.                
    734.                 set_nextattack(ent, id, 1.0)
    735.             }
    736.         }  
    737.        
    738.         if(anim == 0)
    739.         {
    740.             if(g_skull3_mode[id] == 1)
    741.             {
    742.                 cs_set_user_bpammo(id, CSW_SKULL3_M2, cs_get_user_bpammo(id, CSW_SKULL3_M1))
    743.                 g_skull3_ammo[id] = cs_get_user_bpammo(id, CSW_SKULL3_M2)
    744.                 } else if(g_skull3_mode[id] == 2) {
    745.                 cs_set_user_bpammo(id, CSW_SKULL3_M1, cs_get_user_bpammo(id, CSW_SKULL3_M2))
    746.                 g_skull3_ammo[id] = cs_get_user_bpammo(id, CSW_SKULL3_M1)
    747.             }
    748.         }      
    749.     }
    750.    
    751.     return HAM_HANDLED
    752. }
    753.  
    754. public fw_Ham_Item_Deploy_Post(ent)
    755. {
    756.     if(!pev_valid(ent))
    757.         return HAM_IGNORED
    758.    
    759.     static id
    760.     id = pev(ent, pev_owner)
    761.    
    762.     if(is_user_alive(id) && is_user_connected(id))
    763.     {  
    764.         if(pev(id, pev_maxspeed) == get_pcvar_float(cvar_decrease_speed))
    765.             reset_player_maxspeed(id)
    766.     }
    767.    
    768.     return HAM_HANDLED
    769. }
    770.  
    771. public ham_deploy_skull3_m1(ent)
    772. {
    773.     if(!pev_valid(ent))
    774.         return HAM_IGNORED
    775.    
    776.     static id
    777.     id = pev(ent, pev_owner)
    778.    
    779.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id] && g_skull3_changing[id])
    780.     {  
    781.         set_nextattack(ent, id, 3.0)
    782.     }
    783.    
    784.     return HAM_HANDLED
    785. }
    786.  
    787. public ham_deploy_skull3_m2(ent)
    788. {
    789.     if(!pev_valid(ent))
    790.         return HAM_IGNORED
    791.    
    792.     static id
    793.     id = pev(ent, pev_owner)
    794.    
    795.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id] && g_skull3_changing[id])
    796.     {  
    797.         set_nextattack(ent, id, 3.0)
    798.     }
    799.    
    800.     return HAM_HANDLED
    801. }
    802.  
    803. public ham_attack_skull3(ent)
    804. {
    805.     if(!pev_valid(ent))
    806.         return HAM_IGNORED
    807.    
    808.     static id
    809.     id = pev(ent, pev_owner)
    810.    
    811.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    812.     {  
    813.         g_is_attacking[id] = 1
    814.         pev(id, pev_punchangle, g_recoil[id])
    815.     }
    816.    
    817.     return HAM_HANDLED
    818. }
    819.  
    820. public ham_attack_skull3_post(ent)
    821. {
    822.     if(!pev_valid(ent))
    823.         return HAM_IGNORED
    824.    
    825.     static id
    826.     id = pev(ent, pev_owner)
    827.    
    828.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    829.     {  
    830.         g_is_attacking[id] = 0
    831.        
    832.         new Float:static_recoil[3]
    833.         pev(id, pev_punchangle, static_recoil)
    834.        
    835.         xs_vec_sub(static_recoil, g_recoil[id], static_recoil)
    836.        
    837.         if(g_skull3_mode[id] == 1)
    838.             xs_vec_mul_scalar(static_recoil, get_pcvar_float(cvar_recoil_m1), static_recoil)
    839.         else if(g_skull3_mode[id] == 2)
    840.             xs_vec_mul_scalar(static_recoil, get_pcvar_float(cvar_recoil_m2), static_recoil)
    841.        
    842.         xs_vec_add(static_recoil, g_recoil[id], static_recoil)
    843.         set_pev(id, pev_punchangle, static_recoil)
    844.        
    845.         if (!cs_get_weapon_ammo(ent))
    846.             return HAM_IGNORED
    847.        
    848.         emit_sound(id, CHAN_WEAPON, skull3_sound[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    849.        
    850.         if(g_skull3_mode[id] == 1)
    851.         {
    852.             set_weapon_anim(id, 3)
    853.         } else if(g_skull3_mode[id] == 2) {
    854.             set_pdata_float(ent, 62, 0.4, 4)
    855.             if(g_shot_anim[id] == 0)
    856.             {
    857.                 set_weapon_anim(id, 3)
    858.                 g_shot_anim[id] = 1
    859.                 } else if(g_shot_anim[id] == 1) {
    860.                 set_weapon_anim(id, 5)
    861.                 g_shot_anim[id] = 0
    862.             }
    863.         }
    864.     }
    865.    
    866.     return HAM_HANDLED
    867. }
    868.  
    869. public ham_reload_skull3(ent)
    870. {
    871.     if(!pev_valid(ent))
    872.         return HAM_IGNORED
    873.    
    874.     static id
    875.     id = pev(ent, pev_owner)
    876.    
    877.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    878.     {      
    879.         g_skull3_clip[id] = -1
    880.        
    881.         new bpammo
    882.        
    883.         if(g_skull3_mode[id] == 1)
    884.             bpammo = cs_get_user_bpammo(id, CSW_SKULL3_M1)
    885.         else if(g_skull3_mode[id] == 2)
    886.             bpammo = cs_get_user_bpammo(id, CSW_SKULL3_M2)
    887.        
    888.         new iClip = get_pdata_int(ent, 51, 4)
    889.        
    890.         if (bpammo <= 0)
    891.             return HAM_SUPERCEDE
    892.        
    893.         if(g_skull3_mode[id] == 1)
    894.         {
    895.             if(iClip >= get_pcvar_num(cvar_clip_m1))
    896.                 return HAM_SUPERCEDE       
    897.             } else if(g_skull3_mode[id] == 2) {
    898.             if(iClip >= get_pcvar_num(cvar_clip_m2))
    899.                 return HAM_SUPERCEDE           
    900.         }
    901.        
    902.         g_skull3_clip[id] = iClip
    903.         g_reload[id] = 1
    904.     }
    905.    
    906.     return HAM_IGNORED
    907. }
    908.  
    909. public ham_reload_skull3_post(ent)
    910. {
    911.     if(!pev_valid(ent))
    912.         return HAM_IGNORED
    913.    
    914.     static id
    915.     id = pev(ent, pev_owner)
    916.    
    917.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    918.     {  
    919.         if (g_skull3_clip[id] == -1)
    920.             return HAM_IGNORED
    921.        
    922.         static Float:reload_time
    923.         if(g_skull3_mode[id] == 1)
    924.             reload_time = 2.2
    925.         else if(g_skull3_mode[id] == 2)
    926.             reload_time = 3.4
    927.        
    928.         set_pdata_int(ent, 51, g_skull3_clip[id], 4)
    929.         set_pdata_float(ent, 48, reload_time, 4)
    930.         set_pdata_float(id, 83, reload_time, 5)
    931.         set_pdata_int(ent, 54, 1, 4)
    932.        
    933.         set_weapon_anim(id, 1)
    934.     }
    935.    
    936.     return HAM_IGNORED
    937. }
    938.  
    939. public ham_postframe_skull3(ent)
    940. {
    941.     if(!pev_valid(ent))
    942.         return HAM_IGNORED
    943.    
    944.     static id
    945.     id = pev(ent, pev_owner)
    946.    
    947.     if(is_user_alive(id) && is_user_connected(id) && g_had_skull3[id])
    948.     {  
    949.         new Float:flNextAttack = get_pdata_float(id, 83, 5)
    950.        
    951.         new bpammo
    952.         if(g_skull3_mode[id] == 1)
    953.             bpammo = cs_get_user_bpammo(id, CSW_SKULL3_M1)
    954.         else if(g_skull3_mode[id] == 2)
    955.             bpammo = cs_get_user_bpammo(id, CSW_SKULL3_M2)
    956.        
    957.         new iClip = get_pdata_int(ent, 51, 4)
    958.         new fInReload = get_pdata_int(ent, 54, 4)
    959.        
    960.         if(fInReload && flNextAttack <= 0.0)
    961.         {
    962.             new temp1
    963.             if(g_skull3_mode[id] == 1)
    964.             {
    965.                 temp1 = min(get_pcvar_num(cvar_clip_m1) - iClip, bpammo)
    966.                 } else if(g_skull3_mode[id] == 2) {
    967.                 temp1 = min(get_pcvar_num(cvar_clip_m2) - iClip, bpammo)           
    968.             }
    969.            
    970.             set_pdata_int(ent, 51, iClip + temp1, 4)
    971.            
    972.             if(g_skull3_mode[id] == 1)
    973.                 cs_set_user_bpammo(id, CSW_SKULL3_M1, bpammo-temp1)
    974.             else if(g_skull3_mode[id] == 2)
    975.                 cs_set_user_bpammo(id, CSW_SKULL3_M2, bpammo-temp1)    
    976.            
    977.             set_pdata_int(ent, 54, 0, 4)
    978.            
    979.             fInReload = 0
    980.             g_reload[id] = 0
    981.         }      
    982.     }
    983.    
    984.     return HAM_IGNORED
    985. }
    986.  
    987. public ham_takedamage_player(victim, inflictor, attacker, Float:damage, damagebits)
    988. {
    989.     if(!is_user_alive(victim) || !is_user_connected(victim))
    990.         return HAM_IGNORED
    991.     if(!is_user_alive(attacker) || !is_user_connected(attacker))
    992.         return HAM_IGNORED     
    993.     if(ze_is_user_zombie(attacker))
    994.         return HAM_IGNORED     
    995.     if(!g_had_skull3[attacker])
    996.         return HAM_IGNORED
    997.    
    998.     if(get_user_weapon(attacker) == CSW_SKULL3_M1 && g_skull3_mode[attacker] == 1)
    999.     {
    1000.         SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_m1))
    1001.         } else if(get_user_weapon(attacker) == CSW_SKULL3_M2 && g_skull3_mode[attacker] == 2) {
    1002.         SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_m2))
    1003.     }
    1004.    
    1005.     return HAM_HANDLED
    1006. }
    1007.  
    1008. public client_PostThink(id)
    1009. {
    1010.     if(!is_user_alive(id) || !is_user_connected(id))
    1011.         return
    1012.     if(ze_is_user_zombie(id))
    1013.         return     
    1014.     if(!g_had_skull3[id])
    1015.         return
    1016.     if(get_user_weapon(id) != CSW_SKULL3_M2 || g_skull3_mode[id] != 2)
    1017.         return
    1018.    
    1019.     if(pev(id, pev_maxspeed) != get_pcvar_float(cvar_decrease_speed))
    1020.         set_user_maxspeed(id, get_pcvar_float(cvar_decrease_speed))
    1021. }
    1022.  
    1023. public change_complete1(id)
    1024. {
    1025.     g_skull3_changing[id] = 0
    1026.    
    1027.     if(get_user_weapon(id) == CSW_SKULL3_M1 && g_had_skull3[id])
    1028.         g_skull3_mode[id] = 1
    1029. }
    1030.  
    1031. public change_complete2(id)
    1032. {
    1033.     g_skull3_changing[id] = 0
    1034.    
    1035.     if(get_user_weapon(id) == CSW_SKULL3_M2 && g_had_skull3[id])
    1036.         g_skull3_mode[id] = 2
    1037. }
    1038.  
    1039. stock set_weapon_anim(id, anim)
    1040. {
    1041.     set_pev(id, pev_weaponanim, anim)
    1042.    
    1043.     message_begin(MSG_ONE, SVC_WEAPONANIM, _, id)
    1044.     write_byte(anim)
    1045.     write_byte(pev(id, pev_body))
    1046.     message_end()
    1047. }
    1048.  
    1049. stock set_nextattack(const weapon, const player, const Float:nextTime)
    1050. {
    1051.     const m_flNextPrimaryAttack = 46
    1052.     const m_flNextSecondaryAttack = 47
    1053.     const m_flTimeWeaponIdle = 48
    1054.     const m_flNextAttack = 83
    1055.    
    1056.     set_pdata_float(weapon, m_flNextPrimaryAttack  , nextTime, 4)
    1057.     set_pdata_float(weapon, m_flNextSecondaryAttack, nextTime, 4)
    1058.     set_pdata_float(weapon, m_flTimeWeaponIdle, nextTime, 4)
    1059.     set_pdata_float(player, m_flNextAttack, nextTime, 5)
    1060. }
    1061.  
    1062. stock make_bullet(id, Float:Origin[3])
    1063. {
    1064.     // Find target
    1065.     new target, body
    1066.     get_user_aiming(id, target, body, 999999)
    1067.    
    1068.     if(target > 0 && target <= get_maxplayers())
    1069.     {
    1070.         new Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3]
    1071.         pev(id, pev_origin, fStart)
    1072.        
    1073.         // Get ids view direction
    1074.         velocity_by_aim(id, 64, fVel)
    1075.        
    1076.         // Calculate position where blood should be displayed
    1077.         fStart[0] = Origin[0]
    1078.         fStart[1] = Origin[1]
    1079.         fStart[2] = Origin[2]
    1080.         fEnd[0] = fStart[0]+fVel[0]
    1081.         fEnd[1] = fStart[1]+fVel[1]
    1082.         fEnd[2] = fStart[2]+fVel[2]
    1083.        
    1084.         // Draw traceline from victims origin into ids view direction to find
    1085.         // the location on the wall to put some blood on there
    1086.         new res
    1087.         engfunc(EngFunc_TraceLine, fStart, fEnd, 0, target, res)
    1088.         get_tr2(res, TR_vecEndPos, fRes)
    1089.        
    1090.         // Show some blood :)
    1091.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    1092.         write_byte(TE_BLOODSPRITE)
    1093.         write_coord(floatround(fStart[0]))
    1094.         write_coord(floatround(fStart[1]))
    1095.         write_coord(floatround(fStart[2]))
    1096.         write_short(g_bloodspray)
    1097.         write_short(g_blood)
    1098.         write_byte(70)
    1099.         write_byte(random_num(1,2))
    1100.         message_end()
    1101.        
    1102.        
    1103.         } else {
    1104.         new decal = 41
    1105.        
    1106.         // Check if the wall hit is an entity
    1107.         if(target)
    1108.         {
    1109.             // Put decal on an entity
    1110.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    1111.             write_byte(TE_DECAL)
    1112.             write_coord(floatround(Origin[0]))
    1113.             write_coord(floatround(Origin[1]))
    1114.             write_coord(floatround(Origin[2]))
    1115.             write_byte(decal)
    1116.             write_short(target)
    1117.             message_end()
    1118.             } else {
    1119.             // Put decal on "world" (a wall)
    1120.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    1121.             write_byte(TE_WORLDDECAL)
    1122.             write_coord(floatround(Origin[0]))
    1123.             write_coord(floatround(Origin[1]))
    1124.             write_coord(floatround(Origin[2]))
    1125.             write_byte(decal)
    1126.             message_end()
    1127.         }
    1128.        
    1129.         // Show sparcles
    1130.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    1131.         write_byte(TE_GUNSHOTDECAL)
    1132.         write_coord(floatround(Origin[0]))
    1133.         write_coord(floatround(Origin[1]))
    1134.         write_coord(floatround(Origin[2]))
    1135.         write_short(id)
    1136.         write_byte(decal)
    1137.         message_end()
    1138.     }
    1139. }
    1140.  
    1141. stock drop_weapons(id, dropwhat)
    1142. {
    1143.     static weapons[32], num, i, weaponid
    1144.     num = 0
    1145.     get_user_weapons(id, weapons, num)
    1146.    
    1147.     for (i = 0; i < num; i++)
    1148.     {
    1149.         weaponid = weapons[i]
    1150.        
    1151.         if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
    1152.         {
    1153.             static wname[32]
    1154.             get_weaponname(weaponid, wname, sizeof wname - 1)
    1155.             engclient_cmd(id, "drop", wname)
    1156.         }
    1157.     }
    1158. }
    1159.  
    1160. stock ham_strip_weapon(id, weapon[])
    1161. {
    1162.     if(!equal(weapon,"weapon_",7))
    1163.         return 0
    1164.    
    1165.     new wId = get_weaponid(weapon);
    1166.     if(!wId)
    1167.         return 0;
    1168.    
    1169.     new wEnt;
    1170.     while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    1171.     if(!wEnt)
    1172.         return 0;
    1173.    
    1174.     if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
    1175.    
    1176.     if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
    1177.         return 0;
    1178.     ExecuteHamB(Ham_Item_Kill,wEnt);
    1179.    
    1180.     set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));
    1181.    
    1182.     return 1
    1183. }
    1184.  
    1185. stock reset_player_maxspeed(id)
    1186. {
    1187.     if(!is_user_alive(id))
    1188.         return
    1189.        
    1190.     set_user_maxspeed(id, g_oldspeed[id])
    1191. }

    I'am not going to Compile this one as you need to update your hamsandwich module to work. I only need to learn you how to convert only this is my point.
-For your second request, Yes we can give the VIP every round any gun you need.
He who fails to plan is planning to fail

playcs
Member
Member
Posts: 5
Joined: 7 years ago
Contact:

#3

Post by playcs » 7 years ago

Its giving a error if I convert like this (const SILENT_BS = ((1<<CSW_USP)|(1<<CSW_SKULL3_M1))_=) what to do?

Also, yes give me the VIP mingun thing.

thanks

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#4

Post by Night Fury » 7 years ago

Raheem, You need to add

Code: Select all

#include <fakemeta_util>
too, it's not included in the main include.
playcs, What's minigun code? What's your error? Provide full information.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

playcs
Member
Member
Posts: 5
Joined: 7 years ago
Contact:

#5

Post by playcs » 7 years ago

I have the plugin here, Its a plugin wich give minigun on flags like ADMIIN_LEVEL_H (It will give minigun) but the weapon wont stay if I choose a weapon from my level systeem. Its not allowing with 2 slots.

//Code:
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fun>
  4.  
  5. #define ADMIN_MODELS_ACCESS ADMIN_LEVEL_A
  6.  
  7. new const PLUGIN[] = "VIP Machingun"
  8. new const VERSION[] = "1.1"
  9. new const AUTHOR[] = "| editer|"
  10.  
  11. // Models
  12. new V_MODEL[] = "models/vipmg/v_vipmg.mdl"
  13. new W_MODEL[] = "models/vipmg/w_vipmg.mdl"
  14. new P_MODEL[] = "models/vipmg/p_vipmg.mdl"
  15.  
  16. public plugin_init()
  17. {
  18.     register_plugin(PLUGIN, VERSION, AUTHOR)
  19. }
  20.  
  21. public plugin_precache() {
  22.     precache_model(V_MODEL)
  23.     precache_model(W_MODEL)
  24.     precache_model(P_MODEL)
  25. }
  26.  
  27. //give wpn
  28. public give_weapon(id, ammo, frst){
  29.     give_item(id,"weapon_m249")
  30.    
  31. }
  32.  
  33. //set models
  34. public event_curweapon(id)
  35. {
  36.     if (get_user_flags(id) && ADMIN_LEVEL_A)  
  37.     {
  38.         give_item(id, "weapon_m249")
  39.         cs_set_user_bpammo(id, CSW_M249, 100)
  40.     }
  41.    
  42.     return PLUGIN_CONTINUE
  43. }
Last edited by Raheem 7 years ago, edited 1 time in total.
Reason: Use Code Tag

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#6

Post by Raheem » 7 years ago

JaCk GamePlay, Not needed in this case :D.

playcs, I don't understand what your problem but the code you post will add to the player M249 So this player can carry two weapons. But depend on what you say the problem from the other plugin you use as it Strip all player weapons and give them only the ones they chosen so you will need to edit it and remove strip player weapons just give item without strip.
He who fails to plan is planning to fail

playcs
Member
Member
Posts: 5
Joined: 7 years ago
Contact:

#7

Post by playcs » 7 years ago

As I said players with flag T will get that minigun, I edit to admin_level_h its working, but If I chose a weapon on a level systeem the minigun will dissapear, it doens't allow 2slots,

So Again: I cant get 2 guns in a primary slot Example: I have flag t (VIP) I will get automaticlly minigun on respawn. But If I wanna choose one weapon on my level systeem the minigun will dissapear.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 7 years ago

I said for you that this because of the level system you use. Remove strip weapon code from it and it will allow 2 guns.
He who fails to plan is planning to fail

playcs
Member
Member
Posts: 5
Joined: 7 years ago
Contact:

#9

Post by playcs » 7 years ago

What u mean by strip?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#10

Post by Raheem » 7 years ago

Strip weapons from player mean to take all weapons from him and he won't have any weapon even knife. So simply post the other code that you state and i'll tell you what to remove.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 2 guests