Jump to content

!givecash


LeetCraig

Recommended Posts

Now, I know this command would be very useful to many people so that they don't have to get out of the game every time they want to add or remove money from an account. I think I might have the general idea of a script like this, but I need some help...

Don't flame me if I'm being a complete idiot with this attempt, I just started mIRC scripting two days ago :P

What I need help with in the code below is two things. I need to know how to make it so that only administrators can use this code, and I need to know how to make it add or subtract cash from the current total of the account in rpg.ini. The two commands would look something like:

!givecash

!remcash

The code below is probably horrible, but this is what I would think the !givecash script should look like (without the coding so that it can only be used by administrators).

on *:SIGNAL:mta.command:{ 
if ($3 == !givecash) {
 !writeini -n rpg.ini **NOT SURE HOW TO ADD MONEY TO THE CURRENT AMOUNT** 
}

No disses please :P

Link to comment

The code below is probably horrible, but this is what I would think the !givecash script should look like (without the coding so that it can only be used by administrators).

on *:SIGNAL:mta.command:{
 var %a = $iif($4 == $null,$2,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4))) 
 if ($3 == !givecash) { 
   var %c = $readini(rpg.ini,cash,$mta.name($1,$2))
   %c = $calc(%c + $5)
   !writeini -n rpg.ini cash $mta.name($1,%a) %c
   mta.say $1 $mta.name($1,$2) has added $5 to mta.name($1,%a) cash 
 }
 if ($3 == !remcash) { 
   var %c = $readini(rpg.ini,cash,$mta.name($1,$2))
   %c = $calc(%c - $5)
   !writeini -n rpg.ini cash $mta.name($1,%a) %c
   mta.say $1 $mta.name($1,$2) has removed $5 from mta.name($1,%a) cash 
 }
}

:wink:

Edited by Guest
Link to comment

on *:SIGNAL:mta.command:{
...wrong wrong wrong!
}

Don't ever script again!! :P

LeetCraig, to add to a value in an ini..

var %a = $readini(rpg.ini,cash,$mta.name($1,$2))      (get the value)
%a = $calc(%a + 1)                                                 (add to the value)
!writeini -n rpg.ini cash $mta.name($1,$2) %a            (write the value)

!writeini -n rpg.ini cash $mta.name($1,$2) $calc($iif($readini(rpg.ini,cash,$mta.name($1,$2)),$v1,0) + 1)

Link to comment
  • Recently Browsing   0 members

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