Raised This Month: $ Target: $400
 0% 

Solved [Bug] Human models shop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 11-04-2020 , 12:10   [Bug] Human models shop
Reply With Quote #1

I'm have made plugin for human models shop but i have bug when i buy skin not shows!!




Code:
public plugin_precache() {     new szBuffer[64];         for(new i; i < sizeof( g_HumanModel ); i++) {         formatex(szBuffer, charsmax(szBuffer), "models/player/%s/%s.mdl", g_HumanModel[i][MODEL_NAME], g_HumanModel[i][MODEL_NAME]);         precache_model(szBuffer);     } }
Code:
public CustomShopHuman(id) {     new g_iMainMenu,         szData[MAX_MENU_LENGTH],         iPoints = zp_get_user_zp_points(id),         iFlags = get_user_flags(id);                 formatex(szData, charsmax(szData), "\yHuman Model\r: ^n\yPoint\r: %d", iPoints)     g_iMainMenu = menu_create(szData, "HumanModelShop")             for(new i; i < sizeof( g_HumanModel ); i++) {         formatex(szData, charsmax(szData), "%s%s \rCost:\y%d", iFlags & g_HumanModel[i][MODEL_FLAG] ? "\w" : "\d", g_HumanModel[i][MODEL_NAME], g_HumanModel[i][MODEL_COST])         menu_additem(g_iMainMenu, szData, "")     }     menu_setprop(g_iMainMenu, MPROP_BACKNAME, "Previous page")     menu_setprop(g_iMainMenu, MPROP_NEXTNAME, "Next page")     menu_setprop(g_iMainMenu, MPROP_EXITNAME, "\rClose")         menu_setprop(g_iMainMenu, MPROP_EXIT, MEXIT_ALL)     menu_display(id, g_iMainMenu)     return PLUGIN_HANDLED; } public HumanModelShop(iPlayer, iMenu, iItem) {     if(iItem != MENU_EXIT) {         new iAccess,             szData[6],             szName[32],             iCallback,             g_ChosenMenu,             iPoints,             iFlags = get_user_flags(iPlayer);             menu_item_getinfo(iMenu, iItem, iAccess, szData, charsmax(szData), szName, charsmax(szName), iCallback);                 g_ChosenMenu = str_to_num(szData)         iPoints = zp_get_user_zp_points(iPlayer) - g_HumanModel[g_ChosenMenu][MODEL_COST]                 if ( zp_get_user_zp_points(iPlayer) < g_HumanModel[g_ChosenMenu][MODEL_COST]) {             Print(iPlayer, "You don't have enough points to this model!");             menu_destroy(iMenu)             return PLUGIN_HANDLED;         }         else {             if( g_HasModel[g_ChosenMenu] ) {                 Print(g_ChosenMenu, "You already have bought this model!");                 menu_destroy(iMenu)                 return PLUGIN_HANDLED;             }                             g_iModelName[ g_ChosenMenu ] = g_HumanModel[iItem][MODEL_NAME]             g_iModelCost[ g_ChosenMenu ] = g_HumanModel[iItem][MODEL_COST]                         if( iFlags & g_HumanModel[ g_ChosenMenu ][MODEL_FLAG] ) {                 zp_set_user_zp_points( g_ChosenMenu, iPoints)                 cs_set_user_model( g_ChosenMenu, g_HumanModel[ g_ChosenMenu ][MODEL_NAME]);                 g_HasModel[g_ChosenMenu] = true;                 Print( g_ChosenMenu , "You have bought^04 %s^01.", g_HumanModel[ g_ChosenMenu ][MODEL_NAME]);             }             else Print( g_ChosenMenu , "You dont have access to buy this model!");                     }     }         menu_destroy(iMenu);     return PLUGIN_HANDLED; }

The bug is here, but i dont know the solve :
Code:
else {             if( g_HasModel[g_ChosenMenu] ) {                 Print(g_ChosenMenu, "You already have bought this model!");                 menu_destroy(iMenu)                 return PLUGIN_HANDLED;             }                             g_iModelName[ g_ChosenMenu ] = g_HumanModel[iItem][MODEL_NAME]             g_iModelCost[ g_ChosenMenu ] = g_HumanModel[iItem][MODEL_COST]                         if( iFlags & g_HumanModel[ g_ChosenMenu ][MODEL_FLAG] ) {                 zp_set_user_zp_points( g_ChosenMenu, iPoints)                 cs_set_user_model( g_ChosenMenu, g_HumanModel[ g_ChosenMenu ][MODEL_NAME]);                 g_HasModel[g_ChosenMenu] = true;                 Print( g_ChosenMenu , "You have bought^04 %s^01.", g_HumanModel[ g_ChosenMenu ][MODEL_NAME]);             }             else Print( g_ChosenMenu , "You dont have access to buy this model!");                     }
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 11-05-2020 at 19:34.
Supremache is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode