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

[TF2Items] Give Weapon (v3.14159, 11/29/2013)


Post New Thread Reply   
 
Thread Tools Display Modes
HeadphoneSiki
New Member
Join Date: Aug 2017
Old 08-15-2018 , 01:09   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1641

Quote:
Originally Posted by Facksy View Post
L 10/23/2017 - 23:46:43: [SM] Exception reported: Invalid Handle 0 (error 4)
L 10/23/2017 - 23:46:43: [SM] Blaming: tf2items_giveweapon.smx
L 10/23/2017 - 23:46:43: [SM] Call stack trace:
L 10/23/2017 - 23:46:43: [SM] [0] GetTrieValue
L 10/23/2017 - 23:46:43: [SM] [1] Line 5063, C:\hlserver\tf2\tf\addons\sourcem
od\scripting\tf2items_giveweapon.sp::Native_C reateWeapon
L 10/23/2017 - 23:46:43: [SM] [3] TF2Items_CreateWeapon

I get this error when i wanna create a weapon with TF2Items_CreateWeapon
I solved this problem like this:
Code:
public void OnLibraryAdded(const char[] name)
{
	if(StrEqual(name, "tf2items_giveweapon"))
	{
		TF2Items_CreateWeapon(yatatata);
	}
}
I think the problem is the handle changed too fast, so I delayed it after it properly loaded.
HeadphoneSiki is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 08-18-2018 , 22:02   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1642

Quote:
Originally Posted by HeadphoneSiki View Post
I solved this problem like this:
Code:
public void OnLibraryAdded(const char[] name)
{
	if(StrEqual(name, "tf2items_giveweapon"))
	{
		TF2Items_CreateWeapon(yatatata);
	}
}
I think the problem is the handle changed too fast, so I delayed it after it properly loaded.
Definitely only call any of the natives once the library is available. On plugin start, use LibraryExists("tf2items_giveweapon") to see if it's loaded before the current plugin loaded. Keep the OnLibraryAdded check. LibraryExists is a very expensive call, so don't use it repeatedly, only once.
__________________
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
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 10-02-2018 , 11:17   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1643

Using TF2IDB Adapter giveweapon throws error:
Code:
[SM] Exception reported: [TF2Items] Invalid Weapon Index (1101)
[SM] Blaming: tf2items_giveweapon.smx
This error doesn't appear with TF2ItemsInfo from this post.

P.S. SQLite DataBase is updated and 1101 exists inside it.

EDIT: Maybe this error appears due to tf2items_use_tf2ii 0
__________________

Last edited by MAGNAT2645; 10-12-2018 at 09:29.
MAGNAT2645 is offline
Whai
Senior Member
Join Date: Jul 2018
Old 10-24-2018 , 16:34   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1644

Hello, I ported the "tf2items_giveweapon.inc" into new synthax.
Can someone verify that and say if there are errors ?
Attached Files
File Type: inc tf2items_giveweapon(new synthax).inc (2.9 KB, 137 views)
__________________

Last edited by Whai; 10-24-2018 at 16:34.
Whai is offline
BlazingDiancie
Member
Join Date: Sep 2014
Old 10-25-2018 , 08:23   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1645

Quote:
Originally Posted by Whai View Post
Hello, I ported the "tf2items_giveweapon.inc" into new synthax.
Can someone verify that and say if there are errors ?
What's this meant to do?
BlazingDiancie is offline
Whai
Senior Member
Join Date: Jul 2018
Old 10-25-2018 , 11:38   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1646

Quote:
Originally Posted by BlazingDiancie View Post
What's this meant to do?
If there is a plugin that use new api synthax and need the tf2items_giveweapon.inc, he can't compile because the .inc file use old api synthax.
__________________
Whai is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-25-2018 , 11:50   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1647

Quote:
Originally Posted by Whai View Post
If there is a plugin that use new api synthax and need the tf2items_giveweapon.inc, he can't compile because the .inc file use old api synthax.
The newdecls required pragma should always be set after including 3rd party includes.
__________________
asherkin is offline
Whai
Senior Member
Join Date: Jul 2018
Old 10-25-2018 , 11:55   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1648

Quote:
Originally Posted by asherkin View Post
The newdecls required pragma should always be set after including 3rd party includes.
Ah... I always put #pragma semicolon 1 and #pragma newdecls required at lines 1 and 2...

So that means if I include first "tf2items_giveweapon.inc" then add "#pragma newdecls required", it will not check if tf2items_giveweapon.inc have new synthax ?
__________________
Whai is offline
BlazingDiancie
Member
Join Date: Sep 2014
Old 10-25-2018 , 15:16   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1649

Demoshields are still broken with both this mod and Custom Weapons 3. Also a TON of base weapons return "Invalid Weapon Index" when you try to give them to yourself, but for some reason, if you set them as a custom weapon, they work perfectly. What is going on here? And before you ask, I am using TF2IDB with an updated database.
BlazingDiancie is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 10-25-2018 , 21:26   Re: [TF2Items] Give Weapon (v3.14159, 11/29/2013)
Reply With Quote #1650

Quote:
Originally Posted by Whai View Post
Ah... I always put #pragma semicolon 1 and #pragma newdecls required at lines 1 and 2...

So that means if I include first "tf2items_giveweapon.inc" then add "#pragma newdecls required", it will not check if tf2items_giveweapon.inc have new synthax ?
Correct.
__________________
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
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 14:58.


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