Here you call the function 'randombox' on the list and pass the weapon (with the same index as the box) via the first parameter:
Your loop ran out of weapons therefore the variable 'weap' is now undefined (no entity) which results in a script runtime error.PHP Code:
for(i=0;i<randomboxes.size;i++) randomboxes[i] thread randombox(randomweaps[i]);
You can do one of these options:
- Make sure both lists are the same size.
- Check randomweaps's size before calling the 'randombox' function.