[Release] Crate system similar to CS:GO

Joined
Sep 3, 2013
Messages
932
Reaction score
254
Hello,
I am re added tutoriel , i have add link for api.

The tutorial is not 100% complete, but I count on you to make it work 100% :D

Enjoy.









Hey guys, here's a tutorial for a crate system similar to CS:GO The only thing it really needs is the SQL function for it, which i've been working on ALL FUCKING DAY. This system is mainly for newer source, with Terrain V3, i've managed to get it working in an Alpha source, but it needs ALOT of fucking work to work in the older sources, because they switched up how the market works. In the old ones, they separated UIMarket.cpp and FrontEndWarZ.cpp, but in the newer one they said **** it and put it together. WARNING. This is a pretty big tutorial, if your English sucks ass, I recommend you don't do this, because I can't help you if you don't speak English.

Oh, credits to @Valkyrie121 (I think thats his name) because I ripped this from the PDZ Source.

----------------------------
For Newer Sources First
----------------------------
Okay. Step 1. lets get the client out the way.


Search for:
Code:
Code:
void FrontendWarZ::addStore()
{
#if 0
    // add all items to store for test purpose
    addAllItemsToStore();
#endif    


    addStoreToUI(gfxMovie);
}
Below it that function, add
Code:
Code:
unsigned int WINAPI  FrontendWarZ::as_BuyLootBoxThread(void* in_data)
{
    r3dThreadAutoInstallCrashHelper crashHelper;
    FrontendWarZ* This = (FrontendWarZ*)in_data;


    This->DelayServerRequest();
    
    int buyIdx = This->StoreDetectBuyIdx();
    if(buyIdx == 0)
    {
        This->SetAsyncError(-1, gLangMngr.getString("BuyItemFailNoIndex"));
        return 0;
    }


    int apiCode = gUserProfile.ApiLootBoxBuy(This->mStore_BuyItemID, buyIdx);
    if(apiCode != 0)
    {
        This->SetAsyncError(apiCode, gLangMngr.getString("BuyItemFail"));
        return 0;
    }
    return 1;
}




void  FrontendWarZ::OnBuyLootBoxSuccess()
{       
        if(gUserProfile.ProfileData.lastWinID > 0) 
        {
                char winmsg[600];
 
                const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(gUserProfile.ProfileData.lastWinID);
                const GearConfig* gc = g_pWeaponArmory->getGearConfig(gUserProfile.ProfileData.lastWinID);
                const FoodConfig* fc = g_pWeaponArmory->getFoodConfig(gUserProfile.ProfileData.lastWinID);
                const BaseItemConfig* ic = g_pWeaponArmory->getFoodConfig(gUserProfile.ProfileData.lastWinID);
 
                SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/lever8"), r3dPoint3D(0,0,0));
                SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/csgo_ui_crate_open"), r3dPoint3D(0,0,0));
                if(wc)
                {
                        sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", wc->m_StoreName);
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
                }
                else if(gc)
                {
                        sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", gc->m_StoreName);
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
                }
                else if(fc)
                {
                        sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", fc->m_StoreName);
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
                }               
                else if(ic)
                {
                        sprintf(winmsg, "CONGRATULATIONS\n YOU FOUND A <font color=\"#6496FF\">%s</font>\n IT CAN BE FOUND IN YOUR GLOBAL INVENTORY", ic->m_StoreName);
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
                }
                else
                {
                        sprintf(winmsg, "OH FIDDLESTICKS\n YOU FOUND <font color=\"#FF6464\">NOTHING</font> IN THAT CASE\n I BETTER LUCK NEXT TIME");
                        SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/PandemicZ/Crate/item_drop2_uncommon"), r3dPoint3D(0,0,0));
                }
 
                gfxMovie.Invoke("_root.api.Main.Marketplace.showTransactionsPopup", "");
                gfxMovie.Invoke("_root.api.Main.Marketplace.Marketplace.openCase", "");
 
                //setCurrency();
 
 
                gUserProfile.GetProfile();
 
                Scaleform::GFx::Value var3[1];
 
                var3[0].SetInt(gUserProfile.ProfileData.GamePoints);
                gfxMovie.Invoke("_root.api.setGC", var3, 1);
 
                var3[0].SetInt(gUserProfile.ProfileData.GameDollars);
                gfxMovie.Invoke("_root.api.setDollars", var3, 1);
 
                /*var3[0].SetInt(gUserProfile.ProfileData.GameCells);
                gfxMovie.Invoke("_root.api.setCells", var3, 1);*/
 
                
 
                Scaleform::GFx::Value var2[7];
                // clear inventory DB
                gfxMovie.Invoke("_root.api.clearInventory", NULL, 0);
 
                // add all items
                for(uint32_t i=0; i<gUserProfile.ProfileData.NumItems; ++i)
                {
                        var2[0].SetUInt(uint32_t(gUserProfile.ProfileData.Inventory[i].InventoryID));
                        var2[1].SetUInt(gUserProfile.ProfileData.Inventory[i].itemID);
                        var2[2].SetNumber(gUserProfile.ProfileData.Inventory[i].quantity);
                        var2[3].SetNumber(gUserProfile.ProfileData.Inventory[i].Var1);
                        var2[4].SetNumber(gUserProfile.ProfileData.Inventory[i].Var2);
                        bool isConsumable = false;
                        {
                                const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(gUserProfile.ProfileData.Inventory[i].itemID);
                                if(wc && wc->category == storecat_UsableItem && wc->m_isConsumable)
                                        isConsumable = true;
                        }
                        var2[5].SetBoolean(isConsumable);
                        var2[6].SetString(getAdditionalDescForItem(gUserProfile.ProfileData.Inventory[i].itemID, gUserProfile.ProfileData.Inventory[i].Var1, gUserProfile.ProfileData.Inventory[i].Var2, gUserProfile.ProfileData.Inventory[i].Var3));
                        gfxMovie.Invoke("_root.api.addInventoryItem", var2, 7);
                }
 
                gfxMovie.Invoke("_root.api.buyItemSuccessful", "");
                gfxMovie.Invoke("_root.api.hideInfoMsg", "");
 
                /*Scaleform::GFx::Value var[2];
                var[0].SetString(winmsg);
                var[1].SetBoolean(true);
                gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
 
                /*Scaleform::GFx::Value var[3];
                var[0].SetString(winmsg);
                var[1].SetString(winmsg);
                var[2].SetString(winmsg);
                gfxMovie.Invoke("_root.api.Main.Marketplace.setCaseData", var, 3);
 
                gfxMovie.Invoke("_root.api.Main.Marketplace.Marketplace.OpenCase.visible", true);*/
        
        }
        else
        {
                gfxMovie.Invoke("_root.api.buyItemSuccessful", "");
                gfxMovie.Invoke("_root.api.hideInfoMsg", "");
 
                Scaleform::GFx::Value var[2];
                var[0].SetString("Failed to open case");
                var[1].SetBoolean(true);
                gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
        }
 
        mStore_BuyItemID  = 0;
        return;

}
In the near future, i'll make an animation for rotating through the weapons as they spin.

Anyways, next

Code:
Code:
static unsigned int WINAPI as_DeleteCharThread(void* in_data);
    void        OnDeleteCharSuccess();
Under that **** add

Code:
Code:
static unsigned int WINAPI as_BuyLootBoxThread(void* in_data);
    void OnBuyLootBoxSuccess();
Moving on

Code:
Code:
void FrontendWarZ::eventBuyItem(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
Now replace that entire function with this

Code:
Code:
void FrontendWarZ::eventBuyItem(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
    mStore_BuyItemID    = args[0].GetUInt(); // legsID
    mStore_BuyPrice        = args[1].GetInt();
    mStore_BuyPriceGD    = args[2].GetInt();
    //mStore_BuyPriceSC    = args[3].GetInt();


    if(gUserProfile.ProfileData.GameDollars < mStore_BuyPriceGD || gUserProfile.ProfileData.GamePoints < mStore_BuyPrice /*|| gUserProfile.ProfileData.GameCells < mStore_BuyPriceSC*/)
    {
        Scaleform::GFx::Value var[2];
        var[0].SetString(gLangMngr.getString("NotEnougMoneyToBuyItem"));
        var[1].SetBoolean(true);
        gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
        return;
    }


    const BaseItemConfig* itemConfig = g_pWeaponArmory->getAccountItemConfig(mStore_BuyItemID);
    if(itemConfig && itemConfig->category == storecat_LootBox)
    {
        if(gUserProfile.haveFreeInventorySlot(false) == false)
        {
            Scaleform::GFx::Value var[2];
            var[0].SetString(gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
            var[1].SetBoolean(true);
            gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
            return;
        }


        Scaleform::GFx::Value var[2];
        var[0].SetString(gLangMngr.getString("OneMomentPlease"));
        var[1].SetBoolean(false);
        gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);


        StartAsyncOperation(&FrontendWarZ::as_BuyLootBoxThread, &FrontendWarZ::OnBuyLootBoxSuccess);
    }
    else
    {        
        if(gUserProfile.haveFreeInventorySlot(false) == false)
        {
            Scaleform::GFx::Value var[2];
            var[0].SetString(gLangMngr.getString("InGameUI_ErrorMsg_NoInventorySpace"));
            var[1].SetBoolean(true);
            gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);
            return;
        }


        Scaleform::GFx::Value var[2];
        var[0].SetString(gLangMngr.getString("OneMomentPlease"));
        var[1].SetBoolean(false);
        gfxMovie.Invoke("_root.api.showInfoMsg", var, 2);


        StartAsyncOperation(&FrontendWarZ::as_BuyItemThread, &FrontendWarZ::OnBuyItemSuccess);
    }
}
Now search for this

Code:
Code:
var[0].SetNumber(storecat_HeroPackage);
ABOVE IT, Add

Code:
Code:
var[0].SetNumber(storecat_LootBox);
    var[1].SetString("SUPPLY DROPS");
    var[2].SetNumber(8);
    var[3].SetNumber(0);
    gfxMovie.Invoke("_root.api.addCategory", var, 4);
Now search for this

Code:
Code:
var[0].SetNumber(0);
    var[1].SetString("weapon");
    var[2].SetBoolean(false);
    var[3].SetBoolean(true);
    gfxMovie.Invoke("_root.api.addTabType", var, 4);
And above it add

Code:
Code:
var[0].SetNumber(8);
    var[1].SetString("unknown");
    var[2].SetBoolean(true);
    var[3].SetBoolean(false);
    gfxMovie.Invoke("_root.api.addTabType", var, 4);
Basically, that enabled a tab for the crates, you may have to enable a 8th tab in your source if you use guns, or you could disable you guns tab.

Now search for this
Code:
Code:
static void parseCharAttachments(const char* slotData, wiWeaponAttachment& attm)
{
    r3d_assert(slotData);
    if(*slotData == 0) 
    {
        memset(&attm, 0, sizeof(attm));
        return;
    }


    // should match arguments of ApiCharModifyAttachments
    int nargs = sscanf(slotData, "%d %d %d %d %d %d %d %d", 
        &attm.attachments[0], 
        &attm.attachments[1], 
        &attm.attachments[2], 
        &attm.attachments[3], 
        &attm.attachments[4], 
        &attm.attachments[5], 
        &attm.attachments[6], 
        &attm.attachments[7]);
    if(nargs != 8)
    {
        r3dOutToLog("Incorrect number of args in attachments %d\n", nargs);
        memset(&attm, 0, sizeof(attm));
    }
    
    return;
}
Below that function add

Code:
Code:
int CUserProfile::ApiLootBoxBuy(int itemId, int buyIdx)
{
    r3d_assert(buyIdx > 0);


    CWOBackendReq req(this, "api_MysteryBox.aspx");
    req.AddParam("func", "roll");
    req.AddParam("ItemID", itemId);
    req.AddParam("BuyIdx", buyIdx);
    if(!req.Issue())
    {
        r3dOutToLog("ApiLootBoxBuy FAILED, code: %d\n", req.resultCode_);
        return req.resultCode_;
    }


    int nargs = sscanf(req.bodyStr_, "%d", &ProfileData.lastWinID);
    if(nargs != 1)
    {
        r3dError("wrong answer for ApiMysteryBoxBuy");
        return 9;
    }
    


    return 0;
}

Now for the definition for it

below
Code:
Code:
void         ParseBackpacks(pugi::xml_node& xmlItem);
add

Code:
Code:
int          ApiLootBoxBuy(int itemId, int buyIdx);
That SHOULD be it for the client, any compiling errors and i'll update the tutorial. Now we gotta move to the API, and SOME of the database stuff.
[STRIKE]Creds to @GigaToni for some how getting these files, but you need these files here[/STRIKE]


Put the .cs and .aspx files in your API folder, and re-publish it. Then execute the .sql query.

NOW LISTEN

Look in your items_generic, this is where you would put prices for your crates. Make sure the ID's in your new table that was create (Items_CaseData) Basically what this system does is reads "Lootboxes" from items_generics, and casedata is what is contained in each of those, and the percentage if getting it when opening a case. Now last thing is, run this, this creates an SQL function that returns a code 0. This function is not yet done, and i need your guys help to get it working

Code:
Code:
USE [YourDataBaseName]
GO
CREATE PROCEDURE [dbo].[FN_AddItemToUserCase]
    @in_CustomerID int,
    @in_ItemID int,
    @in_ExpDays int
AS
BEGIN
    SET NOCOUNT ON;


    declare @[I][B][URL="https://forum.ragezone.com/members/31337.html"]inventor[/URL][/B][/I]yID bigint = 0
    declare @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil datetime
    declare @CurDate datetime = GETDATE()
    
    -- check if this is stackable item, if so - get buying stack size.
    -- stackable item defined where NumClips>0, Quantity is ClipSize
    declare @BuyStackSize int = 1
    select @BuyStackSize=ClipSize from Items_Weapons where ItemID=@in_ItemID and NumClips>0
    
    -- see if we already have that item in inventory without modification vars
    select @[I][B][URL="https://forum.ragezone.com/members/31337.html"]inventor[/URL][/B][/I]yID=InventoryID, @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil=LeasedUntil from UsersInventory 
        where (CustomerID=@in_CustomerID and CharID=0 and ItemID=@in_ItemID and Var1<0)
    if @[I][B][URL="https://forum.ragezone.com/members/31337.html"]inventor[/URL][/B][/I]yID = 0) 
    begin
        INSERT INTO UsersInventory (
            CustomerID,
            CharID,
            ItemID, 
            LeasedUntil, 
            Quantity
        )
        VALUES (
            @in_CustomerID,
            0,
            @in_ItemID,
            DATEADD(day, @in_ExpDays, @CurDate),
            @BuyStackSize
        )
        return
    end
       
    if @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil < @CurDate)
        set @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil = DATEADD(day, @in_ExpDays, @CurDate)
    else
        set @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil = DATEADD(day, @in_ExpDays, @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil)
        
    if @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil > '2020-1-1')
        set @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil = '2020-1-1'


    -- all items is stackable by default
    UPDATE UsersInventory SET 
        LeasedUntil @[I][B][URL="https://forum.ragezone.com/members/876802.html"]Lease[/URL][/B][/I]dUntil,
        Quantity=(Quantity+@BuyStackSize)
    WHERE InventoryID @[I][B][URL="https://forum.ragezone.com/members/31337.html"]inventor[/URL][/B][/I]yID
        -- success, not really, just a test
    --select 0 as ResultCode
    return
END

And that should be it. Any errors compiling the solution i should be able to fix for ya guys. If anyone knows SQL here, please get that fucking FN_AddItemToUserCase function working. PLEASE YOU NIQQERS.
 
Last edited:
Working SQL
Code:
USE [OldZ]
GO
/****** Object:  Table [dbo].[Items_CaseData]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Items_CaseData](
	[RecordID] [int] IDENTITY(1,1) NOT NULL,
	[LootID] [int] NOT NULL,
	[Chance] [float] NULL,
	[ItemID] [int] NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Items_CaseData] ON
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (4, 301145, 10, 201212)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (5, 301142, 35, 101068)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (6, 301145, 5, 101023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (7, 301145, 20, 201107)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (11, 301138, 50, 101035)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (12, 301138, 50, 101037)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (13, 301138, 50, 101040)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (14, 301138, 50, 101045)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (15, 301138, 50, 101055)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (16, 301141, 49, 101158)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (17, 301143, 2, 101202)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (18, 301143, 20, 101198)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (19, 301143, 25, 101194)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (21, 301140, 5, 201085)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (22, 301138, 50, 101081)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (23, 301139, 50, 101084)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (24, 301139, 50, 101085)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (25, 301139, 50, 101087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (26, 301139, 50, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (27, 301141, 39, 101004)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (28, 301141, 15, 101381)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (29, 301141, 30, 101032)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (30, 301140, 25, 277969)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (36, 301142, 1, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (37, 301142, 2, 101087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (38, 301142, 25, 101247)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (39, 301142, 3, 101084)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (41, 301140, 50, 201087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (42, 301140, 45, 191111)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (43, 301138, 48, 101172)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (47, 301138, 50, 101191)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (48, 301138, 50, 101193)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (50, 301141, 35, 101022)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (52, 301143, 20, 800020)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (54, 301138, 50, 101210)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (66, 301138, 50, 101246)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (67, 301139, 50, 101247)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (71, 301144, 5, 101268)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (72, 301147, 50, 101268)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (73, 301147, 50, 101269)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (74, 301147, 50, 101270)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (75, 301147, 50, 101271)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (76, 301147, 50, 101272)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (77, 301147, 50, 101273)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (78, 301147, 50, 101274)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (79, 301147, 50, 101275)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (80, 301147, 50, 101276)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (81, 301144, 25, 800027)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (82, 301144, 10, 102000)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (105, 301144, 15, 800024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (106, 301144, 20, 800025)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (107, 301144, 22, 101381)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (132, 301138, 50, 101341)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (181, 301165, 50, 108002)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (182, 301165, 50, 108003)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (184, 301165, 50, 108006)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (185, 301165, 50, 108007)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (187, 301138, 50, 108012)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (188, 301165, 50, 108013)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (189, 301141, 50, 101040)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (190, 301143, 65, 800021)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (191, 301143, 60, 800022)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (192, 301150, 50, 108018)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (193, 301150, 50, 108019)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (194, 301150, 50, 108020)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (198, 301138, 50, 180018)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (200, 301143, 45, 800023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (202, 301139, 50, 180023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (203, 301139, 50, 180024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (204, 301141, 45, 101200)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (205, 301143, 1, 800024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (206, 301138, 50, 180276)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (207, 301138, 50, 180286)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (209, 301138, 50, 180289)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (211, 301139, 50, 181391)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (212, 301138, 50, 181392)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (213, 301138, 50, 181393)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (214, 301138, 50, 181394)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (215, 301143, 1, 800025)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (216, 301141, 25, 101055)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (217, 301138, 50, 181397)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (219, 301138, 50, 181401)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (220, 301138, 50, 181402)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (221, 301138, 50, 181403)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (222, 301138, 50, 182000)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (223, 301141, 2, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (224, 301141, 35, 101002)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (227, 301138, 50, 182019)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (231, 301143, 45, 101199)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (232, 301140, 45, 101196)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (233, 301141, 40, 101115)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (234, 301141, 40, 101111)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (237, 301139, 50, 182034)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (238, 301139, 50, 182035)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (239, 301150, 50, 182037)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (240, 301150, 50, 182038)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (241, 301150, 50, 182039)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (243, 301150, 50, 182041)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (244, 301150, 50, 182042)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (247, 301140, 15, 101195)
GO
print 'Processed 100 total records'
SET IDENTITY_INSERT [dbo].[Items_CaseData] OFF
/****** Object:  StoredProcedure [dbo].[WZ_LootGetData]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[WZ_LootGetData] 
	@in_LootID int
AS
BEGIN
	SET NOCOUNT ON;


	-- success
	select 0 as ResultCode


	-- report item category (loot box or mystery box)
	declare [USER=2000195214]CaT[/USER]egory int = 0
	select [USER=2000195214]CaT[/USER]egory=Category from Items_Generic where ItemID=@in_LootID
	select [USER=2000195214]CaT[/USER]egory as 'Category'


	-- report content
	select * from Items_CaseData where LootID=@in_LootID order by Chance asc
END
GO
/****** Object:  StoredProcedure [dbo].[FN_AddItemToUserCase]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FN_AddItemToUserCase]
        @in_CustomerID int,
        @in_ItemID int,
        @in_ExpDays int
AS
BEGIN
 SET NOCOUNT ON;
 
        select 0 as ResultCode
        select @in_ItemID as ItemID
 
 
        declare [USER=31337]inventor[/USER]yID bigint = 0
        declare [USER=876802]Lease[/USER]dUntil datetime
        declare @CurDate datetime = GETDATE()
       
        -- check if this is stackable item, if so - get buying stack size.
        -- stackable item defined where NumClips>0, Quantity is ClipSize
        declare @BuyStackSize int = 1
        select @BuyStackSize=ClipSize from Items_Weapons where ItemID=@in_ItemID and NumClips>0
       
        -- see if we already have that item in inventory without modification vars
        select [USER=31337]inventor[/USER]yID=InventoryID, [USER=876802]Lease[/USER]dUntil=LeasedUntil from UsersInventory
                where (CustomerID=@in_CustomerID and CharID=0 and ItemID=@in_ItemID and Var1<0 and Var2<0)
        if [USER=31337]inventor[/USER]yID = 0)
        begin
                INSERT INTO UsersInventory (
                        CustomerID,
                        CharID,
                        ItemID,
                        LeasedUntil,
                        Quantity
                )
                VALUES (
                        @in_CustomerID,
                        0,
                        @in_ItemID,
                        DATEADD(day, @in_ExpDays, @CurDate),
                        @BuyStackSize
                )
                return
        end
       
        if [USER=876802]Lease[/USER]dUntil < @CurDate)
                set [USER=876802]Lease[/USER]dUntil = DATEADD(day, @in_ExpDays, @CurDate)
        else
                set [USER=876802]Lease[/USER]dUntil = DATEADD(day, @in_ExpDays, [USER=876802]Lease[/USER]dUntil)
               
        if [USER=876802]Lease[/USER]dUntil > '2020-1-1')
                set [USER=876802]Lease[/USER]dUntil = '2020-1-1'
 
        -- all items is stackable by default
        UPDATE UsersInventory SET
                LeasedUntil [USER=876802]Lease[/USER]dUntil,
                Quantity=(Quantity+@BuyStackSize)
        WHERE InventoryID [USER=31337]inventor[/USER]yID
 
        return
END
GO
 
SQL Working with all errors fixed !
Code:
USE [warz]
GO
/****** Object:  Table [dbo].[Items_CaseData]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Items_CaseData](
    [RecordID] [int] IDENTITY(1,1) NOT NULL,
    [LootID] [int] NOT NULL,
    [Chance] [float] NULL,
    [ItemID] [int] NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Items_CaseData] ON
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (4, 301145, 10, 201212)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (5, 301142, 35, 101068)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (6, 301145, 5, 101023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (7, 301145, 20, 201107)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (11, 301138, 50, 101035)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (12, 301138, 50, 101037)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (13, 301138, 50, 101040)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (14, 301138, 50, 101045)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (15, 301138, 50, 101055)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (16, 301141, 49, 101158)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (17, 301143, 2, 101202)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (18, 301143, 20, 101198)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (19, 301143, 25, 101194)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (21, 301140, 5, 201085)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (22, 301138, 50, 101081)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (23, 301139, 50, 101084)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (24, 301139, 50, 101085)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (25, 301139, 50, 101087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (26, 301139, 50, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (27, 301141, 39, 101004)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (28, 301141, 15, 101381)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (29, 301141, 30, 101032)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (30, 301140, 25, 277969)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (36, 301142, 1, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (37, 301142, 2, 101087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (38, 301142, 25, 101247)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (39, 301142, 3, 101084)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (41, 301140, 50, 201087)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (42, 301140, 45, 191111)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (43, 301138, 48, 101172)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (47, 301138, 50, 101191)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (48, 301138, 50, 101193)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (50, 301141, 35, 101022)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (52, 301143, 20, 800020)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (54, 301138, 50, 101210)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (66, 301138, 50, 101246)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (67, 301139, 50, 101247)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (71, 301144, 5, 101268)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (72, 301147, 50, 101268)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (73, 301147, 50, 101269)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (74, 301147, 50, 101270)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (75, 301147, 50, 101271)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (76, 301147, 50, 101272)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (77, 301147, 50, 101273)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (78, 301147, 50, 101274)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (79, 301147, 50, 101275)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (80, 301147, 50, 101276)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (81, 301144, 25, 800027)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (82, 301144, 10, 102000)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (105, 301144, 15, 800024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (106, 301144, 20, 800025)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (107, 301144, 22, 101381)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (132, 301138, 50, 101341)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (181, 301165, 50, 108002)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (182, 301165, 50, 108003)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (184, 301165, 50, 108006)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (185, 301165, 50, 108007)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (187, 301138, 50, 108012)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (188, 301165, 50, 108013)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (189, 301141, 50, 101040)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (190, 301143, 65, 800021)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (191, 301143, 60, 800022)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (192, 301150, 50, 108018)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (193, 301150, 50, 108019)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (194, 301150, 50, 108020)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (198, 301138, 50, 180018)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (200, 301143, 45, 800023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (202, 301139, 50, 180023)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (203, 301139, 50, 180024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (204, 301141, 45, 101200)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (205, 301143, 1, 800024)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (206, 301138, 50, 180276)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (207, 301138, 50, 180286)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (209, 301138, 50, 180289)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (211, 301139, 50, 181391)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (212, 301138, 50, 181392)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (213, 301138, 50, 181393)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (214, 301138, 50, 181394)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (215, 301143, 1, 800025)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (216, 301141, 25, 101055)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (217, 301138, 50, 181397)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (219, 301138, 50, 181401)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (220, 301138, 50, 181402)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (221, 301138, 50, 181403)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (222, 301138, 50, 182000)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (223, 301141, 2, 101088)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (224, 301141, 35, 101002)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (227, 301138, 50, 182019)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (231, 301143, 45, 101199)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (232, 301140, 45, 101196)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (233, 301141, 40, 101115)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (234, 301141, 40, 101111)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (237, 301139, 50, 182034)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (238, 301139, 50, 182035)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (239, 301150, 50, 182037)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (240, 301150, 50, 182038)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (241, 301150, 50, 182039)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (243, 301150, 50, 182041)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (244, 301150, 50, 182042)
INSERT [dbo].[Items_CaseData] ([RecordID], [LootID], [Chance], [ItemID]) VALUES (247, 301140, 15, 101195)
GO
print 'Processed 100 total records'
SET IDENTITY_INSERT [dbo].[Items_CaseData] OFF
/****** Object:  StoredProcedure [dbo].[WZ_LootGetData]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[WZ_LootGetData] 
    @in_LootID int
AS
BEGIN
    SET NOCOUNT ON;




    -- success
    select 0 as ResultCode




    -- report item category (loot box or mystery box)
    declare [USER=2000195214]CaT[/USER]egory int = 0
    select [USER=2000195214]CaT[/USER]egory=Category from Items_Generic where ItemID=@in_LootID
    select [USER=2000195214]CaT[/USER]egory as 'Category'




    -- report content
    select * from Items_CaseData where LootID=@in_LootID order by Chance asc
END
GO
/****** Object:  StoredProcedure [dbo].[FN_AddItemToUserCase]    Script Date: 07/06/2015 20:33:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FN_AddItemToUserCase]
        @in_CustomerID int,
        @in_ItemID int,
        @in_ExpDays int
AS
BEGIN
 SET NOCOUNT ON;
 
        select 0 as ResultCode
        select @in_ItemID as ItemID
 
 
        declare [USER=31337]inventor[/USER]yID bigint = 0
        declare [USER=876802]Lease[/USER]dUntil datetime
        declare @CurDate datetime = GETDATE()
       
        -- check if this is stackable item, if so - get buying stack size.
        -- stackable item defined where NumClips>0, Quantity is ClipSize
        declare @BuyStackSize int = 1
        select @BuyStackSize=ClipSize from Items_Weapons where ItemID=@in_ItemID and NumClips>0
       
        -- see if we already have that item in inventory without modification vars
        select [USER=31337]inventor[/USER]yID=InventoryID, [USER=876802]Lease[/USER]dUntil=LeasedUntil from UsersInventory
                where (CustomerID=@in_CustomerID and CharID=0 and ItemID=@in_ItemID and Var1<0 and Var2<0)
        if  [USER=31337]inventor[/USER]yID = 0)
        begin
                INSERT INTO UsersInventory (
                        CustomerID,
                        CharID,
                        ItemID,
                        LeasedUntil,
                        Quantity
                )
                VALUES (
                        @in_CustomerID,
                        0,
                        @in_ItemID,
                        DATEADD(day, @in_ExpDays, @CurDate),
                        @BuyStackSize
                )
                return
        end
       
        if  [USER=876802]Lease[/USER]dUntil < @CurDate)
                set [USER=876802]Lease[/USER]dUntil = DATEADD(day, @in_ExpDays, @CurDate)
        else
                set [USER=876802]Lease[/USER]dUntil = DATEADD(day, @in_ExpDays, [USER=876802]Lease[/USER]dUntil)
               
        if  [USER=876802]Lease[/USER]dUntil > '2020-1-1')
                set [USER=876802]Lease[/USER]dUntil = '2020-1-1'
 
        -- all items is stackable by default
        UPDATE UsersInventory SET
                LeasedUntil= [USER=876802]Lease[/USER]dUntil,
                Quantity=(Quantity+@BuyStackSize)
        WHERE InventoryID = [USER=31337]inventor[/USER]yID
 
        return
END
GO
 
Thanks you!
All the tutorial is done in the src codes but there is a problem... the cases doesnt show in the store
and the sql put an Incorrect syntax in this I try to delete the ')' but doesn't work

Code:
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 25
Incorrect syntax near ')'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 44
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 46
Incorrect syntax near the keyword 'else'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 49
Incorrect syntax near ')'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 54
Incorrect syntax near '@LeasedUntil'.
wrong or only with me?
asd - [Release] Crate system similar to CS:GO - RaGEZONE Forums
 
@GMkidink Make a backup of your table Items_Generic and try to run this query:
Code:
BEGIN TRANSACTION
GO
INSERT INTO [Items_Generic] ([ItemID], [FNAME], [Category], [Name], [Description], [Price1], [Price7], [Price30], [PriceP], [IsNew], [LevelRequired], [GPrice1], [GPrice7], [GPrice30], [GPriceP], [Weight], [ResWood], [ResStone], [ResMetal], [CPriceP], [lootchance], [itemFlag]) VALUES (N'301152', N'Account_ClanUpg1', N'1', N'Clan Slots 1', N'', N'25', N'0', N'0', N'30', N'0', N'0', N'0', N'0', N'0', N'10', N'0', N'0', N'0', N'0', N'0', null, null), (N'301153', N'Account_ClanUpg2', N'1', N'Clan Slots 2', N'', N'25', N'0', N'0', N'50', N'0', N'0', N'0', N'0', N'0', N'20', N'0', N'0', N'0', N'0', N'0', null, null), (N'301154', N'Account_ClanUpg3', N'1', N'Clan Slots 3', N'', N'25', N'0', N'0', N'60', N'0', N'0', N'0', N'0', N'0', N'30', N'0', N'0', N'0', N'0', N'0', null, null), (N'301155', N'Account_ClanUpg4', N'1', N'Clan Slots 4', N'', N'25', N'0', N'0', N'70', N'0', N'0', N'0', N'0', N'0', N'40', N'0', N'0', N'0', N'0', N'0', null, null), (N'301156', N'Account_ClanUpg5', N'1', N'Clan Slots 5', N'', N'25', N'0', N'0', N'80', N'0', N'0', N'0', N'0', N'0', N'50', N'0', N'0', N'0', N'0', N'0', null, null), (N'301157', N'Account_ClanUpg6', N'1', N'Clan Slots 6', N'', N'25', N'0', N'0', N'90', N'0', N'0', N'0', N'0', N'0', N'60', N'0', N'0', N'0', N'0', N'0', null, null), (N'301159', N'Char_Revive', N'1', N'Revive Char', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'750', N'0', N'0', N'0', N'0', N'0', null, null), (N'301257', N'Account_PremoumSubscribe', N'1', N'Premium Subscription', N'', N'0', N'0', N'0', N'3500', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301399', N'Change_Name', N'1', N'Change Name', N'', N'0', N'0', N'0', N'50', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301138', N'Mega_Loot_', N'7', N'Assault Rifles Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'10000', N'0', N'0', N'0', N'0', N'0', null, null), (N'301139', N'Mega_Loot_', N'7', N'Sniper Rifles Case', N'Open for random items', N'0', N'0', N'0', N'5600', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301140', N'Mega_Loot_', N'7', N'Shotgun Case', N'Open for random items', N'0', N'0', N'0', N'500', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301141', N'Mega_Loot_', N'7', N'Machine Gun Case', N'Open for random items', N'0', N'0', N'0', N'1000', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301142', N'Mega_Loot_', N'7', N'Handgun Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'4000', N'0', N'0', N'0', N'0', N'0', null, null), (N'301143', N'Mega_Loot_', N'7', N'PDW Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'4000', N'0', N'0', N'0', N'0', N'0', null, null), (N'301144', N'Mega_Loot_', N'7', N'Melee Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'500', N'0', N'0', N'0', N'0', N'0', null, null), (N'301145', N'Mil_Box_Case_Equip_01', N'7', N'Covert Case', N'Open for random items', N'0', N'0', N'0', N'1200', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301146', N'Mil_Box_Case_Food_01', N'7', N'Elite Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301147', N'Item_Locker_01', N'7', N'Global Case', N'Open for random items', N'0', N'0', N'0', N'0', N'1', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'1000', null, null), (N'301165', N'Lootbox', N'7', N'Veh Lootbox', N'Open for random items', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301136', N'Item_LootBox', N'7', N'ZOMBIE- Money', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301158', N'Item_LootBox', N'7', N'SPAWN - reserved', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301160', N'Item_LootBox', N'7', N'GEAR - Civilian', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301319', N'Craft_DuckTape_01', N'50', N'Duck Tape', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301320', N'Craft_EmptyBottle_01', N'50', N'Empty Bottle', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301321', N'Craft_Gas_01', N'50', N'Gas', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301322', N'Craft_GlassBottle_01', N'50', N'Glass Bottle', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301323', N'Craft_Glue_01', N'50', N'Glue', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301324', N'Craft_GunPowder_01', N'50', N'Gun Powder', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301325', N'Craft_EmptyJerryCan_01', N'50', N'Empty Jerry Can', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301326', N'Craft_Liquor_01', N'50', N'Liquor', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301327', N'Craft_MetalScrap_01', N'50', N'Metal Scrap', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301328', N'Craft_Nails_01', N'50', N'Nails', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301329', N'Craft_Oil_01', N'50', N'Oil', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301330', N'Craft_Potatoes_01', N'50', N'Potatoes', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301331', N'Craft_Rag_01', N'50', N'Rag', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301332', N'Craft_RazerWire_01', N'50', N'Razer Wire', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301333', N'Craft_Redwine_01', N'50', N'Redwine', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301334', N'Craft_Salt_01', N'50', N'Salt', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301335', N'Craft_Scissors_01', N'50', N'Scissors', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301336', N'Craft_WristWatch_01', N'50', N'Wrist Watch', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301337', N'Craft_Wire_01', N'50', N'Wire', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301339', N'Craft_thread_01', N'50', N'thread', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301349', N'Craft_Acid_01', N'50', N'Acid', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301350', N'Craft_AerosolSpray_01', N'50', N'Aerosol Spray', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301351', N'Craft_AluminumFoil_01', N'50', N'Aluminum Foil', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301352', N'Craft_Ammunition_01', N'50', N'Ammunition', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301353', N'Craft_Amonia_01', N'50', N'Amonia', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301354', N'Craft_Belt_01', N'50', N'Belt', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301355', N'Craft_Broom_01', N'50', N'Broom', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301356', N'Craft_CarBattery_01', N'50', N'Car Battery', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301357', N'Craft_Charcoal_01', N'50', N'Charcoal', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301358', N'Craft_CigaretteLighter_01', N'50', N'Cig Lighter', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301359', N'Craft_DrainO_01', N'50', N'DrainO', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301360', N'Craft_Fat_01', N'50', N'Fat', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301361', N'Craft_Fireworks_01', N'50', N'Fireworks', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301362', N'Craft_JumperCable_01', N'50', N'Jumper Cable', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301363', N'Craft_Ketchup_01', N'50', N'Ketchup', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301364', N'Craft_Lime_01', N'50', N'Lime', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301365', N'Craft_MetalPipe_01', N'50', N'Metal Pipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301266', N'Item_LootBox', N'7', N'V2 Cars - Civilian', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301267', N'Item_LootBox', N'7', N'V2 Cars - Police', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301268', N'Item_LootBox', N'7', N'V2 Cars - Emergency Response', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301278', N'Item_LootBox', N'7', N'V2 Gas Can', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301281', N'Item_LootBox', N'7', N'V2 Cars - Humvee', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301282', N'Item_LootBox', N'7', N'V2 Diner', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301283', N'Item_LootBox', N'7', N'V2 City - Survival spot', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301284', N'Item_LootBox', N'7', N'V2 Guns - Hunting', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301285', N'Item_LootBox', N'7', N'V2 Guns - Civilian', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301286', N'Item_LootBox', N'7', N'V2 Guns - Law', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301287', N'Item_LootBox', N'7', N'V2 Guns - Military Common', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301288', N'Item_LootBox', N'7', N'V2 Guns - Military Rare', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301289', N'Item_LootBox', N'7', N'V2 Guns - Snipers Civilian', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301290', N'Item_LootBox', N'7', N'V2 Cars - Military Heavy', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301291', N'Item_LootBox', N'7', N'V2 Farm - Supplies', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301293', N'Item_LootBox', N'7', N'V2 Rural - House - Supplies', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301295', N'Item_LootBox', N'7', N'V2 Police Station Supplies', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301297', N'Item_LootBox', N'7', N'V2 Hospital', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301298', N'Item_LootBox', N'7', N'V2 Post Office', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301299', N'Item_LootBox', N'7', N'V2 General Store', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301300', N'Item_LootBox', N'7', N'V2 Office - Rural', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301301', N'Item_LootBox', N'7', N'V2 Office - City', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301302', N'Item_LootBox', N'7', N'V2 Military - Roadblock', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301303', N'Item_LootBox', N'7', N'V2 Military - Base', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301304', N'Item_LootBox', N'7', N'V2 Military - Barracks', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301305', N'Item_LootBox', N'7', N'V2 City - House', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301306', N'Item_LootBox', N'7', N'V2 Guns - Snipers Military', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301307', N'Item_LootBox', N'7', N'StrongHold Pick Spawn', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301308', N'Item_LootBox', N'7', N'Cali Backpacks', N'All backpacks', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301309', N'Item_LootBox', N'7', N'Super Zombie Loot', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301310', N'Item_LootBox', N'7', N'V2 Vehicle Spawn', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301311', N'Item_LootBox', N'7', N'T80 Tank Spawn', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301385', N'Item_LootBox', N'7', N'CRAFT - Materials & Recipe', N'Crafting items', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301366', N'Craft_Ointment_01', N'50', N'Ointment', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301367', N'Craft_PVCPipe_01', N'50', N'PVC Pipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301368', N'Craft_PaintStirrer_01', N'50', N'Paint Stirrer', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301369', N'Craft_PropaneCanister_01', N'50', N'Propane Canister', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301370', N'Craft_Rope_01', N'50', N'Rope', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301371', N'Craft_RubberTubes_01', N'50', N'Rubber Tubes', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301372', N'Craft_SawBlade_01', N'50', N'Saw Blade', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null)
GO
GO
INSERT INTO [Items_Generic] ([ItemID], [FNAME], [Category], [Name], [Description], [Price1], [Price7], [Price30], [PriceP], [IsNew], [LevelRequired], [GPrice1], [GPrice7], [GPrice30], [GPriceP], [Weight], [ResWood], [ResStone], [ResMetal], [CPriceP], [lootchance], [itemFlag]) VALUES (N'301373', N'Craft_SewingKit_01', N'50', N'Sewing Kit', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301374', N'Craft_Soap_01', N'50', N'Soap', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301375', N'Craft_Sticks_01', N'50', N'Sticks', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301376', N'Craft_Sugar_01', N'50', N'Sugar', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301377', N'Craft_Syringe_01', N'50', N'Syringe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301378', N'Craft_Tar_01', N'50', N'Tar', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301379', N'Craft_Thermite_01', N'50', N'Thermite', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301380', N'Craft_Vinegar_01', N'50', N'Vinegar', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301386', N'Resource_Metal', N'52', N'Metal', N'special item. do not use it', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301387', N'Resource_Stone', N'52', N'Stone', N'specila item. do not use it', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301388', N'Resource_Wood', N'52', N'Wood', N'special item, do not use it', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301340', N'Craft_Recipe_01', N'51', N'Bandage Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301341', N'Craft_Recipe_01', N'51', N'Silencer Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301342', N'Craft_Recipe_01', N'51', N'Canoe Paddle  Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301343', N'Craft_Recipe_01', N'51', N'Police Baton  Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301344', N'Craft_Recipe_01', N'51', N'Gas Mask Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301345', N'Craft_Recipe_01', N'51', N'Shiv Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301346', N'Craft_Recipe_01', N'51', N'Spear Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301347', N'Craft_Recipe_01', N'51', N'Shrapnel Bomb Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301348', N'Craft_Recipe_01', N'51', N'TripWire Shrapnel Bomb recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301389', N'Craft_Recipe_01', N'51', N'Wooden Door Block Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301390', N'Craft_Recipe_01', N'51', N'Metal Wall Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301391', N'Craft_Recipe_01', N'51', N'Brick Wall Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301392', N'Craft_Recipe_01', N'51', N'Wood Wall Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301393', N'Craft_Recipe_01', N'51', N'Short Brick Wall Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301394', N'Craft_Recipe_01', N'51', N'Farm Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301395', N'Craft_Recipe_01', N'51', N'Solar Water Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301396', N'Craft_Recipe_01', N'51', N'Light Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301397', N'Craft_Recipe_01', N'51', N'Small Power Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301398', N'Craft_Recipe_01', N'51', N'Big Power Recipe', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'50', null), (N'301225', N'Item_LootBox', N'7', N'SPAWN - Police Car', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301382', N'Item_LootBox', N'7', N'Cali Ammo', N'All Ammo', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null), (N'301264', N'Item_LootBox', N'7', N'GUNS - Attachment Hunting', N'', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', null, null)
GO
GO
COMMIT TRANSACTION
GO
 
Last edited:
still the same maybe is not 8th there as ADM-U307 said but already I add it in this functions

Code:
var[0].SetNumber(storecat_LootBox);
    var[1].SetString("SUPPLY DROPS");
    var[2].SetNumber(8);
    var[3].SetNumber(0);
    gfxMovie.Invoke("_root.api.addCategory", var, 4);

Code:
	var[0].SetNumber(8);
    var[1].SetString("unknown");
    var[2].SetBoolean(true);
    var[3].SetBoolean(false);
    gfxMovie.Invoke("_root.api.addTabType", var, 4);


Code:
	void FrontendWarZ::eventMarketplaceActive(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
	gfxMovie.SetVariable("_root.api.Main.Marketplace.Marketplace.Tab7.visible", true);
	gfxMovie.SetVariable("_root.api.Main.Marketplace.Marketplace.Tab8.visible", true);
	r3d_assert(argCount==0);
	writeGameOptionsFile();
}
 
Thanks @Thanks works here!!!
Oosmar02 - [Release] Crate system similar to CS:GO - RaGEZONE Forums




But i same this error

Oosmar02 - [Release] Crate system similar to CS:GO - RaGEZONE Forums



my r3dlog.txt


Code:
000015.271| writeGameOptionsFile: Saving settings to C:\Users\leou3\Documents\InsaneZConfig\InsaneZ\gameSettings.ini000015.334| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mil_Box_Case_Food_01.dds
000201.794| WO_API: failed with error code 5 ResultCode not set
000201.794| ApiLootBoxBuy FAILED, code: 5
 
Thanks @Thanks works here!!!
Oosmar02 - [Release] Crate system similar to CS:GO - RaGEZONE Forums




But i same this error

Oosmar02 - [Release] Crate system similar to CS:GO - RaGEZONE Forums



my r3dlog.txt


Code:
000015.271| writeGameOptionsFile: Saving settings to C:\Users\leou3\Documents\InsaneZConfig\InsaneZ\gameSettings.ini000015.334| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mega_Loot_.dds
000015.335| r3dFile: can't open Data/Weapons/StoreIcons/Mil_Box_Case_Food_01.dds
000201.794| WO_API: failed with error code 5 ResultCode not set
000201.794| ApiLootBoxBuy FAILED, code: 5

Use my SQL function.
 
I got the same error as GMkidink

Code:
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 22
Incorrect syntax near ')'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 41
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 43
Incorrect syntax near the keyword 'else'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 46
Incorrect syntax near ')'.
Msg 102, Level 15, State 1, Procedure FN_AddItemToUserCase, Line 52
Incorrect syntax near '@LeasedUntil'.
 
Back