LeetCraig Posted April 2, 2006 Share Posted April 2, 2006 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 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 Link to comment
Jeremy Posted April 2, 2006 Share Posted April 2, 2006 (edited) 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 } } Edited April 3, 2006 by Guest Link to comment
MrJax Posted April 3, 2006 Share Posted April 3, 2006 on *:SIGNAL:mta.command:{ ...wrong wrong wrong! } Don't ever script again!! 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
LeetCraig Posted April 3, 2006 Author Share Posted April 3, 2006 Thanks guys, I'll be sure to know what I'm doing first next time Could you explain to me why his code is wrong? Link to comment
Jeremy Posted April 3, 2006 Share Posted April 3, 2006 on *:SIGNAL:mta.command:{ ...wrong wrong wrong! } Don't ever script again!! I never wrote that. Link to comment
MrJax Posted April 4, 2006 Share Posted April 4, 2006 I never wrote that. Haha, dont edit it to make me look like an ass, it was a complete mess before Link to comment
Jeremy Posted April 4, 2006 Share Posted April 4, 2006 I never wrote that. Haha, dont edit it to make me look like an ass, it was a complete mess before yes it was, i fixed it with your post thank you jax Link to comment
Recommended Posts