Basic item system (nothing MUD-related though):
class: player_itemfunctions
PHP Code:
public function addItem(itemname, qty) {
// Increment quantity of the item
clientr.item.(@itemname) += qty;
}
public function takeItem(itemname, qty) {
// Decrement quantity of the item
clientr.item.(@itemname) -= qty;
// Check for non-existent quantity value
// I.e: No sense having an item with a quantity of -3
if (clientr.item.(@itemname) <= 0) {
// Destroy Item Flag
clientr.item.(@itemname) = "";
}
}
Then in your Control-NPC:
PHP Code:
function onActionPlayerOnline() {
player.join("player_itemfunctions");
}
Now in other scripts (on the serverside) you can add items like this:
player.addItem("Amazing Sword of Doom", 1);
or
findplayer("Jiroxys7").addItem("Broken Sword of Fail", 100);
Which would add/set a flag like this in your player flags:
clientr.item.Amazing Sword of Doom=1