Money System/RPG Basis

Platform:  mIRC
Published  Mar 17, 2010
Updated  Mar 17, 2010
Okay so I got a request to make a simple money system, and when I made it, I realized it was pretty cool and I decided to add some features, and It turned into a pretty well working Money System. It's also a great start for those making an RPG game! I usually don't like sharing my scripts, but after getting request after request, I decided to post it on Hawkee. Enjoy!

Commands:

&give: Only one person can use this command, this generates any amount of money, and gives it to any person. (Syntax: &give (user) (amount))

&take: Only one person can use this command; this takes away money from either a users carrying money, or his/her personal safe (if the user has one). (Syntax: &take (stash OR carry) (user) (amount))

!give: Can be used by all users; it transfers money from your account to another players. (Syntax: !give money (user) (amount))

!mug: Attempt to mug a user for between 1 to 50 dollars. Sometimes you will succeed, other times you will be caught and be charged a 500 dollar fine. (Syntax: !mug (user))

!properties: View all available properties for purchase (only one is available at the moment)

!stash: Only works if you have a property; it stashes money into your property's private safe. (Syntax: !stash money (amount)

!withdraw: Takes money out of your personal safe. (Syntax: !withdraw money (amount))

!stats: Views the current account balance of a user, what property they have (if any) And how much money is stored into their personal safe (Only is disaplyed if there is money in the safe). (Syntax: !stats (user))

NOTE: To set what person can use &give, goto line 41 of the script and put your name where it says "NameHere"
NOTE: To set what person can use &take, goto line 50 of the script and put your name where it says "NameHere"

Please report any problems/bugs!!!!


