Graal Forums

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

raiden0899 07-16-2005 12:16 PM

need help
 
im working on a money system and i'm trying to figure out how to change the value of the money variables. heres a part of the script:
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,strtofloat(client.dollars)+=1;
}
}


when i press n, it changes dollars to "strtofloat(client.dollars)+=1" instead of raising it by 1. can someone tell me what i'm doing wrong?

projectigi 07-16-2005 12:30 PM

Quote:

Originally Posted by raiden0899
im working on a money system and i'm trying to figure out how to change the value of the money variables. heres a part of the script:
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,strtofloat(client.dollars)+=1;
}
}


when i press n, it changes dollars to "strtofloat(client.dollars)+=1" instead of raising it by 1. can someone tell me what i'm doing wrong?

try
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,#v(strtofloat(#s(client.dollars))+= 1);
}
}


xAndrewx 07-16-2005 12:49 PM

Make it clientr.dollers so they can't be edited.

raiden0899 07-16-2005 12:51 PM

Quote:

Originally Posted by projectigi
try
NPC Code:

if (keypressed) {
if (strequals(#p(1),n)) {
setstring client.dollars,#v(strtofloat(#s(client.dollars))+= 1);
}
}


that sets it to 0 when i press n

Polo 07-16-2005 12:57 PM

NPC Code:
if (keypressed) {
if (strequals(#p(1),n)) {
setstring clientr.dollars,#v(strtofloat(#s(clientr.dollars)) + 1);
}
}


raiden0899 07-16-2005 01:02 PM

Quote:

Originally Posted by Polo
NPC Code:
if (keypressed) {
if (strequals(#p(1),n)) {
setstring clientr.dollars,#v(strtofloat(#s(clientr.dollars)) + 1);
}
}


thanks. i just needed to change the +=1 to +1

Velox Cruentus 07-17-2005 05:41 AM

Make the keypress trigger that code serverside so that it can edit the clientr.var

ChibiChibiLuc 07-18-2005 09:30 PM

Quote:

Originally Posted by Velox Cruentus
Make the keypress trigger that code serverside so that it can edit the clientr.var

Try not to crash the server, if you do that.

ZeroTrack 07-19-2005 04:23 AM

Quote:

Originally Posted by ChibiChibiLuc
Try not to crash the server, if you do that.

I wonder how thats gonna crash the server >_<

ChibiChibiLuc 07-19-2005 06:41 PM

KeyPressed is called every .05.
Sending triggers to the serverside that often is painful.
I found that out when I typo'd an NPC on Babylon. :[

But then again, their server's a piece of crap.


All times are GMT +2. The time now is 07:31 AM.

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