AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   TF2Items (https://forums.alliedmods.net/forumdisplay.php?f=146)
-   -   Server crashing since a few days (https://forums.alliedmods.net/showthread.php?t=234797)

dordnung 02-04-2014 07:22

Server crashing since a few days
 
Hey,

since a few days my server is crashing when chaning attributes (Not for all attributes) and returning "Plugin_Changed". I don't get any error or something, it's just crashing.

Do somebody know something about it?

Greetz

Popoklopsi

Ra7eem 02-04-2014 07:50

Re: Server crashing since a few days
 
Your hlds bulid verson last ?

dordnung 02-04-2014 08:11

Re: Server crashing since a few days
 
Yeah, sure.

I also tested it on a friends server with the same result.

WildCard65 02-04-2014 09:35

Re: Server crashing since a few days
 
Quote:

Originally Posted by Ra7eem (Post 2095292)
Your hlds bulid verson last ?

For the record, tf2 does not use hlds, it uses srcds

dordnung 02-04-2014 11:33

Re: Server crashing since a few days
 
Ok, that is strange, i just redownloaded the extension and now there are no problems oO, but that is exactly the same version and i downloaded it a few days ago...

friagram 02-04-2014 11:33

Re: Server crashing since a few days
 
You are probably setting less attributes than you are calling setnumattributes for, check your code.
If you assign 3 attributes, but setnumattributes 4, the server will die, every time.

WildCard65 02-04-2014 11:38

Re: Server crashing since a few days
 
Quote:

Originally Posted by friagram (Post 2095356)
You are probably setting less attributes than you are calling setnumattributes for, check your code.
If you assign 3 attributes, but setnumattributes 4, the server will die, every time.

Actually, I find that a bit derpy on how it works(like you need to use setnumattributes to 1 higher then one you going to assign to(ex: 5, you use setnums 6):
(Following link is for a problem of mine, but also portrays derpyness of setnumattributes if you look at it closely): https://forums.alliedmods.net/showthread.php?t=232654

dordnung 02-04-2014 11:41

Re: Server crashing since a few days
 
No that was not the problem, but thanks. The strange think is it was all working, then it just stopped working. Maybe somehow the file got corrupted, don't know.

asherkin 02-04-2014 14:26

Re: Server crashing since a few days
 
Quote:

Originally Posted by WildCard65 (Post 2095359)
Actually, I find that a bit derpy on how it works(like you need to use setnumattributes to 1 higher then one you going to assign to(ex: 5, you use setnums 6):
(Following link is for a problem of mine, but also portrays derpyness of setnumattributes if you look at it closely): https://forums.alliedmods.net/showthread.php?t=232654

It works just like arrays.

PHP Code:

new foo[5]; 

Gives you 5 "slots" to use, numbered: 0, 1, 2, 3, and 4.

PHP Code:

TF2Items_SetNumAttributes(handle5); 

Gives you 5 "slots" to use, numbered: 0, 1, 2, 3, and 4.

I don't see what's confusing?

WildCard65 02-04-2014 14:38

Re: Server crashing since a few days
 
Idk why for some reason I found it derpy, I must've forgot that it goes from 0 to 15 and not 0 to 16(which was making me believe it's derpy)

dordnung 02-04-2014 18:23

Re: Server crashing since a few days
 
But when you set an attribute you don't have to set the number of attributes before, because the array of the attributes has anyway a size of 16.

The number is only needed after OnGiveNamedItem, so you could also check how many attributes are set, and set m_iCount to it.

So why we need to set the number of attributes explicitly?

Powerlord 02-05-2014 01:12

Re: Server crashing since a few days
 
Quote:

Originally Posted by Popoklopsi (Post 2095530)
But when you set an attribute you don't have to set the number of attributes before, because the array of the attributes has anyway a size of 16.

The number is only needed after OnGiveNamedItem, so you could also check how many attributes are set, and set m_iCount to it.

So why we need to set the number of attributes explicitly?

RAII. My understanding is that creating an array of 16 CEconItemAttribute creates 16 objects automagically... so no, you can't tell how many are actually set just by checking how many exist. (Incidentally, this wouldn't happen if it was an array of CEconItemAttribute*)

In theory, you could tell how many are set by tracking the highest index of the TF2Items_SetAttribute calls on a handle... but if TF2Items ever gains the ability to read existing attributes this will... do unexpected things.


All times are GMT -4. The time now is 21:27.

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