Raised This Month: $ Target: $400
 0% 

Global Offensive Mod 2.15 Beta [LAST UPDATE: 08. 13] *BUG FIXED


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 10-30-2017 , 14:14   Re: Global Offensive Mod 2.15 Beta [LAST UPDATE: 08. 13] *BUG FIXED
Reply With Quote #1

As a fix that I made for duplicated skins (using Market then Trading) I tried to remove the user's item as soon as he puts it in Market. So if he cancells his Item sell the item goes back to his Inventory.

PHP Code:
public MarketMenuh(idMenuItem)
{
    if(
Item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return;
    }
    
    new 
Data[14], Line[32];
    new 
AccessCallback;
    
menu_item_getinfo(MenuItemAccessDatacharsmax(Data), Linecharsmax(Line), Callback);
    
    new 
str_to_num(Data);
    
    switch(
x)
    {
        case 
0:
        {
            if(
InMarket[id]) {
                if(
MarketItem[id] > && MarketItem[id] <= 90+MAXKNIFESKINS)
                {
                    
Weapons[id][MarketItem[id]]++;
                }
                else if(
MarketItem[id] > 90+MAXKNIFESKINS && MarketItem[id] <= 90+MAXKNIFESKINS+MAXCASES)
                {
                    
Cases[id][MarketItem[id]-(90+MAXKNIFESKINS)]++;
                }
                else if(
MarketItem[id] > 0)
                {
                    
Keys[id]++;
                }
            }
            
InMarket[id] = 0;
            
MarketItem[id] = 0;
            
MarketDollar[id] = 0;
            
MChooseItem(id);
        }
        
        case 
1:
        {
            
MChooseItem(id);
        }
        
        case 
2:
        {
            
client_cmd(id"messagemode MARKETDOLLAR");
            
MarketMenu(id);
        }
        
        case 
3:
        {
            if(
MarketItem[id] > 0)
            {
                new 
ItemName[32];
    
                if(
MarketItem[id] > && MarketItem[id] <= 90+MAXKNIFESKINS)
                {
                    
formatex(ItemNamecharsmax(ItemName), "%s"SkinData[MarketItem[id]][0]);
                    
Weapons[id][MarketItem[id]]--;
                }
                else if(
MarketItem[id] > 90+MAXKNIFESKINS && MarketItem[id] <= 90+MAXKNIFESKINS+MAXCASES)
                {
                    
formatex(ItemNamecharsmax(ItemName), "%s"Case_Data[MarketItem[id]-(90+MAXKNIFESKINS)][0]);
                    
Cases[id][MarketItem[id]-(90+MAXKNIFESKINS)]--;
                }
                else if(
MarketItem[id] > 0)
                {
                    
formatex(ItemNamecharsmax(ItemName), "%s"KeyName);
                    
Keys[id]--;
                }
                
                for(new 
iMAXPi++)
                    if(
is_user_connected(i))
                        
print_color(i"!g%s!y %L"Prefixi"SOLVEDTOMARKET"Name[id], ItemNameMarketDollar[id]);
                        
                
InMarket[id] = 1;
                
MarketMenu(id);
            }
            else
            {
                
MarketMenu(id);
            }
        }
    }
}

public 
BuyMenu(id)
{        
 
//Original Code
}

public 
BuyMenuh(idMenuItem)
{
    if(
Item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return;
    }
    
    new 
Data[14], Line[32];
    new 
AccessCallback;
    
menu_item_getinfo(MenuItemAccessDatacharsmax(Data), Linecharsmax(Line), Callback);
    
    new 
str_to_num(Data);
    
    if(
InMarket[x] > && MarketItem[x] > && MarketDollar[x] > 0)
    {
        if(
Dollars[id] < MarketDollar[x])
        {
            
print_color(id"!g%s!y %L"Prefixid"NOTENOUGHDOLLAR");
            return;
        }
        
        if(
MarketItem[x] > && MarketItem[x] <= 90+MAXKNIFESKINS)
        {
            
Weapons[id][MarketItem[x]]++;
        }
        else if(
MarketItem[x] > 90+MAXKNIFESKINS && MarketItem[x] <= 90+MAXKNIFESKINS+MAXCASES)
        {
            
Cases[id][MarketItem[x]-(90+MAXKNIFESKINS)]++;
        }
        else if(
MarketItem[x] > 0)
        {
            
Keys[id]++;
        }
        
        
Dollars[id] -= MarketDollar[x];
        
Dollars[x] += MarketDollar[x];
        
InMarket[x] = 0;
        
        new 
ItemName[32];
    
        if(
MarketItem[id] > && MarketItem[id] <= 90+MAXKNIFESKINS)
        {
            
formatex(ItemNamecharsmax(ItemName), "%s"SkinData[MarketItem[id]][0]);
        }
        else if(
MarketItem[id] > 90+MAXKNIFESKINS && MarketItem[id] <= 90+MAXKNIFESKINS+MAXCASES)
        {
            
formatex(ItemNamecharsmax(ItemName), "%s"Case_Data[MarketItem[id]-(90+MAXKNIFESKINS)][0]);
        }
        else if(
MarketItem[id] > 0)
        {
            
formatex(ItemNamecharsmax(ItemName), "%s"KeyName);
        }
        
        
        for(new 
iMAXPi++)
            if(
is_user_connected(i))
                
print_color(i"!g%s!y %L"Prefixi"BUYINGITEM"Name[id], ItemNameMarketDollar[x], Name[x]);
                
        
MarketDollar[x] = 0;
        
MarketItem[x] = 0;
        
SQL_UpdateUser(id);
        
SQL_UpdateUser(x);
    }


Last edited by TheWhitesmith; 10-30-2017 at 14:15.
TheWhitesmith is offline
Reply



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 10:00.


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