PHP Code:
function onCreated() {
this.items = {{"Juggling", 30, "*Prizes/Juggle"}, {"PK Heal", 30, "*Prizes/PK Heal"}, {"Jump", 30, "*Prizes/Jump"}, {"Light Mouse", 150, "*Prizes/Light Mouse"}};
}
function onPlayerChats() {
if (player.chat.starts("buy")) {
temp.item = player.chat.substring(4);
for (temp.var : this.items) {
if (temp.item == temp.var[0]) {
temp.iteminfo = temp.var;
break;
}
}
if (temp.iteminfo != NULL) {
if (clientr.etcoins >= temp.iteminfo[1]) {
clientr.etcoins -= temp.iteminfo[1];
addWeapon(temp.iteminfo[2]);
player.chat = format("You bought %s for %d event coins!", temp.iteminfo[0], temp.iteminfo[1]);
}
else player.chat = format("You require %d event coins for this item!", temp.iteminfo[1]);
}
}
}
or the:
{
}
format
PHP Code:
function onCreated()
{
this.items = {{"Juggling", 30, "*Prizes/Juggle"}, {"PK Heal", 30, "*Prizes/PK Heal"}, {"Jump", 30, "*Prizes/Jump"}, {"Light Mouse", 150, "*Prizes/Light Mouse"}};
}
function onPlayerChats()
{
if (player.chat.starts("buy"))
{
temp.item = player.chat.substring(4);
for (temp.var : this.items)
{
if (temp.item == temp.var[0])
{
temp.iteminfo = temp.var;
break;
}
}
if (temp.iteminfo != NULL)
{
if (clientr.etcoins >= temp.iteminfo[1])
{
clientr.etcoins -= temp.iteminfo[1];
addWeapon(temp.iteminfo[2]);
player.chat = format("You bought %s for %d event coins!", temp.iteminfo[0], temp.iteminfo[1]);
}
else
{
player.chat = format("You require %d event coins for this item!", temp.iteminfo[1]);
}
}
}
}