Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help on A Script (https://forums.graalonline.com/forums/showthread.php?t=12696)

SSRobgeta 09-23-2001 11:17 PM

Help on A Script
 
Ok this script is used to sell Lumber that you have. But when I say sell lumber it gives you your money, but if you say it again it takes money?!?! Can Someone heklp who understands String and var more than me?

// Created By Rob Getashu
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head0.gif;
setcharprop #C0,orange;
setcharprop #C1,white;
setcharprop #C2,blue;
setcharprop #C3,red;
setcharprop #C4,black;
setcharprop #2,shield1.gif;
shieldpower = 1;
dir = 2;
}
if (playerchats&&strequals(#c,sell lumber)) {
lumber = strtofloat(#s(lumber));
playerrupees = lumber;
setstring lumber,#v(lumber);

lumber = strtofloat(#s(lumber))=0;
setstring lumber,#v(lumber);
setstring client.lumber,#s(lumber);
setstring server.gavelumber,#v(strtofloat(#s(server.gavelumb er))=0);

}

AlexH 09-23-2001 11:20 PM

well your problem is where is says playerruppes = lumber
that means say you have 10 lumber
you say it you get 10g and no more lumber
so you say it again when you have no lumber your gralat will = 0 because that was the lumber number
try using playerrupees = playerrupees+lumber

SSRobgeta 09-23-2001 11:26 PM

Ok thx let me try that

Xaviar 09-23-2001 11:34 PM

Ugh...or dont be so nasty about it and use playerrupees += lumber;

LiquidIce00 09-23-2001 11:37 PM

if (playerchats&&strequals(#c,sell lumber)) {
this.lumber = strtofloat(#s(client.lumber));
playerrupees+=this.lumber;
setstring client.lumber,;
setstring server.gavelumber,#v(this.lumber);
setplayerprop #c,You sold #v(this.lumber) logs;
}
like that? (i added a setplayer .. u can take that out.. the other part wasnt needed .. u can take out the server.gavelumber. keep it if ur recording how much the last player sold last)


All times are GMT +2. The time now is 06:09 AM.

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