PDA

View Full Version : needs help with abox ()


michael7849
10-07-2006, 04:08 PM
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)

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.


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(1, this.x + 1, this.y - .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