Jump to content

Bank / Cash system


MeanpantheR

Recommended Posts

Havn't tested it, just the second wrote it...

on *:SIGNAL:mta.command:{
 var %a = $iif($4 == $null,$2,$iff($mta.getid($1,$4) == -1,$2,$mta.getid($1,$4)))
 if ($3 == !info) mta.say $1 MeanpantheR's Bank System
 elseif ($3 == !cash) mta.say $1 $mta.name($1,%a) $+ 's Cash: $mta.cash($1,%a)
 elseif ($3 == !bank) mta.say $1 $mta.name($1,%a) $+ 's Bank: $mta.bank($1,%a)
 elseif ($3 == !bank+) {
   if ($mta.area($1,$2) == Bank && $mta.health($1,$2) > 0) {
     if ($mta.cash($1,$2) > 0) {
       if ($4 != $null) {
         if ($4 <= $mta.cash($1,$2)) {
           if ($4 isnum && $chr(46) !isin $4) {
             mta.say $1 $mta.name($1,$2) put $4 into their bank!
             writeini MTAScript.ini Bank $mta.name($1,$2) $calc($mta.bank($1,$2) + $4)
             writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - $4)
           }
          else mta.msg $1 $2 Error $4 must be numbers without points
         }
        else mta.msg $1 $2 You don't have that much money on hand
       }
       else {
         mta.say $1 $mta.name($1,$2) put $mta.cash($1,$2) into their bank!
         writeini MTAScript.ini Bank $mta.name($1,$2) $calc($mta.bank($1,$2) + $mta.cash($1,$2))
         writeini MTAScript.ini Cash $mta.name($1,$2) 0
       }
     }
    else mta.msg $1 $2 You havn't got any money...
   }
  else mta.msg $1 $2 To use a !bank command you must be at the bank
 }
 elseif ($3 == !bank-) {
   if ($mta.area($1,$2) == Bank && $mta.health($1,$2) > 0) {
     if ($mta.bank($1,$2) > 0) {
       if ($4 != $null) {
         if ($4 <= $mta.bank($1,$2)) {
           if ($4 isnum && $chr(46) !isin $4) {
             mta.say $1 $mta.name($1,$2) took $4 from their bank!
             writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) + $4)
             writeini MTAScript.ini Bank $mta.name($1,$2) $calc($mta.bank($1,$2) - $4)
           }
          else mta.msg $1 $2 Error $4 must be numbers without points
         }
        else mta.msg $1 $2 You don't have that much money in the bank
       }
       else {
         mta.say $1 $mta.name($1,$2) took $mta.bank($1,$2) from their bank
         writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) + $mta.bank($1,$2))
         writeini MTAScript.ini Bank $mta.name($1,$2) 0
       }
     }
    else mta.msg $1 $2 You havn't got any money...
   }
  else mta.msg $1 $2 To use a !bank command you must be at the bank
 }
 elseif ($3 == !give) {
   if ($2 != %a && $5 != $null) {
     if ($5 <= $mta.cash($1,$2)) {
       if ($5 isnum && $chr(46) !isin $5) {
         writeini MTAScript.ini Cash $mta.name($1,%a) $calc($mta.cash($1,%a) + $5)
         writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - $5)
         mta.say $1 $mta.name($1,$2) gave $mta.name($1,%a) $5
       }
      else mta.msg $1 $2 Error $5 must be numbers without points
     }
    else mta.msg $1 $2 You don't have that much cash to give
   }
  else mta.msg $1 $2 Synax: $3 
 }
}


alias mta.cash {  
 !return $iif($readini(MTAScript.ini,Cash,$mta.name($1,$2)) == $null,0,$v1)
}
alias mta.bank {
 !return $iif($readini(MTAScript.ini,Bank,$mta.name($1,$2)) == $null,0,$v1)
}

// Edit:

Just added something to get people going (again untested, if it dosnt work PM me or reply here and someone will help)

on *:SIGNAL:mta.join:{
 if ($mta.bank($1,$2) == 0) {
   writeini MTAScript.ini Bank $mta.name($1,$2) 2000
   mta.msg $1 $2 Welcome to the server. You now have $ $+ 2000 in your bank
 }
 else mta.msg $1 Welcome to the server. You have $mta.bank($1,$2) in your bank
}

on *:SIGNAL:mta.part:{
 writeini MTAScript.ini Cash $mta.name($1,$2) 0
}

on *:SIGNAL:mta.kill:{
 if ($mta.cash($1,$2) > 0) {
   if ($2 != $3 && $mta.name($1,$3) != Unknown) {
     writeini MTAScript.ini Cash $mta.name($1,$3) $calc($mta.cash($1,$2) + $mta.cash($1,$3))
     mta.msg $1 $3 You have gained $mta.cash($1,$2) for killing $mta.name($1,$2)
     mta.msg $1 $2 You have lost $mta.cash($1,$2) because $mta.name($1,$3) killed you!
     writeini MTAScript.ini Cash $mta.name($1,$2) 0
   }
   elseif ($2 == $3) {
     mta.msg $1 $2 You lost $mta.cash($1,$2) because you killed yourself
     writeini MTAScript.ini Cash $mta.name($1,$2) 0
   }
 }
}

If you have no money in the bank when you join, you get 2,000.

If you get killed the killer will get all your cash, if you kill yourself you lose it, if you die by somthing else (say you fall off your bike and die) you shouldnt lose any money

If you leave game, all cash that isnt in your bank will get removed

-

Any problems give me a shout

//Edit 2

added !give command & !cash should now work...

again, still havnt tested it yet so it might not work

Edited by Guest
Link to comment

Hi All.

I Made this script for making money

but when i do !spin and if i win the cash,

and type !cash my cash is still at 0

maybe something is wrong in my script or maybe in MeanpantheR's Script i dont know

This is wht i wrote

on *:SIGNAL:mta.command: {
if ($3 = !spin) {
   var %a = $rand(1,2)
   .timer 1 0 mta.say $1 The Wheel Is Spinning !
   .timer 1 2 mta.say $1 The Wheel Is Starting To Stop !
   .timer 1 3 mta.say $1 The Wheel Stopped !
   .timer 1 5 mta.say $1 $iif(%a == 1,$mta.name($1,$2) Won ($7500),$mta.name($1,$2) Lost ($2500))
   if (%a = 1) !writeini ("MTAScript.ini") $mta.name($1,$2) Cash $calc($readini(MTAScript.ini,$mta.name($1,$2),Cash) + 7500)
   else !writeini ("MTAScript.ini") $mta.name($1,$2) Cash $calc($readini(MTAScript.ini,$mta.name($1,$2),Cash) - 2500)
}

Link to comment

Fixed, I had a $4 insted of $5

 elseif ($3 == !give) {
   if ($2 != %a && $5 != $null) {
     if ($5 <= $mta.cash($1,$2)) {
       if ($5 isnum && $chr(46) !isin $5) {
         writeini MTAScript.ini Cash $mta.name($1,%a) $calc($mta.cash($1,%a) + $5)
         writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - $5)
         mta.say $1 $mta.name($1,$2) gave $mta.name($1,%a) $5
       }
      else mta.msg $1 $2 Error $5 must be numbers without points
     }
    else mta.msg $1 $2 You don't have that much cash to give
   }
  else mta.msg $1 $2 Synax: $3 
 } 

^ that should work (updated on first post aswell)

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...