Graal Forums

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

michael7849 10-07-2006 04:08 PM

needs help with abox ()
 
1 Attachment(s)
well i have a donation tyhing put it isnt working good i will take a screenie and show u all (here is the script) (it is a donation box)

NPC Code:
if (playerchats) {
if (startswith(/donate,#c)) {
tokenize #c;
if (tokenscount==2 && strequals(#t(0),/donate)) {
if (strtofloat(#t(1))>0 && strtofloat(#t(1))<=playerrupees) {
playerrupees -= strtofloat(#t(1));
setstring server.donation,#v(strtofloat(#s(server.donation))
+strtofloat(#t(1)));
}
else setplayerprop #c,Wrong values.;
}
}
if (strequals(#c,/take donation)) {
if (strequals(#a,#s(server.player))) {
playerrupees += strtofloat(#s(server.donation));
setstring server.donation,0;
}
}
}

if (created || timeout) {
showtext 0,x+1,y-0.5,Arial,bc,Current Donated: #s
(server.donation);
changeimgzoom 0,0.6;
changeimgvis 0,2;
timeout = 0.05;
}


Darkyoshi12345 10-07-2006 04:28 PM

First, eww, GS1.

KuJi 10-07-2006 04:43 PM

I think you need to do:
strtofloat(#s(server.donation));

Twinny 10-07-2006 04:49 PM

0.05 timeout serverside....ouchies

Heres a timeout-less method if you do wish to keep the whole script serverside.

PHP Code:

function onCreated()
{
  
this.allowed = {"Twinny","your account here"};
  
setimg("block.png");
  
update();
}

function 
onPlayerChats()
{
  if (
player.chat.starts("/donate"))
  {
    
temp.money int(player.chat.substring(8,-1));
    if (
temp.money > -1)
    {
      if (
player.rupees => temp.money)
      {
        
server.donation += temp.money;
        
player.rupees -= temp.money;
        
update();
      }
      else 
player.chat "Not Enough Money";
    }
    else 
player.chat "Perhaps an actual amount?";
  }
  
  else if (
player.chat == "/take donation")
  {
    if (
player.account in this.allowed)
    {
      
player.rupees += server.donation;
      
server.donation NULL;
      
update();
    }
    else 
player.chat "Who are you?";
  }
}

function 
update()
  
showtext(1this.1this..5"Arial""bc",
           
"Current Donation:" SPC server.donation); 


michael7849 10-08-2006 12:00 AM

thx twinny for helpin me out got a little counfused


All times are GMT +2. The time now is 05:29 PM.

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