This might help.
NPC Code:
//Get the bar money, etc.
if (playerchats) {
allow=false;
{
if (strequals(#a,Account) || strequals(#g,Bar Tender)) allow=true; //Allows this guild/account to withdraw the money.
barmoney=strtofloat(#s(this.barmoney));
}
if (strequals(#c,show money)) setcharprop #c,The bar has collected #v(barmoney) rupees.;
if (startswith(collect,#c)) { //Checks player's text to see if it starts with "collect."
if (allow==false) setcharprop #c,You can't collect any money.; //Self Explainatory.
else {
total=strtofloat(#e(8,-1,#c)); //#e = carries the eight characters (collect,) , -1, I forget, #c, withdraws the character's # amount.
if (total>0&&total<=barmoney) {
barmoney-=total; //Subtracts the money from the bar total.
playerrupees+=total; //Adds the money to the bar total.
setcharprop #c, } else { //If the bar doesn't have that much money--
if (total<0) setcharprop #c,You must say a number greater then 0!;
else setcharprop #c,The bar doesn't have that much money!;
}
}
}
setstring this.barmoney,#v(barmoney);
}
And... I'd do this with the beer...
NPC Code:
//NPC made by Torankusu
if (playerenters) {
hide;}
if (playerchats && strequals(#c,buy beer 1)) {
playerrupees-=5;
setstring this.barmoney,#v(strtofloat(#s(this.barmoney))+5); //Adds to the bar money.
show;}
if (playertouchsme) {
playerhearts+=2;
putleaps 5,playerx,playery;
hide;
}
I suggest you put the bar collect stuff in a separate NPC.