Resolved Skins Menu Bug

Coding Help/Re-API Supported
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

Skins Menu Bug

#1

Post by Spir0x » 4 Months 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: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#2

Post by Spir0x » 4 Months 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
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 5 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#3

Post by Mark » 4 Months Ago

Spir0x wrote:
4 Months 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: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#4

Post by Spir0x » 4 Months 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: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#5

Post by Spir0x » 4 Months Ago

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

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 5 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#6

Post by Mark » 4 Months Ago

Spir0x wrote:
4 Months 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
Egypt
Posts: 1723
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#7

Post by Raheem » 4 Months 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.
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#8

Post by Spir0x » 4 Months 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
Egypt
Posts: 1723
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#9

Post by Raheem » 4 Months 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
You don't know? Learn and you will know.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 565
Joined: 1 Year Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 6 times
Age: 19
Contact:

#10

Post by Spir0x » 4 Months 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 }
*/

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest