Resolved Skins Menu Bug

Coding Help/Re-API Supported
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1720
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

Re: Skins Menu Bug

#11

Post by Raheem » 4 Months 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. }
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:

#12

Post by Spir0x » 4 Months Ago

Fixed.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest