Raised This Month: $ Target: $400
 0% 

Issue [CSGO] store creating module help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moshiko014
Senior Member
Join Date: Apr 2010
Old 07-28-2014 , 03:29   [CSGO] store creating module help
Reply With Quote #1

I was trying to create a knife module for csgo store and i had some issues.
i created the plugin store-knifes and created a category and items but when trying to use shop at the server it wasnt showing this categorey or items you could only see trails category and trails was working fine.

this is the sourcecode of the plugin i made:
PHP Code:

#include <sourcemod>
#include <sdktools>
#include <store>
#include <cstrike>

new Handle:g_knifePaths INVALID_HANDLE;
new 
g_knifes[MAXPLAYERS+1];
public 
OnPluginStart()
{
    
HookEvent("player_spawn",SpawnEvent);
    
g_knifePaths CreateTrie();
    
Store_RegisterItemType("knife"OnKnifeUseOnKnifeAttributesLoad);
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"store-inventory"))
    {
        
Store_RegisterItemType("knife"OnKnifeUseOnKnifeAttributesLoad);
    }   
}

// This will be called when the attributes are loaded.
public OnKnifeAttributesLoad(const String:itemName[], const String:knifename[])
{
    
    
SetTrieString(g_knifePathsitemNameknifename);
    
}

// This will be called when players use our item in their inventory.
public Store_ItemUseAction:OnKnifeUse(clientitemIdbool:equipped)
{
    
decl String:displayName[STORE_MAX_DISPLAY_NAME_LENGTH];
    
Store_GetItemDisplayName(itemIddisplayNamesizeof(displayName));
        
    if (
IsClientInGame(client))
    {
        
    
    
        if (
equipped)
        {        
            
PrintToChat(client"%s%t"STORE_PREFIX"Unequipped item"displayName);
            
decl String:knifeName[STORE_MAX_NAME_LENGTH];
            
Store_GetItemName(itemIdknifeNamesizeof(knifeName));
            
g_knifes[client]=0;
            return 
Store_UnequipItem;
        }

        else
        {
        
            
decl String:knifeName[STORE_MAX_NAME_LENGTH];
            
Store_GetItemName(itemIdknifeNamesizeof(knifeName));
        
            if(
StrEqual(knifeName,"bayonet")) g_knifes[client]=1;
            else if(
StrEqual(knifeName,"gut")) g_knifes[client]=2;
            else if(
StrEqual(knifeName,"flip")) g_knifes[client]=3;
            else if(
StrEqual(knifeName,"m9bayonet")) g_knifes[client]=4;
            else if(
StrEqual(knifeName,"karambit")) g_knifes[client]=5;
            
//else if(StrEqual(knifeName,"m9")) g_knifes[client]=2;
            
else if(StrEqual(knifeName,"butterfly")) g_knifes[client]=6;
            else 
g_knifes[client]=0;
        
            
PrintToChat(client"%s%t"STORE_PREFIX"Equipped item"displayName);

            return 
Store_EquipItem;
        }
    }
    
    else return 
Store_DoNothing;

  
}

public 
Action:SpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{

    new 
client_id GetEventInt(event"userid");
    new 
client GetClientOfUserId(client_id);
    
    
    if(!
IsPlayerAlive(client)) return;
    new 
iWeapon GetPlayerWeaponSlot(client2);
    
    if (
iWeapon != INVALID_ENT_REFERENCE) return;
    
    
//if (knife_choice[client] < 0 || knife_choice[client] > 9) knife_choice[client] = 0;
    //if (knife_choice[client] == 8) knife_choice[client] = 0; //Set Default Knife to 0 so default knife users bypass extra strip / equip
    
    
new iItem;
    switch(
g_knifes[client]) 
    {
        case 
0:
        {
            if(
GetClientTeam(client==3))iItem GivePlayerItem(client"weapon_knife");
            else 
iItem GivePlayerItem(client"weapon_knife_t");
        }
        case 
1:iItem GivePlayerItem(client"weapon_bayonet");
        case 
2:iItem GivePlayerItem(client"weapon_knife_gut");
        case 
3:iItem GivePlayerItem(client"weapon_knife_flip");
        case 
4:iItem GivePlayerItem(client"weapon_knife_m9_bayonet");
        case 
5:iItem GivePlayerItem(client"weapon_knife_karambit");
        case 
6:iItem GivePlayerItem(client"weapon_knife_tactical");
        case 
7:iItem GivePlayerItem(client"weapon_knife_butterfly");
        case 
8:iItem GivePlayerItem(client"weapon_knife");
        case 
9:iItem GivePlayerItem(client"weapon_knifegg");
        default: return;
    }
    if (
iItem && IsPlayerAlive(client) && iWeapon == INVALID_ENT_REFERENCEEquipPlayerWeapon(clientiItem);

i think there is a problem with the plugin that is why its not showing the category.

how i set the category:
display name:knifes
required plugin:knifes (real plugin name is store-knifes in plugins/store folder also tried to write store-knife in required plugin)
descripton:doesnt matter
web description: doesnt matter
web color: #000000

how i set the items: (example: bayonet)
name: bayonet
display name: Bayonet
type:knife
loadout slot: i tried it empty and also 2.
price: 500
category: knifes
attributes:empty
buyable: 1
tradeable: 1
refundable: 1

i dont know what's wrong i need help pls.

Last edited by Moshiko014; 07-28-2014 at 03:30.
Moshiko014 is offline
Arrow768
Veteran Member
Join Date: Nov 2011
Location: Austria
Old 07-28-2014 , 17:55   Re: [CSGO] store creating module help
Reply With Quote #2

I would like to take a look at your setup at the weekend.
Please add me on steam so we can arrage something.
__________________
Arrow768 is offline
Moshiko014
Senior Member
Join Date: Apr 2010
Old 08-01-2014 , 17:59   Re: [CSGO] store creating module help
Reply With Quote #3

4 days and i still need your help, I added you and you said your busy, when you will not be busy?
Moshiko014 is offline
Arrow768
Veteran Member
Join Date: Nov 2011
Location: Austria
Old 08-01-2014 , 20:09   Re: [CSGO] store creating module help
Reply With Quote #4

If you would have read my posts, you would have seen that I said AT THE WEEKEND.

You know, some people have got day-jobs
__________________
Arrow768 is offline
Moshiko014
Senior Member
Join Date: Apr 2010
Old 08-02-2014 , 05:54   Re: [CSGO] store creating module help
Reply With Quote #5

Quote:
Originally Posted by Arrow768 View Post
If you would have read my posts, you would have seen that I said AT THE WEEKEND.

You know, some people have got day-jobs
Okay, you told me to send you a message when you online on steam, sorry .

Last edited by Moshiko014; 08-02-2014 at 05:56.
Moshiko014 is offline
Arrow768
Veteran Member
Join Date: Nov 2011
Location: Austria
Old 08-02-2014 , 21:17   Re: [CSGO] store creating module help
Reply With Quote #6

The category is now shown.

The problem was, that a different item-type has been used in the category than it has been registered with the plugin.

When you register a item type with:
Store_RegisterItemType("ITEM-type", OnKnifeUse, OnKnifeAttributesLoad);

You have to set the Required Plugin to ITEM-type (when adding the Category)


__________________

Last edited by Arrow768; 08-02-2014 at 21:18.
Arrow768 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 23:01.


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