I am making a beer barrel where when you grab it 10 times you get a beer, then u can give it to a man for cash. So when the grab count reaches 0 it should but a beer in front of you to give to the man, but when it reaches 0 it goes to -1, then back to 9 with out doing any of the clientside functions which is laying the beer...
here is the script me and Takap2p made:
PHP Code:
//NPC By theHAWKER & Taka
function onCreated(){
this.grabs = 10;
setTimer(.05);
}
function onTimeout(){
if (this.grabs < 1){
sleep 1;
onCreated();
}
setTimer(0.05);
}
function onActiongrabbed() {
this.grabs -= 1;
player.chat = @ this.grabs @ " grabs left..";
}
//#CLIENTSIDE
function onActiongrabbed() {
player.ani = pull,;
}
function onTimeout(){
if (this.grabs == 0){
say2("I Made A Beer!");
putnpc(1,beer,"beer.png",49.3,20);
setTimer(0.05);
}
}