|
Member
|

07-25-2012
, 16:40
Re: Box System
|
#12
|
My linux server freezes when the plugin tries to save the .vdf file. Plugin successfully creates the file but doesn't write anything and freezes (no error in the amxx error file, no error in the hlds debug file). I figured out that the last call before freeze is vdf_save(tree); in storage.inl so I thought that there might be problem with the VDF module but I don't experience this kind of problems with other plugins that call this function...
Edit1 (Debugging my error): I have edited the plugin to save dummy results and they save without freezing the server so it is an plugin issue.
Edit2 (Debugging my error): Got it! The BOX_Save() function saves one empty record! See comments in the storage.inl's BOX_Save() functions' code.
PHP Code:
BOX_Save() { new VdfTree:tree = vdf_create_tree(gszConfigDirPerMap); new VdfNode:root; new VdfNode:box; new VdfNode:vector; new szValue[32]; new Float:fOrigin[3]; root = vdf_get_root_node(tree); vdf_set_node_key(root , "Box"); for(new i=0; i< giZonesP; i++) { new ent = giZones[i]; /* pev(ent, PEV_TYPE, szValue, 31);
So, what happend there? The first zone is always empty, so the origins and other floats would be OK but the pev_netname (PEV_TYPE) sets szValue to "".
box = vdf_append_child_node(tree, root, szValue); And vdf_append_child_node fails to create node named "", szValue is not a value this time, so it is a problem. */
pev(ent, PEV_TYPE, szValue, 31); box = vdf_append_child_node(tree, root, szValue[0] ? szValue : "empty"); // My hotfix vector = vdf_append_child_node(tree, box, "origin"); pev(ent, pev_origin, fOrigin); formatex(szValue, 31, "%.1f", fOrigin[0]), vdf_append_child_node(tree, vector, "X", szValue); formatex(szValue, 31, "%.1f", fOrigin[1]), vdf_append_child_node(tree, vector, "Y", szValue); formatex(szValue, 31, "%.1f", fOrigin[2]), vdf_append_child_node(tree, vector, "Z", szValue); pev(ent, pev_mins, fOrigin); vector = vdf_append_child_node(tree, box, "mins"); formatex(szValue, 31, "%.1f", fOrigin[0]), vdf_append_child_node(tree, vector, "X", szValue); formatex(szValue, 31, "%.1f", fOrigin[1]), vdf_append_child_node(tree, vector, "Y", szValue); formatex(szValue, 31, "%.1f", fOrigin[2]), vdf_append_child_node(tree, vector, "Z", szValue); pev(ent, pev_maxs, fOrigin); vector = vdf_append_child_node(tree, box, "maxs"); formatex(szValue, 31, "%.1f", fOrigin[0]), vdf_append_child_node(tree, vector, "X", szValue); formatex(szValue, 31, "%.1f", fOrigin[1]), vdf_append_child_node(tree, vector, "Y", szValue); formatex(szValue, 31, "%.1f", fOrigin[2]), vdf_append_child_node(tree, vector, "Z", szValue); }
vdf_save(tree); }
Edit3 (Features): It would be awesome (well, more awesome) if it was possible to make the box visible – glow for example.
Last edited by Astro; 07-25-2012 at 19:02.
Reason: Typo
|
|