PDA

View Full Version : Server crashing since a few days


dordnung
02-04-2014, 07:22
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
Your hlds bulid verson last ?

dordnung
02-04-2014, 08:11
Yeah, sure.

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

WildCard65
02-04-2014, 09:35
Your hlds bulid verson last ?

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

dordnung
02-04-2014, 11:33
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
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
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
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
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.

new foo[5];

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

TF2Items_SetNumAttributes(handle, 5);

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
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
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
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 (http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization). 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.