Raised This Month: $32 Target: $400
 8% 

Hats plugin - How to disabled hat skin for model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 12-31-2017 , 13:21   Hats plugin - How to disabled hat skin for model
Reply With Quote #1

Hello,

I'm trying to add a new feature, but I do not know where is the problem.

Here is the main plugin:
https://forums.alliedmods.net/showthread.php?t=275306
https://github.com/Franc1sco/Franug-...franug_hats.sp

Schema in .txt
PHP Code:
"Hats"
{
    
"Santa Hat"
    
{
        
"model"        "models/player/holiday/santahat.mdl"
        "position"        "-0.500000 -2.000000 5.000000"
        "angles"        "0.000000 -0.500000 0.000000"
        "playermodels"
        
{
            
"models&player&custom_player&legacy&tm_leet_variantA.mdl"
            
{
                
"position"        "-2.500000 -6.000000 -0.500000"
                "angles"        "1.000000 18.500000 15.000000"
                "disabled"        "1" 
//Here I'm trying to get a new feature (disable hat skin for this model)
            
}
            
"models&player&custom_player&legacy&tm_phoenix.mdl"
            
{
                
"position"        "-2.000000 -6.000000 -1.500000"
                "angles"        "0.500000 18.500000 15.000000"
                "disabled"        "0" 
//Here I'm trying to get a new feature (disable hat skin for this model)
            
}
        }
    }

I have modified the .sp
PHP Code:
enum Hat2
{
    
String:Name[64],
    
String:szAttachment[64],
    
Float:fPosition[3],
    
Float:fAngles[3],
    
bool:bDisabled // Here's a new feature
}

public 
void LoadHats()
{
    ...
    if(
KvJumpToKey(kv"playermodels"))
            {
                
g_mHats[g_hats] = CreateArray(134);
                
                if(
KvGotoFirstSubKey(kv))
                {
                    do
                    {
                        
KvGetSectionName(kvg_array[Name], 64);
                        
ReplaceString(g_array[Name], 64"&""/");
                        
KvGetVector(kv"position"m_fTemp);
                        
g_array[fPosition] = m_fTemp;
                        
KvGetVector(kv"angles"m_fTemp);
                        
g_array[fAngles] = m_fTemp;
                        
KvGetString(kv"attachment"g_array[szAttachment], 64"facemask");
                        
                        
g_array[bDisabled] = (KvGetNum(kv"disabled"0)?true:false); // Here's a new feature (This works and recognizes it change).

                        
if(g_array[bDisabled] == false)
                        {
                            
PrintToServer("Disabled - 0");
                        }
                        else if(
g_array[bDisabled] == true)
                        {
                            
PrintToServer("Disabled - 1");
                        }

                        
PushArrayArray(g_mHats[g_hats], g_array[0]);
                
                
                    }while (
KvGotoNextKey(kv));
                }
                
KvGoBack(kv);
                
KvGoBack(kv);
            }
    ...
}

void CreateHat(int client)
{
    ...

    
//Here I get constant number 0. Where is the problem?
    
if(g_eHats[g_Elegido[client]][bDisabled] == false)
    {
        
PrintToServer("Disabled - 0");
    }
    else if(
g_eHats[g_Elegido[client]][bDisabled] == true)
    {
        
PrintToServer("Disabled - 1");
    }

    ...

Thanks for help and answer.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!

Last edited by Fastmancz; 12-31-2017 at 13:28.
Fastmancz is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 12-31-2017 , 16:07   Re: Hats plugin - How to disabled hat skin for model
Reply With Quote #2

Where is g_Elegido[client]][bDisabled]set or reset?
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...

Last edited by Totenfluch; 12-31-2017 at 16:08.
Totenfluch is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 12-31-2017 , 16:56   Re: Hats plugin - How to disabled hat skin for model
Reply With Quote #3

Thanks for answer.

bDisabled is new function - You can find in Schema in .txt -

PHP Code:
"disabled"        "1" //Here I'm trying to get a new feature (disable hat skin for this model) 
There are different models and some bools have at 0 and some at 1. But it does not recognize in the void CreateHat (int client). I constantly getting 0 from void CreateHat (int client). I'm probably have wrong the condition, but I do not know where is the problem.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!

Last edited by Fastmancz; 12-31-2017 at 17:08.
Fastmancz is offline
Totenfluch
AlliedModders Donor
Join Date: Jan 2012
Location: Germany
Old 12-31-2017 , 22:08   Re: Hats plugin - How to disabled hat skin for model
Reply With Quote #4

The bDisabled is not stored in g_eHats it is stored in g_mHats.

You have to insert the code in here:
https://github.com/Franc1sco/Franug-...g_hats.sp#L427

the Variable you are looking to check is : Items with the dereference on bDisabled -> Items[bDisabled]

(That's where the model is checked)

It wasn't that easy to find Thanks to SpanishPawn ;)
__________________
Notable Projects:
Event Item Spawner | Scissors, Rock, Paper for ZephStore
tVip | Smart Link Remover
PLG & GGC - CS:GO Roleplay

and countless more...

I can make a helicopter shoot missles if you want me to...

Last edited by Totenfluch; 12-31-2017 at 22:54.
Totenfluch is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 01-01-2018 , 05:33   Re: Hats plugin - How to disabled hat skin for model
Reply With Quote #5

Thanks for answer. I still do not. I still get 0.

PHP Code:
for(int i=0;i<GetArraySize(g_mHats[g_Elegido[client]]);++i)
        {
            
GetArrayArray(g_mHats[g_Elegido[client]], iItems[0]);
            if(
StrEqual(Items[Name], buscado))
            {
                if(
Items[bDisabled] == false)
                {
                    
PrintToServer("Disabled - 0");
                }
                else if(
Items[bDisabled] == true)
                {
                    
PrintToServer("Disabled - 1");
                }
                
m_fHatAngles[0] += Items[fAngles][0];
                
m_fHatAngles[1] += Items[fAngles][1];
                
m_fHatAngles[2] += Items[fAngles][2];

    
                
m_fOffset[0] = Items[fPosition][0];
                
m_fOffset[1] = Items[fPosition][1];
                
m_fOffset[2] = Items[fPosition][2];

                
PrintToServer("-> %f"m_fHatAngles[0]);

                
found true;
                
                break;
            }
        }
    
    } 
I really do not know where the problem might be.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz is offline
Reply


Thread Tools
Display Modes

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 22:18.


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