Solved Skins Menu Bug

Coding Help/Re-API Supported
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

Skins Menu Bug

#1

Post by Spir0x » 5 years ago

Guyz i want to fix this plugin it's skins menu ok. first when i choose any skin from 1 too 4 it's shows Arctic skin of Terrorist not One From Halo skins. i want to fix it please and another little problem when i choose a skin i can't choose another one in the next round i mean i can choose only 1 skin per map and i want it 1 skin per round not per maps.

Screenshots:
Image

Image

Image

Image

Code:

Code: Select all

 #include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <zombie_escape>


new g_pCvarUseTimes
new g_iUsedTimes[33]

public plugin_natives()
{
    register_native("ze_open_skin_menu", "native_ze_open_skin_menu", 1)
}

public plugin_init() 
{
    register_plugin("[ZE] Skins", "1.1", "Spi")
    g_pCvarUseTimes = register_cvar("ze_skin_menu_used", "1")
}
public plugin_precache() 
{
        precache_model("models/player/Halo_O/Halo_O.mdl")
        precache_model("models/player/Halo_W/Halo_W.mdl")
        precache_model("models/player/Halo_B/Halo_B.mdl")
        precache_model("models/player/Halo_R/Halo_R.mdl")
}
public model_menu(id)
{
    if (ze_is_user_zombie(id))
    {
        ze_colored_print(id, "!tYou can't change your skin while you are zombie!y.")
        return PLUGIN_HANDLED
    }
    if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
    {
        ze_colored_print(id, "!tYou have already changed your !gskin!y!")
        return PLUGIN_HANDLED
    }
    else
    {
        new menu = menu_create("\r[\wSkins Menu\r]\r", "menu_wybierz")
    
        menu_additem(menu, "\wHalo \y| \rOrange", "1", 0)
        menu_additem(menu, "\wHalo \y| \rWhite", "2", 0)
        menu_additem(menu, "\wHalo \y| \rBlue", "3", 0)
        menu_additem(menu, "\wHalo \y| \rRed", "4", 0)

    
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display(id, menu, 0)
    }
    return PLUGIN_HANDLED
}
public menu_wybierz(id, menu, item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    new data[20], iName[500]
    new acces, callback
    menu_item_getinfo(menu, item, acces, data,20, iName, 500, callback)
    
    new key = str_to_num(data)
    
    switch(key)
    { 
       case 1 : {
        cs_set_user_model(id, "Halo Orange")
        ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 2 : {
        cs_set_user_model(id, "Halo White")
        ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 3 : {
        cs_set_user_model(id, "Halo Blue")
        ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 4 : {
        cs_set_user_model(id, "Halo Red")
        ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
}  
public native_ze_open_skin_menu(id)
{
    model_menu(id)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#2

Post by Spir0x » 5 years ago

I also removed the 4 Human Models from ze_special_models.
and removed:
HUMAN 1 = Human1
HUMAN 2 = Human2
HUMAN 3 = Human3
HUMAN 4 = Human4
from zombie_escape.ini. now idk why this plusin won't work perfectly.

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#3

Post by Mark » 5 years ago

Spir0x wrote: 5 years ago I also removed the 4 Human Models from ze_special_models.
and removed:
HUMAN 1 = Human1
HUMAN 2 = Human2
HUMAN 3 = Human3
HUMAN 4 = Human4
from zombie_escape.ini. now idk why this plusin won't work perfectly.
Try!
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <zombie_escape>
  5.  
  6.  
  7. new g_pCvarUseTimes
  8. new g_iUsedTimes[33]
  9.  
  10. public plugin_natives()
  11. {
  12.     register_native("ze_open_skin_menu", "native_ze_open_skin_menu", 1)
  13. }
  14.  
  15. public plugin_init()
  16. {
  17.     register_plugin("[ZE] Skins", "1.1", "Spi")
  18.     g_pCvarUseTimes = register_cvar("ze_skin_menu_used", "1")
  19. }
  20. public plugin_precache()
  21. {
  22.         precache_model("models/player/Halo_O/Halo_O.mdl")
  23.         precache_model("models/player/Halo_W/Halo_W.mdl")
  24.         precache_model("models/player/Halo_B/Halo_B.mdl")
  25.         precache_model("models/player/Halo_R/Halo_R.mdl")
  26. }
  27.  
  28. public ze_user_humanized(id)
  29. {
  30.   g_iUsedTimes[id] = 0
  31. }
  32.  
  33. public model_menu(id)
  34. {
  35.     if (ze_is_user_zombie(id))
  36.     {
  37.         ze_colored_print(id, "!tYou can't change your skin while you are zombie!y.")
  38.         return PLUGIN_HANDLED
  39.     }
  40.     if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
  41.     {
  42.         ze_colored_print(id, "!tYou have already changed your !gskin!y!")
  43.         return PLUGIN_HANDLED
  44.     }
  45.     else
  46.     {
  47.         new menu = menu_create("\r[\wSkins Menu\r]\r", "menu_wybierz")
  48.    
  49.         menu_additem(menu, "\wHalo \y| \rOrange", "1", 0)
  50.         menu_additem(menu, "\wHalo \y| \rWhite", "2", 0)
  51.         menu_additem(menu, "\wHalo \y| \rBlue", "3", 0)
  52.         menu_additem(menu, "\wHalo \y| \rRed", "4", 0)
  53.  
  54.    
  55.         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
  56.         menu_display(id, menu, 0)
  57.     }
  58.     return PLUGIN_HANDLED
  59. }
  60. public menu_wybierz(id, menu, item)
  61. {
  62.     if (item == MENU_EXIT)
  63.     {
  64.         menu_destroy(menu)
  65.         return PLUGIN_HANDLED
  66.     }
  67.     new data[20], iName[500]
  68.     new acces, callback
  69.     menu_item_getinfo(menu, item, acces, data,20, iName, 500, callback)
  70.    
  71.     new key = str_to_num(data)
  72.    
  73.     switch(key)
  74.     {
  75.        case 1 : {
  76.         cs_set_user_model(id, "Halo Orange")
  77.         ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
  78.         g_iUsedTimes[id]++
  79.         }
  80.        case 2 : {
  81.         cs_set_user_model(id, "Halo White")
  82.         ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
  83.         g_iUsedTimes[id]++
  84.         }
  85.        case 3 : {
  86.         cs_set_user_model(id, "Halo Blue")
  87.         ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
  88.         g_iUsedTimes[id]++
  89.         }
  90.        case 4 : {
  91.         cs_set_user_model(id, "Halo Red")
  92.         ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
  93.         g_iUsedTimes[id]++
  94.         }
  95.     }
  96.     g_iUsedTimes[id]++
  97.     menu_destroy(menu)
  98.     return PLUGIN_HANDLED
  99. }  
  100. public native_ze_open_skin_menu(id)
  101. {
  102.     model_menu(id)
  103. }
  104. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  105. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
  106. */
Also with this code every time the human gets infected there skin will change back to normal and they will have to pick again you know this right?

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#4

Post by Spir0x » 5 years ago

Bro i'm not speakig about infecting also i tested your code now it's the same problem when i choose any skin i see Arctic skin of terrorist :/

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#5

Post by Spir0x » 5 years ago

I also disabled ze_special_models to test.. same problem @Raheem bro can you help here ?

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#6

Post by Mark » 5 years ago

Spir0x wrote: 5 years ago Bro i'm not speakig about infecting also i tested your code now it's the same problem when i choose any skin i see Arctic skin of terrorist :/
What operating system you using lunix?

I would check this and make sure is matches spelling on server as far as the code im using almost the samething with no problem.

public plugin_precache()
{
precache_model("models/player/Halo_O/Halo_O.mdl")
precache_model("models/player/Halo_W/Halo_W.mdl")
precache_model("models/player/Halo_B/Halo_B.mdl")
precache_model("models/player/Halo_R/Halo_R.mdl")
}

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

#7

Post by Raheem » 5 years ago

Change:
    1.     switch(key)
    2.     {
    3.        case 1 : {
    4.         cs_set_user_model(id, "Halo Orange")
    5.         ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
    6.         g_iUsedTimes[id]++
    7.         }
    8.        case 2 : {
    9.         cs_set_user_model(id, "Halo White")
    10.         ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
    11.         g_iUsedTimes[id]++
    12.         }
    13.        case 3 : {
    14.         cs_set_user_model(id, "Halo Blue")
    15.         ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
    16.         g_iUsedTimes[id]++
    17.         }
    18.        case 4 : {
    19.         cs_set_user_model(id, "Halo Red")
    20.         ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
    21.         g_iUsedTimes[id]++
    22.         }
    23.     }
To:
    1.     switch(key)
    2.     {
    3.        case 1 : {
    4.         rg_set_user_model(id, "Halo_O")
    5.         ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
    6.         g_iUsedTimes[id]++
    7.         }
    8.        case 2 : {
    9.         rg_set_user_model(id, "Halo_W")
    10.         ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
    11.         g_iUsedTimes[id]++
    12.         }
    13.        case 3 : {
    14.         rg_set_user_model(id, "Halo_B")
    15.         ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
    16.         g_iUsedTimes[id]++
    17.         }
    18.        case 4 : {
    19.         rg_set_user_model(id, "Halo_R")
    20.         ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
    21.         g_iUsedTimes[id]++
    22.         }
    23.     }
You should use in rg_set_user_model native the model folder name exactly as in the precaching.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#8

Post by Spir0x » 5 years ago

Solved. but it looks like knife menu every new round the skin resets to original one like "leet, arctic, gign" then i want it when he take any skin it stay all the rounds. not only one round. then he already can change it only in the next round. now just make it working in all rounds ?

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

#9

Post by Raheem » 5 years ago

You will need to make Boolean variable for every model, and make it true when player choose this model. On player infection or humanization you set the model based on the true boolean variable.

You can do it like done here: viewtopic.php?f=12&t=3352
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#10

Post by Spir0x » 5 years ago

Bro i don't want it for vips you can't edit my own code ?

Code: Select all

#include <zombie_escape>
 
 
new g_pCvarUseTimes
new g_iUsedTimes[33]
 
public plugin_natives()
{
    register_native("ze_open_skin_menu", "native_ze_open_skin_menu", 1)
}
 
public plugin_init()
{
    register_plugin("[ZE] Skins", "1.1", "Spi")
    g_pCvarUseTimes = register_cvar("ze_skin_menu_used", "1")
}
public plugin_precache()
{
        precache_model("models/player/Halo_O/Halo_O.mdl")
        precache_model("models/player/Halo_W/Halo_W.mdl")
        precache_model("models/player/Halo_B/Halo_B.mdl")
        precache_model("models/player/Halo_R/Halo_R.mdl")
}
 
public ze_user_humanized(id)
{
  g_iUsedTimes[id] = 0
}
 
public model_menu(id)
{
    if (ze_is_user_zombie(id))
    {
        ze_colored_print(id, "!tYou can't change your skin while you are zombie!y.")
        return PLUGIN_HANDLED
    }
    if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
    {
        ze_colored_print(id, "!tYou have already changed your !gskin!y!")
        return PLUGIN_HANDLED
    }
    else
    {
        new menu = menu_create("\r[\wSkins Menu\r]\r", "menu_wybierz")
   
        menu_additem(menu, "\wHalo \y| \rOrange", "1", 0)
        menu_additem(menu, "\wHalo \y| \rWhite", "2", 0)
        menu_additem(menu, "\wHalo \y| \rBlue", "3", 0)
        menu_additem(menu, "\wHalo \y| \rRed", "4", 0)
 
   
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display(id, menu, 0)
    }
    return PLUGIN_HANDLED
}
public menu_wybierz(id, menu, item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    new data[20], iName[500]
    new acces, callback
    menu_item_getinfo(menu, item, acces, data,20, iName, 500, callback)
   
    new key = str_to_num(data)
   
    switch(key)
    {
       case 1 : {
        rg_set_user_model(id, "Halo_O")
        ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 2 : {
        rg_set_user_model(id, "Halo_W")
        ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 3 : {
        rg_set_user_model(id, "Halo_B")
        ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
       case 4 : {
        rg_set_user_model(id, "Halo_R")
        ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
        g_iUsedTimes[id]++
        }
    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
}  
public native_ze_open_skin_menu(id)
{
    model_menu(id)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1036\\ f0\\ fs16 \n\\ par }
*/

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

#11

Post by Raheem » 5 years ago

Test:

  1. #include <zombie_escape>
  2.  
  3.  
  4. new g_pCvarUseTimes
  5. new g_iUsedTimes[33]
  6. new bool:g_bHaloO[33], bool:g_bHaloW[33], bool:g_bHaloB[33], bool:g_bHaloR[33]
  7.  
  8. public plugin_natives()
  9. {
  10.     register_native("ze_open_skin_menu", "native_ze_open_skin_menu", 1)
  11. }
  12.  
  13. public plugin_init()
  14. {
  15.     register_plugin("[ZE] Skins", "1.1", "Spi")
  16.     g_pCvarUseTimes = register_cvar("ze_skin_menu_used", "1")
  17. }
  18. public plugin_precache()
  19. {
  20.         precache_model("models/player/Halo_O/Halo_O.mdl")
  21.         precache_model("models/player/Halo_W/Halo_W.mdl")
  22.         precache_model("models/player/Halo_B/Halo_B.mdl")
  23.         precache_model("models/player/Halo_R/Halo_R.mdl")
  24. }
  25.  
  26. public ze_user_humanized(id)
  27. {
  28.   g_iUsedTimes[id] = 0
  29.  
  30.   if (g_bHaloO[id])
  31.   {
  32.       rg_set_user_model(id, "Halo_O")
  33.   }
  34.   else if (g_bHaloW[id])
  35.   {
  36.       rg_set_user_model(id, "Halo_W")
  37.   }
  38.   else if (g_bHaloB[id])
  39.   {
  40.       rg_set_user_model(id, "Halo_B")
  41.   }
  42.   else if (g_bHaloR[id])
  43.   {
  44.       rg_set_user_model(id, "Halo_R")
  45.   }
  46. }
  47.  
  48. public model_menu(id)
  49. {
  50.     if (ze_is_user_zombie(id))
  51.     {
  52.         ze_colored_print(id, "!tYou can't change your skin while you are zombie!y.")
  53.         return PLUGIN_HANDLED
  54.     }
  55.     if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
  56.     {
  57.         ze_colored_print(id, "!tYou have already changed your !gskin!y!")
  58.         return PLUGIN_HANDLED
  59.     }
  60.     else
  61.     {
  62.         new menu = menu_create("\r[\wSkins Menu\r]\r", "menu_wybierz")
  63.    
  64.         menu_additem(menu, "\wHalo \y| \rOrange", "1", 0)
  65.         menu_additem(menu, "\wHalo \y| \rWhite", "2", 0)
  66.         menu_additem(menu, "\wHalo \y| \rBlue", "3", 0)
  67.         menu_additem(menu, "\wHalo \y| \rRed", "4", 0)
  68.  
  69.    
  70.         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
  71.         menu_display(id, menu, 0)
  72.     }
  73.     return PLUGIN_HANDLED
  74. }
  75. public menu_wybierz(id, menu, item)
  76. {
  77.     if (item == MENU_EXIT)
  78.     {
  79.         menu_destroy(menu)
  80.         return PLUGIN_HANDLED
  81.     }
  82.     new data[20], iName[500]
  83.     new acces, callback
  84.     menu_item_getinfo(menu, item, acces, data,20, iName, 500, callback)
  85.    
  86.     new key = str_to_num(data)
  87.    
  88.     switch(key)
  89.     {
  90.        case 1 : {
  91.         rg_set_user_model(id, "Halo_O")
  92.         ze_colored_print(id, "!tYou picked the !gOrange Halo Skin!y!", id)
  93.         g_iUsedTimes[id]++
  94.         g_bHaloO[id] = true
  95.         g_bHaloW[id] = false
  96.         g_bHaloB[id] = false
  97.         g_bHaloR[id] = false
  98.         }
  99.        case 2 : {
  100.         rg_set_user_model(id, "Halo_W")
  101.         ze_colored_print(id, "!tYou picked the !gWhite Halo Skin!y!", id)
  102.         g_iUsedTimes[id]++
  103.         g_bHaloO[id] = false
  104.         g_bHaloW[id] = true
  105.         g_bHaloB[id] = false
  106.         g_bHaloR[id] = false
  107.         }
  108.        case 3 : {
  109.         rg_set_user_model(id, "Halo_B")
  110.         ze_colored_print(id, "!tYou picked the !gBlue Halo Skin!y!", id)
  111.         g_iUsedTimes[id]++
  112.         g_bHaloO[id] = false
  113.         g_bHaloW[id] = false
  114.         g_bHaloB[id] = true
  115.         g_bHaloR[id] = false
  116.         }
  117.        case 4 : {
  118.         rg_set_user_model(id, "Halo_R")
  119.         ze_colored_print(id, "!tYou picked the !gRed Halo Skin!y!", id)
  120.         g_iUsedTimes[id]++
  121.         g_bHaloO[id] = false
  122.         g_bHaloW[id] = false
  123.         g_bHaloB[id] = false
  124.         g_bHaloR[id] = true
  125.         }
  126.     }
  127.     menu_destroy(menu)
  128.     return PLUGIN_HANDLED
  129. }  
  130. public native_ze_open_skin_menu(id)
  131. {
  132.     model_menu(id)
  133. }
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#12

Post by Spir0x » 5 years ago

Fixed.

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 5 guests