Farming Script

WHAT’S WRONG WITH THIS SCRIPT?
I’VE SPENT 1 HOUR TRYING TO FIX MY FARM SCRIPT BUT IT DOESN’T WORK :frowning:
PLEASE HELP ME SOMEONE, PLEASE!
(problem is that the gralats don’t add up to the player when he sells the plants)

Plant Script:
// NPC made by Ace
if (playerenters) {
timereverywhere;
timeout=10;
}
if (playertouchsme) {
freezeplayer 1;
setani grab,;
setstring client.leafs,#v(strtofloat(#s(client.leafs))+1);
setplayerprop #c,Plant Count: #s(client.leafs);
hide;
timereverywhere;
timeout=10;
}
if (timeout) {
show;
}

Plant Buyer Script:
// Graal2002 NPC by Stefan Knorr
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head9.png;
setcharprop #C0,orange;
setcharprop #C1,black;
setcharprop #C2,yellow;
setcharprop #C3,yellow;
setcharprop #C4,black;
setcharprop #n,Capone;
setcharprop #2,no-shield.png;
shieldpower = 1;
dir = 2;
x-=0.5;
setcharani sit,;
}
if (playertouchsme) {
playerrupees += client.leafs,#v(strtofloat(#s(client.leafs)));
setplayerprop #c,Plants Sold: #s(client.leafs);
setstring client.leafs,0;
}

CAPS LOCK QUESTION MARK

Because, I’m filled with frustration as I keep working hard to solve the error (if there’s one) and it won’t work agh D:

I’d help if I knew anything about scripting.

Help someone, please!

This is what’s wrong.

Your (*edit) hint on how to solve it is you can only add and subtract numbers with numbers

playerrupees += number;

client.leafs isn’t a number, it’s a string.
Likewise… #v(client.leafs) is also a string.

why would you need to strtofloat something that’s going to be a whole number? you can’t have 1.5 leaves.

strtofloat() converts a string to a number as the function name suggests. You’re thinking of int()

Yea I found out :stuck_out_tongue: and I made it a shop that u can sell to with the gui tht u made! the server now has complete farming and 3 quests :smiley: and insides to some buildings we r also 4x4 bmap now

Is that furia?

Farming? You mean drug handling xDD

That’s pretty much what I thought.


Make it smoke-able.

LOL, yea weed farm but I’ll be adding more plants and different breeds some that pay out more and some that give exp and I could make them smokable if tricxta helps me :o!

Well a float is a number that doesn’t have to be a whole number. Graal is stupid.

This server kinda reminds me of Enigma in a way, but on Enigma you leveled by staying logged in pretty much :p! Could go for an old-maloria feeling if you wanted and make exp gainable by any action you do :o Quests, killing standard baddies, gaining items ect c: But that’s only a suggestion. I like it though, which is odd o.O

should of called it strtoint and strtofloat, would of been betterz. or just strtonum :c