on *:TEXT:!partyover*:#: {
if (%party [ $+ [ $nick ] ] == on) {
msg # $nick $+ 's party is now over...
set %party [ $+ [ $nick ] ] $null
set %invite [ $+ [ $nick ] ] $null
}
else { msg $nick You aren't throwing a party! }
}
on *:TEXT:!give*:#: {
if ($2 == money) {
if ($3 ison $chan) {
if (%money [ $+ [ $nick ] ] >= $4) {
inc %money [ $+ [ $3 ] ] $4
dec %money [ $+ [ $nick ] ] $4
msg # $nick gives $3 $4 dollars
msg # $3 now has %money [ $+ [ $3 ] ] dollars
}
else { msg $chan You only have %money [ $+ [ $nick ] ] dollars! }
}
}
}
on *:TEXT:!stats*:#: {
if (%money [ $+ [ $2 ] ] == $null) {
msg # $$2 currently does not have any money!
}
else {
msg # $$2 is currently carrying %money [ $+ [ $2 ] ] dollars
}
if (%prop [ $+ [ $2 ] ] == $null) {
msg # $$2 currently does not own property
}
else { msg # $$2 currently owns the %property [ $+ [ $2 ] ]
}
if (%prop [ $+ [ $2 ] ] == true) {
if (%moneystash [ $+ [ $2 ] ] != $null) {
msg # $2 currently has %moneystash [ $+ [ $2 ] ] dollars stashed in his/her property
}
}
}
on *:TEXT:&give*:#: {
if ($nick == NameHere) {
if ($2 ison $chan) {
inc %money [ $+ [ $2 ] ] $3
msg # RandomDude has given $2 $3 dollars
}
}
else { msg # Access Denied }
}
on *:TEXT:&take*:#: {
if ($nick == NameHere) {
if ($2 == carry) {
dec %money [ $+ [ $3 ] ] $4
msg # $nick has taken $4 dollars away from $3
}
elseif ($2 == stash) {
if {%moneystash [ $+ [ $3 ] ] != $null) {
dec %moneystash [ $+ [ $3 ] ] $4
msg # $nick has taken $4 dollars from $3 $+ 's private safe
}
}
}
else { msg # Access Denied }
}
on *:TEXT:!mug*:#: {
if ($2 ison $chan) {
var %mug $rand(1,3)
var %mugmoney $rand(1,50)
if (%mug == 1) {
if (%money [ $+ [ $2 ] ] >= %mugmoney) {
msg $chan $nick steals %mugmoney from $2
inc %money [ $+ [ $nick ] ] %mugmoney
if (%money [ $+ [ $2 ] ] >= %mugmoney) {
dec %money [ $+ [ $2 ] ] %mugmoney
}
else { set %money [ $+ [ $2 ] ] 0 }
}
else { msg # $2 does not have %mugmoney dollars; mug unsuccessfull }
}
if (%mug == 2) {
msg $chan $2 sprays $nick in the face with pepper spray and runs away...
}
if (%mug == 3) { msg $chan $nick gets caught by the police and recives a 500 dollar fine.
if (%money [ $+ [ $nick ] ] >= 500) {
dec %money [ $+ [ $nick ] ] 500
}
else { set %money [ $+ [ $nick ] ] 0 }
}
}
else { msg # $2 is currently not in this channel }
}
on *:TEXT:!properties:#: {
notice $nick Properties for Sale:
notice $nick City Apartment: 1,000 dollars
notice $nick To buy a property, type !buy (Property Name)
notice $nick More Comming Soon!
}
on *:TEXT:!buy*:#: {
if ($2- == City Apartment) {
if (%money [ $+ [ $nick ] ] >= 1000) {
dec %money [ $+ [ $nick ] ] 1000
set %prop [ $+ [ $nick ] ] true
set %property [ $+ [ $nick ] ] City Apartment
msg $chan $nick has bought the City Apartment for 1,000 dollars
}
else { notice $nick You don't have enough money! }
}
}
on *:text:!stash*:#: {
if (%prop [ $+ [ $nick ] ] == true) {
if ($2 == money) {
if (%money [ $+ [ $nick ] ] >= $3) {
dec %money [ $+ [ $nick ] ] $3
inc %moneystash [ $+ [ $nick ] ] $3
msg # $nick has stashed $3 into his property's private safe.
}
else { msg $chan You are only carrying %money [ $+ [ $nick ] ] dollars! }
}
}
else { msg $nick You don't have a property to stash anything in! }
}
on *:text:!withdraw*:#: {
if (%prop [ $+ [ $nick ] ] == true) {
if ($2 == money) {
if (%moneystash [ $+ [ $nick ] ] >= $3) {
dec %moneystash [ $+ [ $nick ] ] $3
inc %money [ $+ [ $nick ] ] $3
msg # $nick has withdrawed $3 dollars from his property's private safe
}
else { msg $chan You only have %moneystash [ $+ [ $nick ] ] dollars in your property's private safe! }
}
}
else { msg $nick You don't have any property to withdraw from! }
}

Comments

Sign in to comment.
cptpan   -  May 13, 2012
Delete
 Respond  
Jethro   -  May 24, 2011
If needed, you can load INI to hash table and work just as well performance-wise. All the modern PCs nowadays come equipped with an ample amount of hard disk space and RAMS, the speed concern should be seen as a trivial matter really. Knock yourself out with INI, hash tables, variables or text file and whatnot!
 Respond  
Gummo   -  May 24, 2011
Lucius did mention that, but at the same time ini files are slower. Generally in this situation a hash table is suggested, but for this type of script performance isn't normally an issue anyway.
 Respond  
Malcolm Cleere   -  May 24, 2011
why not use ini,s for the money system instead off all the vars.. like this,,,

Code

 


 Respond  
Lucius   -  Aug 29, 2010
You'd be better using a txt file or an ini file instead of the vars.
Nice idea, just not well implimented. Try looking at my rpg/slavery script for an idea of how to use ini files and hash tables too.

5/10
 Respond  
ZirixZero   -  Aug 24, 2010
I used the %money variable in here to put money in a %tab variable, and the %tab pays for your snacks and drinks in my bar.

EDIT: I'm also trying to add a "job" function into this script.
 Respond  
bugboy1028   -  May 04, 2010
IF you didnt improve it, i will give it a 4. This is not bad but not good script
 Respond  
airsfotglock   -  May 04, 2010
so if i wanted to add proporty uhh lets say beach house i would do..

Code

 
 Respond  
Gummo   -  Apr 05, 2010
!mug doesn't make any sense...
It should check they have 500 dollars first, that's the risk amount.
The robbery can't stop because the person you're mugging doesn't have x number of dollars - it should be generated up to 50 or their balance, whichever is lower.
 Respond  
cptpan   -  Mar 25, 2010
Delete
 Respond  
cptpan   -  Mar 24, 2010
Delete
 Respond  
slub77   -  Mar 18, 2010
why does no one ever rate scripts, i rated 6, it pretty good
 Respond  
darkly57   -  Mar 17, 2010
Loook good...

/me ^5's RandomDude
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.