Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Please someone, I reall need help with this one (https://forums.graalonline.com/forums/showthread.php?t=17307)

RpgWarrior-Online 11-19-2001 01:28 AM

Please someone, I reall need help with this one
 
can anyone script a script that lets players donate money to a npc by saying donate ammount, and then only specifed accounts can take the moneys out of that npc ??
i.e. donate 5
then only 1 player account can take it out
anyone can do that for me ?? :D

Faheria_GP2 11-19-2001 03:47 AM

NPC Code:

if (playerchats) {
tokenize #c;
if (strequals(#c,Donate #t(1)) && strequals(#t(1),#v(strtofloat(#t(1))) && strtofloat(#t(1))>0 && playerrupees>=strtofloat(#t(1))) {
playerrupees-=strtofloat(#t(1));
rupees+=strtofloat(#t(1));
}
if (strequals(#c,Withdraw #t(1)) && strequals(#t(1),#v(strtofloat(#t(1))) && strtofloat(#t(1))>0 && rupees>=strtofloat(#t(1))) {
if (strequals(#a,SupersonicII)) { //Change this line to your account name
playerrupees+=strtofloat(#t(1));
rupees-=strtofloat(#t(1));
}
}
}



each part of the if statement has a purpose which i will explain
NPC Code:

strequals(#c,Donate #t(1))


This part checks to see if you said "Donate [amount]"
NPC Code:

strequals(#t(1),#v(strtofloat(#t(1)))


This part checks to see you didn't say "Donate [gibberish]"
NPC Code:

strtofloat(#t(1))>0


This part checks to see you didn't say "Donate -2100000" essentially exploiting a bug for an unlimited amount of cash
NPC Code:

playerrupees>=strtofloat(#t(1))


This part checks to see you actually have the rupees you are donating, otherwise (this might have been fixed by now) you will go to 2.1million

RpgWarrior-Online 11-20-2001 06:33 AM

thanx
 
thanx


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

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