Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   A little help plz (https://forums.graalonline.com/forums/showthread.php?t=32129)

Legondary_MyTH 06-23-2002 04:29 AM

A little help plz
 
I have a bar script so when you buy the beer it takes 5 rupees and puts it in a NPC so the owner of the bar can get it when he/she touches it. the problem is when you press enter it drops money everytime .the script works its just the money that keeps coming out. here is the sript plz help.

// NPC made by MyTH
if (playerenters){hidelocal; dontblock;}
if (playerchats&&strequals(#c,beer 1)&& playerrupees>=5) {playerrupees = playerrupees-5;
move -2,0,2,0;show;blockagain;}
if (playertouchsme) putleaps 5,playerx,playery;playerhearts +=2;
if (playertouchsme) hide;lay2 bluerupee,32,25;

Torankusu 06-25-2002 11:19 AM

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.

Legondary_MyTH 06-25-2002 11:39 AM

Thanks!
 
Yea thanks alot it works fine!

Torankusu 06-25-2002 11:42 AM

learn off of it. Those commands can come in handy.

Oh yeah.

(#e(8,-1,#c) --- In that, -1 means go all the way to the end of the player's chat text.

Legondary_MyTH 06-25-2002 11:49 AM

Crap
 
I didnt check the top 1 i just added the beer the top one doesnt work for me i ut my account and changed the guild to Police cause that was my nick and i am to lazy for setplayerprop #n,Name;}

????????????????????!!!!!!!!!!!!!!!

Torankusu 06-25-2002 12:33 PM

Re: Crap
 
Quote:

Originally posted by Legondary_MyTH
I didnt check the top 1 i just added the beer the top one doesnt work for me i ut my account and changed the guild to Police cause that was my nick and i am to lazy for setplayerprop #n,Name;}

????????????????????!!!!!!!!!!!!!!!

?

The top one works.

Saga2001 06-25-2002 12:48 PM

Quote:

Originally posted by Torankusu
learn off of it. Those commands can come in handy.

Oh yeah.

(#e(8,-1,#c) --- In that, -1 means go all the way to the end of the player's chat text.

*proud of his artistry of teaching this boy to be a man and use the #e() string manipulator*

Torankusu 06-25-2002 12:52 PM

Quote:

Originally posted by Saga2001


*proud of his artistry of teaching this boy to be a man and use the #e() string manipulator*

Thanks. ;)

Legondary_MyTH 06-26-2002 06:45 AM

hrm
 
Doesnt work for me i put it in the man behind the bar you have to have the Bar tender tag to get to him and i said collect #

Torankusu 06-26-2002 07:16 AM

Contact me over AIM or post the level.
shady visions

That's weird.

Legondary_MyTH 06-26-2002 11:39 AM

*dies*
 
AHHHHHHHH ok now the beer when you say beer 1 it slides to you right? well i touch it it goes away like supposed to.I say beer 1 again and it slides from where it ended the last time and it keeps going father everytime you say beer 1!!!!*pulls hair out*


All times are GMT +2. The time now is 08:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.