Making an item system, I have a function that looks like this:
PHP Code:
public function addItem(itemid, quantity) {
// code here
temp.callstack = getcallstack();
echo("C:" SPC callstack[callstack.size() - 2].scriptcallobject SPC callstack.size());
// code here
}
The problem I'm having is that the callstack does not have an object for scripts that call it outside of a function block. For example, a weapon below:
PHP Code:
findPlayer("cbk1994").addItem(100, 1);
Echos "C: 1" meaning that there is only one entry, which is the current object/function.
However, if this is used, it works perfectly:
PHP Code:
function onCreated() {
findPlayer("cbk1994").addItem(100, 1);
}
Echoes "C: -Guns 2" (-Guns being the name of the weapon)
This is, of course, serverside. It would be great if this could be fixed ASAP, or if someone knows a solution.
Thanks.