Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-07-2006, 04:08 PM
michael7849 michael7849 is offline
Playerworld21 Manager
Join Date: Aug 2006
Posts: 81
michael7849 is an unknown quantity at this point
needs help with abox ()

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;
}

Attached Images
File Type: bmp serverpic.bmp (818.8 KB, 140 views)

Last edited by michael7849; 10-07-2006 at 04:15 PM.. Reason: juat felt liek it
Reply With Quote
  #2  
Old 10-07-2006, 04:28 PM
Darkyoshi12345 Darkyoshi12345 is offline
Darky
Join Date: Jun 2006
Posts: 153
Darkyoshi12345 is on a distinguished road
First, eww, GS1.
Reply With Quote
  #3  
Old 10-07-2006, 04:43 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
I think you need to do:
strtofloat(#s(server.donation));
Reply With Quote
  #4  
Old 10-07-2006, 04:49 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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); 

Last edited by Twinny; 10-07-2006 at 05:00 PM..
Reply With Quote
  #5  
Old 10-08-2006, 12:00 AM
michael7849 michael7849 is offline
Playerworld21 Manager
Join Date: Aug 2006
Posts: 81
michael7849 is an unknown quantity at this point
thx twinny for helpin me out got a little counfused
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:02 AM.


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