Resolved Segmentation fault

Installation Problems Support
User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 163
Joined: 2 Years Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 5 times
Contact:

Segmentation fault

#1

Post by Luxurious » 1 Month Ago

am using ZE V1.5 and i always faced this crash with reason "Segmentation fault" No Any Error just " Segmentation fault " in kgb host
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 2095
Joined: 3 Years Ago
Location: Egypt
Has thanked: 43 times
Been thanked: 129 times
Age: 23
Contact:

#2

Post by Raheem » 1 Month Ago

The crash occurs when you try starting the server? Or it sometimes occur?

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 163
Joined: 2 Years Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 5 times
Contact:

#3

Post by Luxurious » 1 Month Ago

when map is changed !
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 2095
Joined: 3 Years Ago
Location: Egypt
Has thanked: 43 times
Been thanked: 129 times
Age: 23
Contact:

#4

Post by Raheem » 1 Month Ago

Always or sometimes?

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 163
Joined: 2 Years Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 5 times
Contact:

#5

Post by Luxurious » 1 Month Ago

sometimes ... but when i stoped this plugin is don`t crash any more

Code: Select all

#include <zombie_escape>
#include <ze_levels>
#include <ze_vip>
// Models
new const g_szKnife1[][] =
{
    "models/cg/v_knife_griff.mdl",
    "models/cg/p_knife_griff1.mdl"
}
 
new const g_szKnife2[][] =
{
    "models/cg/v_flip_t.mdl",
    "models/cg/p_flip_t.mdl"
}
new const g_szKnife3[][] =
{
    "models/cg/v_butterfly_knife.mdl",
    "models/cg/p_butterfly_knife.mdl"
}
new const g_szKnife4[][] =
{
    "models/cg/v_bayonet.mdl",
    "models/cg/p_bayonet.mdl"
}
new const g_szKnife5[][] =
{
    "models/cg/v_knife_karambit.mdl",
    "models/cg/p_knife_karambit.mdl"
}
new const g_szKnife6[][] =
{
    "models/cg/v_knife_karambit.mdl",
    "models/cg/p_knife_karambit.mdl"
}
new const g_szKnife7[][] =
{
    "models/cg/v_knifew.mdl",
    "models/cg/p_knifew.mdl"
}
new const g_szKnife8[][] =
{
    "models/cg/v_knifew.mdl",
    "models/cg/p_knifew.mdl"
}

new const g_szKnifeV[][] =
{
    "models/cg/v_knifev.mdl",
    "models/cg/p_knifev.mdl"
}
 

// Sounds
new const g_szKnife1Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}
 
new const g_szKnife2Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife3Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife4Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife5Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife6Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife7Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnife8Sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}
 
new const g_szDefaultSounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}

new const g_szKnifeVSounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}
// Models indexes
enum
{
    V_Model = 0,
    P_Model
}
 
public plugin_init()
{
    register_plugin("Knife Levels", "1.0", "Raheem")
   
    // Fakemeta
    register_forward(FM_EmitSound, "Fw_EmitSound")
}
 
public plugin_precache()
{
    new iIndex;
   
    // Prechace models
    for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
        precache_model(g_szKnife1[iIndex])
   
    for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
        precache_model(g_szKnife2[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
        precache_model(g_szKnife3[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
        precache_model(g_szKnife4[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
        precache_model(g_szKnife5[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
        precache_model(g_szKnife6[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
        precache_model(g_szKnife7[iIndex])

    for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
        precache_model(g_szKnife8[iIndex])
   
   
    for(iIndex = 0; iIndex <= charsmax(g_szKnifeV); iIndex++)
        precache_model(g_szKnifeV[iIndex])
	
	
    // Prechace sounds
    for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
        precache_sound(g_szKnife1Sounds[iIndex])
 
    for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
        precache_sound(g_szKnife1Sounds[iIndex])
}
 
public ze_user_humanized(id)
{
    if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 4)
    {
        // Player level from 1 to 5 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
    {
        // Player level from 5 to 8 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
    {
        // Player level from 5 to 8 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 19)
    {
        // Player level from 5 to 8 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 24)
    {
        // Player level from 26 to 30 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 29)
    {
        // Player level from 26 to 30 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 50)
    {
        // Player level from 26 to 30 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
       
        ResetKnife(id)
    }
    else if (ze_get_vip_flags(id) & VIP_A)
    {
        // Player level from 26 to 30 set him this knife
        cs_set_player_view_model(id, CSW_KNIFE, g_szKnifeV[V_Model])
        cs_set_player_weap_model(id, CSW_KNIFE, g_szKnifeV[P_Model])
       
        ResetKnife(id)
    }
    
 
}
 
public ResetKnife(id)
{
    rg_remove_item(id, "weapon_knife")
    rg_give_item(id, "weapon_knife", GT_APPEND)
    engclient_cmd(id, "weapon_knife")
    emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
 
public Fw_EmitSound(id, iChannel, const szSound[])
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return FMRES_IGNORED
   
    if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
        {
            if (equal(g_szDefaultSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
   else if (ze_get_vip_flags(id) & VIP_E)
    {
        for(new iIndex = 0; iIndex <= charsmax(g_szKnifeVSounds); iIndex++)
        {
            if (equal(g_szKnifeVSounds[iIndex], szSound))
            {
                emit_sound(id, iChannel, g_szKnifeVSounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    
    
  
    
    
    
    
    
    
    return FMRES_IGNORED
}

this plugin have problem ?
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 2095
Joined: 3 Years Ago
Location: Egypt
Has thanked: 43 times
Been thanked: 129 times
Age: 23
Contact:

#6

Post by Raheem » 1 Month Ago

Although the code is simple and seems it may not the cause but I checked is user alive in two functions, try maybe it helps:

  1. #include <zombie_escape>
  2. #include <ze_levels>
  3. #include <ze_vip>
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/cg/v_knife_griff.mdl",
  8.     "models/cg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/cg/v_flip_t.mdl",
  14.     "models/cg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/cg/v_butterfly_knife.mdl",
  19.     "models/cg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/cg/v_bayonet.mdl",
  24.     "models/cg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/cg/v_knife_karambit.mdl",
  29.     "models/cg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/cg/v_knife_karambit.mdl",
  34.     "models/cg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/cg/v_knifew.mdl",
  39.     "models/cg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/cg/v_knifew.mdl",
  44.     "models/cg/p_knifew.mdl"
  45. }
  46.  
  47. new const g_szKnifeV[][] =
  48. {
  49.     "models/cg/v_knifev.mdl",
  50.     "models/cg/p_knifev.mdl"
  51. }
  52.  
  53.  
  54. // Sounds
  55. new const g_szKnife1Sounds[][] =
  56. {
  57.     "weapons/knife_deploy1.wav",
  58.     "weapons/knife_hit1.wav",
  59.     "weapons/knife_hit2.wav",
  60.     "weapons/knife_hit3.wav",
  61.     "weapons/knife_hit4.wav",
  62.     "weapons/knife_hitwall1.wav",
  63.     "weapons/knife_slash1.wav",
  64.     "weapons/knife_slash2.wav",
  65.     "weapons/knife_stab.wav"
  66. }
  67.  
  68. new const g_szKnife2Sounds[][] =
  69. {
  70.     "weapons/knife_deploy1.wav",
  71.     "weapons/knife_hit1.wav",
  72.     "weapons/knife_hit2.wav",
  73.     "weapons/knife_hit3.wav",
  74.     "weapons/knife_hit4.wav",
  75.     "weapons/knife_hitwall1.wav",
  76.     "weapons/knife_slash1.wav",
  77.     "weapons/knife_slash2.wav",
  78.     "weapons/knife_stab.wav"
  79. }
  80.  
  81. new const g_szKnife3Sounds[][] =
  82. {
  83.     "weapons/knife_deploy1.wav",
  84.     "weapons/knife_hit1.wav",
  85.     "weapons/knife_hit2.wav",
  86.     "weapons/knife_hit3.wav",
  87.     "weapons/knife_hit4.wav",
  88.     "weapons/knife_hitwall1.wav",
  89.     "weapons/knife_slash1.wav",
  90.     "weapons/knife_slash2.wav",
  91.     "weapons/knife_stab.wav"
  92. }
  93.  
  94. new const g_szKnife4Sounds[][] =
  95. {
  96.     "weapons/knife_deploy1.wav",
  97.     "weapons/knife_hit1.wav",
  98.     "weapons/knife_hit2.wav",
  99.     "weapons/knife_hit3.wav",
  100.     "weapons/knife_hit4.wav",
  101.     "weapons/knife_hitwall1.wav",
  102.     "weapons/knife_slash1.wav",
  103.     "weapons/knife_slash2.wav",
  104.     "weapons/knife_stab.wav"
  105. }
  106.  
  107. new const g_szKnife5Sounds[][] =
  108. {
  109.     "weapons/knife_deploy1.wav",
  110.     "weapons/knife_hit1.wav",
  111.     "weapons/knife_hit2.wav",
  112.     "weapons/knife_hit3.wav",
  113.     "weapons/knife_hit4.wav",
  114.     "weapons/knife_hitwall1.wav",
  115.     "weapons/knife_slash1.wav",
  116.     "weapons/knife_slash2.wav",
  117.     "weapons/knife_stab.wav"
  118. }
  119.  
  120. new const g_szKnife6Sounds[][] =
  121. {
  122.     "weapons/knife_deploy1.wav",
  123.     "weapons/knife_hit1.wav",
  124.     "weapons/knife_hit2.wav",
  125.     "weapons/knife_hit3.wav",
  126.     "weapons/knife_hit4.wav",
  127.     "weapons/knife_hitwall1.wav",
  128.     "weapons/knife_slash1.wav",
  129.     "weapons/knife_slash2.wav",
  130.     "weapons/knife_stab.wav"
  131. }
  132.  
  133. new const g_szKnife7Sounds[][] =
  134. {
  135.     "weapons/knife_deploy1.wav",
  136.     "weapons/knife_hit1.wav",
  137.     "weapons/knife_hit2.wav",
  138.     "weapons/knife_hit3.wav",
  139.     "weapons/knife_hit4.wav",
  140.     "weapons/knife_hitwall1.wav",
  141.     "weapons/knife_slash1.wav",
  142.     "weapons/knife_slash2.wav",
  143.     "weapons/knife_stab.wav"
  144. }
  145.  
  146. new const g_szKnife8Sounds[][] =
  147. {
  148.     "weapons/knife_deploy1.wav",
  149.     "weapons/knife_hit1.wav",
  150.     "weapons/knife_hit2.wav",
  151.     "weapons/knife_hit3.wav",
  152.     "weapons/knife_hit4.wav",
  153.     "weapons/knife_hitwall1.wav",
  154.     "weapons/knife_slash1.wav",
  155.     "weapons/knife_slash2.wav",
  156.     "weapons/knife_stab.wav"
  157. }
  158.  
  159. new const g_szDefaultSounds[][] =
  160. {
  161.     "weapons/knife_deploy1.wav",
  162.     "weapons/knife_hit1.wav",
  163.     "weapons/knife_hit2.wav",
  164.     "weapons/knife_hit3.wav",
  165.     "weapons/knife_hit4.wav",
  166.     "weapons/knife_hitwall1.wav",
  167.     "weapons/knife_slash1.wav",
  168.     "weapons/knife_slash2.wav",
  169.     "weapons/knife_stab.wav"
  170. }
  171.  
  172. new const g_szKnifeVSounds[][] =
  173. {
  174.     "weapons/knife_deploy1.wav",
  175.     "weapons/knife_hit1.wav",
  176.     "weapons/knife_hit2.wav",
  177.     "weapons/knife_hit3.wav",
  178.     "weapons/knife_hit4.wav",
  179.     "weapons/knife_hitwall1.wav",
  180.     "weapons/knife_slash1.wav",
  181.     "weapons/knife_slash2.wav",
  182.     "weapons/knife_stab.wav"
  183. }
  184. // Models indexes
  185. enum
  186. {
  187.     V_Model = 0,
  188.     P_Model
  189. }
  190.  
  191. public plugin_init()
  192. {
  193.     register_plugin("Knife Levels", "1.0", "Raheem")
  194.    
  195.     // Fakemeta
  196.     register_forward(FM_EmitSound, "Fw_EmitSound")
  197. }
  198.  
  199. public plugin_precache()
  200. {
  201.     new iIndex;
  202.    
  203.     // Prechace models
  204.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  205.         precache_model(g_szKnife1[iIndex])
  206.    
  207.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  208.         precache_model(g_szKnife2[iIndex])
  209.  
  210.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  211.         precache_model(g_szKnife3[iIndex])
  212.  
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  214.         precache_model(g_szKnife4[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  217.         precache_model(g_szKnife5[iIndex])
  218.  
  219.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  220.         precache_model(g_szKnife6[iIndex])
  221.  
  222.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  223.         precache_model(g_szKnife7[iIndex])
  224.  
  225.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  226.         precache_model(g_szKnife8[iIndex])
  227.    
  228.    
  229.     for(iIndex = 0; iIndex <= charsmax(g_szKnifeV); iIndex++)
  230.         precache_model(g_szKnifeV[iIndex])
  231.    
  232.    
  233.     // Prechace sounds
  234.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  235.         precache_sound(g_szKnife1Sounds[iIndex])
  236.  
  237.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  238.         precache_sound(g_szKnife1Sounds[iIndex])
  239. }
  240.  
  241. public ze_user_humanized(id)
  242. {
  243.     if(!is_user_alive(id))
  244.         return
  245.    
  246.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 4)
  247.     {
  248.         // Player level from 1 to 5 set him this knife
  249.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  250.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  251.        
  252.         ResetKnife(id)
  253.     }
  254.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  255.     {
  256.         // Player level from 5 to 8 set him this knife
  257.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  258.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  259.        
  260.         ResetKnife(id)
  261.     }
  262.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  263.     {
  264.         // Player level from 5 to 8 set him this knife
  265.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  266.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  267.        
  268.         ResetKnife(id)
  269.     }
  270.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 19)
  271.     {
  272.         // Player level from 5 to 8 set him this knife
  273.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  274.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  275.        
  276.         ResetKnife(id)
  277.     }
  278.     else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 24)
  279.     {
  280.         // Player level from 26 to 30 set him this knife
  281.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  282.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  283.        
  284.         ResetKnife(id)
  285.     }
  286.     else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 29)
  287.     {
  288.         // Player level from 26 to 30 set him this knife
  289.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  290.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  291.        
  292.         ResetKnife(id)
  293.     }
  294.     else if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 50)
  295.     {
  296.         // Player level from 26 to 30 set him this knife
  297.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  298.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  299.        
  300.         ResetKnife(id)
  301.     }
  302.     else if (ze_get_vip_flags(id) & VIP_A)
  303.     {
  304.         // Player level from 26 to 30 set him this knife
  305.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnifeV[V_Model])
  306.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnifeV[P_Model])
  307.        
  308.         ResetKnife(id)
  309.     }
  310. }
  311.  
  312. public ResetKnife(id)
  313. {
  314.     if(!is_user_alive(id))
  315.         return
  316.    
  317.     rg_remove_item(id, "weapon_knife")
  318.     rg_give_item(id, "weapon_knife", GT_APPEND)
  319.     engclient_cmd(id, "weapon_knife")
  320.     emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  321. }
  322.  
  323. public Fw_EmitSound(id, iChannel, const szSound[])
  324. {
  325.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  326.         return FMRES_IGNORED
  327.    
  328.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  329.     {
  330.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  331.         {
  332.             if (equal(g_szDefaultSounds[iIndex], szSound))
  333.             {
  334.                 emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  335.                 return FMRES_SUPERCEDE
  336.             }
  337.         }
  338.     }
  339.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  340.     {
  341.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  342.         {
  343.             if (equal(g_szDefaultSounds[iIndex], szSound))
  344.             {
  345.                 emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  346.                 return FMRES_SUPERCEDE
  347.             }
  348.         }
  349.     }
  350.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  351.     {
  352.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  353.         {
  354.             if (equal(g_szDefaultSounds[iIndex], szSound))
  355.             {
  356.                 emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  357.                 return FMRES_SUPERCEDE
  358.             }
  359.         }
  360.     }
  361.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  362.     {
  363.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  364.         {
  365.             if (equal(g_szDefaultSounds[iIndex], szSound))
  366.             {
  367.                 emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  368.                 return FMRES_SUPERCEDE
  369.             }
  370.         }
  371.     }
  372.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  373.     {
  374.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  375.         {
  376.             if (equal(g_szDefaultSounds[iIndex], szSound))
  377.             {
  378.                 emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  379.                 return FMRES_SUPERCEDE
  380.             }
  381.         }
  382.     }
  383.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  384.     {
  385.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  386.         {
  387.             if (equal(g_szDefaultSounds[iIndex], szSound))
  388.             {
  389.                 emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  390.                 return FMRES_SUPERCEDE
  391.             }
  392.         }
  393.     }
  394.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  395.     {
  396.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  397.         {
  398.             if (equal(g_szDefaultSounds[iIndex], szSound))
  399.             {
  400.                 emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  401.                 return FMRES_SUPERCEDE
  402.             }
  403.         }
  404.     }
  405.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  406.     {
  407.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  408.         {
  409.             if (equal(g_szDefaultSounds[iIndex], szSound))
  410.             {
  411.                 emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  412.                 return FMRES_SUPERCEDE
  413.             }
  414.         }
  415.     }
  416.    else if (ze_get_vip_flags(id) & VIP_E)
  417.     {
  418.         for(new iIndex = 0; iIndex <= charsmax(g_szKnifeVSounds); iIndex++)
  419.         {
  420.             if (equal(g_szKnifeVSounds[iIndex], szSound))
  421.             {
  422.                 emit_sound(id, iChannel, g_szKnifeVSounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  423.                 return FMRES_SUPERCEDE
  424.             }
  425.         }
  426.     }
  427.    
  428.     return FMRES_IGNORED
  429. }

Issue can be from models themselves also, so not only the code which can cause it.

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 163
Joined: 2 Years Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 5 times
Contact:

#7

Post by Luxurious » 1 Month Ago

Raheem wrote:
1 Month Ago
Although the code is simple and seems it may not the cause but I checked is user alive in two functions, try maybe it helps:

  1. #include <zombie_escape>
  2. #include <ze_levels>
  3. #include <ze_vip>
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/cg/v_knife_griff.mdl",
  8.     "models/cg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/cg/v_flip_t.mdl",
  14.     "models/cg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/cg/v_butterfly_knife.mdl",
  19.     "models/cg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/cg/v_bayonet.mdl",
  24.     "models/cg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/cg/v_knife_karambit.mdl",
  29.     "models/cg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/cg/v_knife_karambit.mdl",
  34.     "models/cg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/cg/v_knifew.mdl",
  39.     "models/cg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/cg/v_knifew.mdl",
  44.     "models/cg/p_knifew.mdl"
  45. }
  46.  
  47. new const g_szKnifeV[][] =
  48. {
  49.     "models/cg/v_knifev.mdl",
  50.     "models/cg/p_knifev.mdl"
  51. }
  52.  
  53.  
  54. // Sounds
  55. new const g_szKnife1Sounds[][] =
  56. {
  57.     "weapons/knife_deploy1.wav",
  58.     "weapons/knife_hit1.wav",
  59.     "weapons/knife_hit2.wav",
  60.     "weapons/knife_hit3.wav",
  61.     "weapons/knife_hit4.wav",
  62.     "weapons/knife_hitwall1.wav",
  63.     "weapons/knife_slash1.wav",
  64.     "weapons/knife_slash2.wav",
  65.     "weapons/knife_stab.wav"
  66. }
  67.  
  68. new const g_szKnife2Sounds[][] =
  69. {
  70.     "weapons/knife_deploy1.wav",
  71.     "weapons/knife_hit1.wav",
  72.     "weapons/knife_hit2.wav",
  73.     "weapons/knife_hit3.wav",
  74.     "weapons/knife_hit4.wav",
  75.     "weapons/knife_hitwall1.wav",
  76.     "weapons/knife_slash1.wav",
  77.     "weapons/knife_slash2.wav",
  78.     "weapons/knife_stab.wav"
  79. }
  80.  
  81. new const g_szKnife3Sounds[][] =
  82. {
  83.     "weapons/knife_deploy1.wav",
  84.     "weapons/knife_hit1.wav",
  85.     "weapons/knife_hit2.wav",
  86.     "weapons/knife_hit3.wav",
  87.     "weapons/knife_hit4.wav",
  88.     "weapons/knife_hitwall1.wav",
  89.     "weapons/knife_slash1.wav",
  90.     "weapons/knife_slash2.wav",
  91.     "weapons/knife_stab.wav"
  92. }
  93.  
  94. new const g_szKnife4Sounds[][] =
  95. {
  96.     "weapons/knife_deploy1.wav",
  97.     "weapons/knife_hit1.wav",
  98.     "weapons/knife_hit2.wav",
  99.     "weapons/knife_hit3.wav",
  100.     "weapons/knife_hit4.wav",
  101.     "weapons/knife_hitwall1.wav",
  102.     "weapons/knife_slash1.wav",
  103.     "weapons/knife_slash2.wav",
  104.     "weapons/knife_stab.wav"
  105. }
  106.  
  107. new const g_szKnife5Sounds[][] =
  108. {
  109.     "weapons/knife_deploy1.wav",
  110.     "weapons/knife_hit1.wav",
  111.     "weapons/knife_hit2.wav",
  112.     "weapons/knife_hit3.wav",
  113.     "weapons/knife_hit4.wav",
  114.     "weapons/knife_hitwall1.wav",
  115.     "weapons/knife_slash1.wav",
  116.     "weapons/knife_slash2.wav",
  117.     "weapons/knife_stab.wav"
  118. }
  119.  
  120. new const g_szKnife6Sounds[][] =
  121. {
  122.     "weapons/knife_deploy1.wav",
  123.     "weapons/knife_hit1.wav",
  124.     "weapons/knife_hit2.wav",
  125.     "weapons/knife_hit3.wav",
  126.     "weapons/knife_hit4.wav",
  127.     "weapons/knife_hitwall1.wav",
  128.     "weapons/knife_slash1.wav",
  129.     "weapons/knife_slash2.wav",
  130.     "weapons/knife_stab.wav"
  131. }
  132.  
  133. new const g_szKnife7Sounds[][] =
  134. {
  135.     "weapons/knife_deploy1.wav",
  136.     "weapons/knife_hit1.wav",
  137.     "weapons/knife_hit2.wav",
  138.     "weapons/knife_hit3.wav",
  139.     "weapons/knife_hit4.wav",
  140.     "weapons/knife_hitwall1.wav",
  141.     "weapons/knife_slash1.wav",
  142.     "weapons/knife_slash2.wav",
  143.     "weapons/knife_stab.wav"
  144. }
  145.  
  146. new const g_szKnife8Sounds[][] =
  147. {
  148.     "weapons/knife_deploy1.wav",
  149.     "weapons/knife_hit1.wav",
  150.     "weapons/knife_hit2.wav",
  151.     "weapons/knife_hit3.wav",
  152.     "weapons/knife_hit4.wav",
  153.     "weapons/knife_hitwall1.wav",
  154.     "weapons/knife_slash1.wav",
  155.     "weapons/knife_slash2.wav",
  156.     "weapons/knife_stab.wav"
  157. }
  158.  
  159. new const g_szDefaultSounds[][] =
  160. {
  161.     "weapons/knife_deploy1.wav",
  162.     "weapons/knife_hit1.wav",
  163.     "weapons/knife_hit2.wav",
  164.     "weapons/knife_hit3.wav",
  165.     "weapons/knife_hit4.wav",
  166.     "weapons/knife_hitwall1.wav",
  167.     "weapons/knife_slash1.wav",
  168.     "weapons/knife_slash2.wav",
  169.     "weapons/knife_stab.wav"
  170. }
  171.  
  172. new const g_szKnifeVSounds[][] =
  173. {
  174.     "weapons/knife_deploy1.wav",
  175.     "weapons/knife_hit1.wav",
  176.     "weapons/knife_hit2.wav",
  177.     "weapons/knife_hit3.wav",
  178.     "weapons/knife_hit4.wav",
  179.     "weapons/knife_hitwall1.wav",
  180.     "weapons/knife_slash1.wav",
  181.     "weapons/knife_slash2.wav",
  182.     "weapons/knife_stab.wav"
  183. }
  184. // Models indexes
  185. enum
  186. {
  187.     V_Model = 0,
  188.     P_Model
  189. }
  190.  
  191. public plugin_init()
  192. {
  193.     register_plugin("Knife Levels", "1.0", "Raheem")
  194.    
  195.     // Fakemeta
  196.     register_forward(FM_EmitSound, "Fw_EmitSound")
  197. }
  198.  
  199. public plugin_precache()
  200. {
  201.     new iIndex;
  202.    
  203.     // Prechace models
  204.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  205.         precache_model(g_szKnife1[iIndex])
  206.    
  207.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  208.         precache_model(g_szKnife2[iIndex])
  209.  
  210.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  211.         precache_model(g_szKnife3[iIndex])
  212.  
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  214.         precache_model(g_szKnife4[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  217.         precache_model(g_szKnife5[iIndex])
  218.  
  219.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  220.         precache_model(g_szKnife6[iIndex])
  221.  
  222.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  223.         precache_model(g_szKnife7[iIndex])
  224.  
  225.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  226.         precache_model(g_szKnife8[iIndex])
  227.    
  228.    
  229.     for(iIndex = 0; iIndex <= charsmax(g_szKnifeV); iIndex++)
  230.         precache_model(g_szKnifeV[iIndex])
  231.    
  232.    
  233.     // Prechace sounds
  234.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  235.         precache_sound(g_szKnife1Sounds[iIndex])
  236.  
  237.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  238.         precache_sound(g_szKnife1Sounds[iIndex])
  239. }
  240.  
  241. public ze_user_humanized(id)
  242. {
  243.     if(!is_user_alive(id))
  244.         return
  245.    
  246.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 4)
  247.     {
  248.         // Player level from 1 to 5 set him this knife
  249.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  250.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  251.        
  252.         ResetKnife(id)
  253.     }
  254.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  255.     {
  256.         // Player level from 5 to 8 set him this knife
  257.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  258.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  259.        
  260.         ResetKnife(id)
  261.     }
  262.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  263.     {
  264.         // Player level from 5 to 8 set him this knife
  265.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  266.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  267.        
  268.         ResetKnife(id)
  269.     }
  270.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 19)
  271.     {
  272.         // Player level from 5 to 8 set him this knife
  273.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  274.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  275.        
  276.         ResetKnife(id)
  277.     }
  278.     else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 24)
  279.     {
  280.         // Player level from 26 to 30 set him this knife
  281.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  282.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  283.        
  284.         ResetKnife(id)
  285.     }
  286.     else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 29)
  287.     {
  288.         // Player level from 26 to 30 set him this knife
  289.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  290.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  291.        
  292.         ResetKnife(id)
  293.     }
  294.     else if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 50)
  295.     {
  296.         // Player level from 26 to 30 set him this knife
  297.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  298.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  299.        
  300.         ResetKnife(id)
  301.     }
  302.     else if (ze_get_vip_flags(id) & VIP_A)
  303.     {
  304.         // Player level from 26 to 30 set him this knife
  305.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnifeV[V_Model])
  306.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnifeV[P_Model])
  307.        
  308.         ResetKnife(id)
  309.     }
  310. }
  311.  
  312. public ResetKnife(id)
  313. {
  314.     if(!is_user_alive(id))
  315.         return
  316.    
  317.     rg_remove_item(id, "weapon_knife")
  318.     rg_give_item(id, "weapon_knife", GT_APPEND)
  319.     engclient_cmd(id, "weapon_knife")
  320.     emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  321. }
  322.  
  323. public Fw_EmitSound(id, iChannel, const szSound[])
  324. {
  325.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  326.         return FMRES_IGNORED
  327.    
  328.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  329.     {
  330.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  331.         {
  332.             if (equal(g_szDefaultSounds[iIndex], szSound))
  333.             {
  334.                 emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  335.                 return FMRES_SUPERCEDE
  336.             }
  337.         }
  338.     }
  339.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  340.     {
  341.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  342.         {
  343.             if (equal(g_szDefaultSounds[iIndex], szSound))
  344.             {
  345.                 emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  346.                 return FMRES_SUPERCEDE
  347.             }
  348.         }
  349.     }
  350.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  351.     {
  352.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  353.         {
  354.             if (equal(g_szDefaultSounds[iIndex], szSound))
  355.             {
  356.                 emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  357.                 return FMRES_SUPERCEDE
  358.             }
  359.         }
  360.     }
  361.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  362.     {
  363.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  364.         {
  365.             if (equal(g_szDefaultSounds[iIndex], szSound))
  366.             {
  367.                 emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  368.                 return FMRES_SUPERCEDE
  369.             }
  370.         }
  371.     }
  372.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  373.     {
  374.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  375.         {
  376.             if (equal(g_szDefaultSounds[iIndex], szSound))
  377.             {
  378.                 emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  379.                 return FMRES_SUPERCEDE
  380.             }
  381.         }
  382.     }
  383.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  384.     {
  385.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  386.         {
  387.             if (equal(g_szDefaultSounds[iIndex], szSound))
  388.             {
  389.                 emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  390.                 return FMRES_SUPERCEDE
  391.             }
  392.         }
  393.     }
  394.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  395.     {
  396.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  397.         {
  398.             if (equal(g_szDefaultSounds[iIndex], szSound))
  399.             {
  400.                 emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  401.                 return FMRES_SUPERCEDE
  402.             }
  403.         }
  404.     }
  405.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  406.     {
  407.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  408.         {
  409.             if (equal(g_szDefaultSounds[iIndex], szSound))
  410.             {
  411.                 emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  412.                 return FMRES_SUPERCEDE
  413.             }
  414.         }
  415.     }
  416.    else if (ze_get_vip_flags(id) & VIP_E)
  417.     {
  418.         for(new iIndex = 0; iIndex <= charsmax(g_szKnifeVSounds); iIndex++)
  419.         {
  420.             if (equal(g_szKnifeVSounds[iIndex], szSound))
  421.             {
  422.                 emit_sound(id, iChannel, g_szKnifeVSounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  423.                 return FMRES_SUPERCEDE
  424.             }
  425.         }
  426.     }
  427.    
  428.     return FMRES_IGNORED
  429. }
Can u fix the p knife vip too?

Issue can be from models themselves also, so not only the code which can cause it.
But it was Working well and all models working well... tested before!
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

BandiT
Member
Member
Romania
Posts: 47
Joined: 1 Year Ago
Has thanked: 4 times
Been thanked: 3 times
Contact:

#8

Post by BandiT » 1 Month Ago

I have this problem every time when maps changes and the problem is from the maps some maps have many models and sounds and you have many models and sounds in your serevr and when you change the map in a big map with many models and sound you rich the limit off souns or models, so the single things you can do it-s to take off some models or sounds, or don-t play anymore that maps.

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 163
Joined: 2 Years Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 5 times
Contact:

#9

Post by Luxurious » 1 Month Ago

aha Thx is resloved !
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 2095
Joined: 3 Years Ago
Location: Egypt
Has thanked: 43 times
Been thanked: 129 times
Age: 23
Contact:

#10

Post by Raheem » 1 Month Ago

In that case you can use https://github.com/In-line/metamod_unpr ... /Beta2.5.3 (download unprecacher.tar.gz), after installing it put in list.ini the following:
    1. models/w_antidote.mdl
    2. models/w_security.mdl
    3. models/w_longjump.mdl
    4. items/suitcharge1.wav
    5. items/suitchargeno1.wav
    6. items/suitchargeok1.wav
    7. common/wpn_hudoff.wav
    8. common/wpn_hudon.wav
    9. common/wpn_moveselect.wav
    10. common/wpn_denyselect.wav
    11. player/geiger6.wav
    12. player/geiger5.wav
    13. player/geiger4.wav
    14. player/geiger3.wav
    15. player/geiger2.wav
    16. player/geiger1.wav  
    17. sprites/zerogxplode.spr
    18. sprites/WXplo1.spr
    19. sprites/steam1.spr
    20. sprites/bubble.spr
    21. sprites/bloodspray.spr
    22. sprites/blood.spr
    23. sprites/smokepuff.spr
    24. sprites/eexplo.spr
    25. sprites/fexplo.spr
    26. sprites/fexplo1.spr
    27. sprites/b-tele1.spr
    28. sprites/c-tele1.spr
    29. sprites/ledglow.spr
    30. sprites/laserdot.spr
    31. sprites/explode1.spr
    32. weapons/bullet_hit1.wav
    33. weapons/bullet_hit2.wav
    34. items/weapondrop1.wav
    35. weapons/generic_reload.wav
    36. sprites/smoke.spr
    37. buttons/bell1.wav
    38. buttons/blip1.wav
    39. buttons/blip2.wav
    40. buttons/button11.wav
    41. buttons/latchunlocked2.wav
    42. buttons/lightswitch2.wav
    43. ambience/quail1.wav
    44. weapons/ak47_clipout.wav
    45. weapons/ak47_clipin.wav
    46. weapons/ak47_boltpull.wav
    47. weapons/aug_clipout.wav
    48. weapons/aug_clipin.wav
    49. weapons/aug_boltpull.wav
    50. weapons/aug_boltslap.wav
    51. weapons/aug_forearm.wav
    52. weapons/c4_click.wav
    53. weapons/c4_beep1.wav
    54. weapons/c4_beep2.wav
    55. weapons/c4_beep3.wav
    56. weapons/c4_beep4.wav
    57. weapons/c4_beep5.wav
    58. weapons/c4_explode1.wav
    59. weapons/c4_plant.wav
    60. weapons/c4_disarm.wav
    61. weapons/c4_disarmed.wav
    62. weapons/elite_reloadstart.wav
    63. weapons/elite_leftclipin.wav
    64. weapons/elite_clipout.wav
    65. weapons/elite_sliderelease.wav
    66. weapons/elite_rightclipin.wav
    67. weapons/elite_deploy.wav
    68. weapons/famas_clipout.wav
    69. weapons/famas_clipin.wav
    70. weapons/famas_boltpull.wav
    71. weapons/famas_boltslap.wav
    72. weapons/famas_forearm.wav
    73. weapons/g3sg1_slide.wav
    74. weapons/g3sg1_clipin.wav
    75. weapons/g3sg1_clipout.wav
    76. weapons/galil_clipout.wav
    77. weapons/galil_clipin.wav
    78. weapons/galil_boltpull.wav
    79. weapons/m4a1_clipin.wav
    80. weapons/m4a1_clipout.wav
    81. weapons/m4a1_boltpull.wav
    82. weapons/m4a1_deploy.wav
    83. weapons/m4a1_silencer_on.wav
    84. weapons/m4a1_silencer_off.wav
    85. weapons/m249_boxout.wav
    86. weapons/m249_boxin.wav
    87. weapons/m249_chain.wav
    88. weapons/m249_coverup.wav
    89. weapons/m249_coverdown.wav
    90. weapons/mac10_clipout.wav
    91. weapons/mac10_clipin.wav
    92. weapons/mac10_boltpull.wav
    93. weapons/mp5_clipout.wav
    94. weapons/mp5_clipin.wav
    95. weapons/mp5_slideback.wav
    96. weapons/p90_clipout.wav
    97. weapons/p90_clipin.wav
    98. weapons/p90_boltpull.wav
    99. weapons/p90_cliprelease.wav
    100. weapons/p228_clipout.wav
    101. weapons/p228_clipin.wav
    102. weapons/p228_sliderelease.wav
    103. weapons/p228_slidepull.wav
    104. weapons/scout_bolt.wav
    105. weapons/scout_clipin.wav
    106. weapons/scout_clipout.wav
    107. weapons/sg550_boltpull.wav
    108. weapons/sg550_clipin.wav
    109. weapons/sg550_clipout.wav
    110. weapons/sg552_clipout.wav
    111. weapons/sg552_clipin.wav
    112. weapons/sg552_boltpull.wav
    113. weapons/ump45_clipout.wav
    114. weapons/ump45_clipin.wav
    115. weapons/ump45_boltslap.wav
    116. weapons/usp_clipout.wav
    117. weapons/usp_clipin.wav
    118. weapons/usp_silencer_on.wav
    119. weapons/usp_silencer_off.wav
    120. weapons/usp_sliderelease.wav
    121. weapons/usp_slideback.wav
And stop/start your server. Now we reduced 121 item from precache (useless items) which will give you more ability to precache more without reaching the 512 limit.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests