Quote:
Originally Posted by Gunderak
could you show me an example of it as a trigger so i can study it and figure out exactly how itd work?
|
Well actually, if you're going to do it entirely by chat it would be better to just have the entire thing serverside rather than use a trigger, the main reason you'd want it clientside is to have something like a GUI prompt.
Otherwise the most basic thing to do would be:
PHP Code:
function onCreated(){
//define area inwhich to receive the triggeraction
this.setshape(1, 32, 32);
this.dontblock();
}
function onActionPurchase(){
if (player.rupees >= 1000){
//ensure you have not already purchased the hat
if(player.findweapon("Hats/Dino Hat") == NULL){
player.addweapon("Hats/Dino Hat");
player.rupees -= 1000;
}
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat == "/Buy Gund Dino Hat"){
if (player.rupees >= 1000){
//ensure you have not already purchased the hat
if(findweapon("Hats/Dino Hat") == NULL){
triggeraction(this.x + 1, this.y + 1, "Purchase", NULL);
}
}
}
}
The conditions being serverside is important for the sake of security but I personally have it clientside too for the sake of preventing un-necessary triggers.