Raised This Month: $51 Target: $400
 12% 

TF2Items - Items with custom attributes.


Post New Thread Closed Thread   
 
Thread Tools Display Modes
HollowRyo
Junior Member
Join Date: Jan 2011
Location: United States
Old 01-09-2011 , 00:06   Re: TF2Items - Items with custom attributes.
#651

Quote:
Originally Posted by asherkin View Post
See the post above yours.
Didn't see that.
Well now I feel stupid,
__________________
HollowRyo is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-09-2011 , 00:41   Re: TF2Items - Items with custom attributes.
#652

Fix for the item removal bug has been released, haven't bothered updating the version number.
__________________
asherkin is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 01-09-2011 , 16:29   Re: TF2Items - Items with custom attributes.
#653

Quote:
Originally Posted by asherkin View Post
Fixed null entity bug (thanks to voogru).
voogru is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 01-09-2011 , 17:45   Re: TF2Items - Items with custom attributes.
#654

linux_lover was trying to take the credit for that...

Why did changing the 0 to 1/true fix it?
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 01-09-2011 , 18:44   Re: TF2Items - Items with custom attributes.
#655

Quote:
Originally Posted by FlaminSarge View Post
linux_lover was trying to take the credit for that...

Why did changing the 0 to 1/true fix it?
The last argument appears to force it to spawn, even if there is a conflicting weapon.
voogru is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 01-09-2011 , 20:45   Re: TF2Items - Items with custom attributes.
#656

Quote:
Originally Posted by FlaminSarge View Post
linux_lover was trying to take the credit for that...

Why did changing the 0 to 1/true fix it?
Just pointed out the problem and worked through it with voogru. I gladly forward any kudos to voogru for fixing this problem. Very annoying bug is now gone.
__________________
pheadxdll is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 01-10-2011 , 04:53   Re: TF2Items - Items with custom attributes.
#657

Code:
L 01/10/2011 - 02:08:39: [SM] Native "TF2Items_GiveNamedItem" reported: Item is NULL. File a bug report if you are sure you set all the data correctly.
when trying to create wearable item, but ... nvm
__________________
Leonardo is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-10-2011 , 04:59   Re: TF2Items - Items with custom attributes.
#658

Quote:
Originally Posted by Leonardo View Post
Code:
L 01/10/2011 - 02:08:39: [SM] Native "TF2Items_GiveNamedItem" reported: Item is NULL. File a bug report if you are sure you set all the data correctly.
when trying to create wearable item, but ... nvm
Quote:
Item is NULL. File a bug report if you are sure you set all the data correctly.
Code?
__________________
asherkin is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 01-10-2011 , 05:15   Re: TF2Items - Items with custom attributes.
#659

PHP Code:
new iDefIndex KvGetNum(g_hKeyValues"DefIndex");
new 
String:sWeaponClass[128];
KvGetString(g_hKeyValues"wepclass"sWeaponClasssizeof(sWeaponClass));
new 
iLevel KvGetNum(g_hKeyValues"level"1);
new 
iQuality KvGetNum(g_hKeyValues"quality"0);
new 
iSlot KvGetNum(g_hKeyValues"slot"0);
new 
iAttrs KvGetNum(g_hKeyValues"acount"0);

if(
StrContains(sWeaponClass"tf_weapon"false)!=-1)
{
    new 
iOldWeapon = -1;
    while((
iOldWeapon GetPlayerWeaponSlot(iClientiSlot)) != -1)
    {
        
RemovePlayerItem(iClientiOldWeapon);
        
RemoveEdict(iOldWeapon);
    }
}

new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL);
TF2Items_SetClassname(hWeaponsWeaponClass);
TF2Items_SetItemIndex(hWeaponiDefIndex);
TF2Items_SetLevel(hWeaponiLevel);
TF2Items_SetQuality(hWeaponiQuality);
if(
iAttrs>&& iAttrs<=16)
{
    
decl String:sAttrName[16];
    
TF2Items_SetNumAttributes(hWeaponiAttrs);
    for(new 
i=0i<iAttrsi++)
    {
        
Format(sAttrNamesizeof(sAttrName), "attrib%i"i);
        
KvGetString(g_hKeyValuessAttrNamesBuffersizeof(sBuffer));
        if(
ExplodeString(sBuffer"|"sBufferssizeof(sBuffers), sizeof(sBuffers[]))==2)
            
TF2Items_SetAttribute(hWeaponiStringToInt(sBuffers[0]), StringToFloat(sBuffers[1]));
    }
}
else
    
TF2Items_SetNumAttributes(hWeapon0);

new 
iNewWeapon TF2Items_GiveNamedItem(iClienthWeapon);
CloseHandle(hWeapon); 
Code:
"30"
{
	"wepclass"		"tf_wearable_item"
	"DefIndex"		"250"
	"level"		"25"
	"quality"		"6"
	"slot"		"3"
	"acount"		"0"
}
__________________

Last edited by Leonardo; 01-10-2011 at 05:27. Reason: removed unnecessary stuff
Leonardo is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 01-10-2011 , 12:42   Re: TF2Items - Items with custom attributes.
#660

Quote:
Originally Posted by Leonardo View Post
PHP Code:
new iDefIndex KvGetNum(g_hKeyValues"DefIndex");
new 
String:sWeaponClass[128];
KvGetString(g_hKeyValues"wepclass"sWeaponClasssizeof(sWeaponClass));
new 
iLevel KvGetNum(g_hKeyValues"level"1);
new 
iQuality KvGetNum(g_hKeyValues"quality"0);
new 
iSlot KvGetNum(g_hKeyValues"slot"0);
new 
iAttrs KvGetNum(g_hKeyValues"acount"0);
 
if(
StrContains(sWeaponClass"tf_weapon"false)!=-1)
{
    new 
iOldWeapon = -1;
    while((
iOldWeapon GetPlayerWeaponSlot(iClientiSlot)) != -1)
    {
        
RemovePlayerItem(iClientiOldWeapon);
        
RemoveEdict(iOldWeapon);
    }
}
 
new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL);
TF2Items_SetClassname(hWeaponsWeaponClass);
TF2Items_SetItemIndex(hWeaponiDefIndex);
TF2Items_SetLevel(hWeaponiLevel);
TF2Items_SetQuality(hWeaponiQuality);
if(
iAttrs>&& iAttrs<=16)
{
    
decl String:sAttrName[16];
    
TF2Items_SetNumAttributes(hWeaponiAttrs);
    for(new 
i=0i<iAttrsi++)
    {
        
Format(sAttrNamesizeof(sAttrName), "attrib%i"i);
        
KvGetString(g_hKeyValuessAttrNamesBuffersizeof(sBuffer));
        if(
ExplodeString(sBuffer"|"sBufferssizeof(sBuffers), sizeof(sBuffers[]))==2)
            
TF2Items_SetAttribute(hWeaponiStringToInt(sBuffers[0]), StringToFloat(sBuffers[1]));
    }
}
else
    
TF2Items_SetNumAttributes(hWeapon0);
 
new 
iNewWeapon TF2Items_GiveNamedItem(iClienthWeapon);
CloseHandle(hWeapon); 
Code:
"30"
{
    "wepclass"        "tf_wearable_item"
    "DefIndex"        "250"
    "level"        "25"
    "quality"        "6"
    "slot"        "3"
    "acount"        "0"
}
You should not be creating a valve hat anyway.
voogru is offline
Closed Thread



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:48.


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