![]() |
Help! Stock Market Script!
OK I am having problems with NPC taking money from the player. Here's a script:
--- Script --- // NPC made by Androk // Stocks // Variables: // this.ANTamount - Amount of ANT stock. // this.function - Function that is happening // (0 - Nothing, 1 - stock name, 2 - amount of stock). // this.BUYamount - Temparary amount of stocks to buy. if (playerenters) { toweapons Stocks; } if (playerchats) { tokenize #c; if (strequals(#t(0),buy)) { this.BUYamount=#t(2); if (strequals(#t(1),ANT)&&playerrupees>server.ANTpric e*this.BUYamount-1) { playerrupees-=server.ANTprice*this.BUYamount; this.ANTamount+=this.BUYamount; } } } |
Re: Help! Stock Market Script!
Quote:
ex: NPC Code: Change the strequals to something else, like startswith or something. But I'm not sure. It's 12:00 and I just woke up after going to bed at 1:00. Your also gonna have to check the length of the string (strelen I think it is). |
Re: Re: Help! Stock Market Script!
Quote:
change that to setstring this.BUYamount,#t(2); |
or use strtofloat
To the guy who posted the script: Learn to use the [.Code] Tags, I can barely read it without some sort of spacing structure |
Maybe I shoudl further explain it, Strings cannot be used as variables without strtofloat();
Tokenize produces strings, not variables, so anytime you want one to be treated as a variable, you will need to use strtofloat(#t(1)). Same thing goes with any string. TDK's control NPC has this problem. |
Yeah That was the whole problem it works now... =) Thx... anyhow whats the code thing soemone was talking about?
|
HOLY it'z good...if you can buy alot it brings alot... some ppl might get lucky and buy stocks for ... 1 and sell for 2... 2 times as much! It nvere goes lower than 1...
|
| All times are GMT +2. The time now is 02:13 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.