Harry

MTA:MA Scripting

Recommended Posts

Jeremy, could you make that !skin command work so if Crazy is in and i type !skin cra or !skin it will recognize him? thanks. Punk.

Share this post


Link to post

Sure punk here it is

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
   if (%a == $null) {
     mta.say $1 $mta.name($1,$2)  Skin: $mta.skin($1,$2).name
   }
   elseif ($mta.name($1,%a) == Unknown) {
     mta.say $1 Error, ID Not Present!
   }
   else {
     mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,$4).name
   }
 }
}

Share this post


Link to post

ok thanks,

i tried my own as well to learn how it works, so now i understand, Do you have a !afk script?

Share this post


Link to post

If I wanted to echo the chat within the mtama dialog to a IRC channel, could I just use the same code as used for mtama mta:VC previously or would there be modifications required for SA use.

Duff

Share this post


Link to post
If I wanted to echo the chat within the mtama dialog to a IRC channel, could I just use the same code as used for mtama mta:VC previously or would there be modifications required for SA use.

Duff

mta.ini --> echo=1 + channel=#isox

Share this post


Link to post

i feel so noob .. :D

two weeks ago i didnt even know scripting in mirc was possible

fresh to mta:SA and mirc scripting , but i have a request

is a script possible that

- works around the map bug .. could be as simple as move the alpabetical first 254 map files to a temp folder (without the current played map) .. and once at the end of a cycle move them all back

- allows you to login , rate and post your rating on center.mtasa.com

sorry , these things might be asked and answered somewhere .. but with all the different topics and the old versions i found it really hard to search

i dont even have a idea how to include a snippet of mirc code atm .. so please bare with me :D

Share this post


Link to post

nother script request .. this one smaller and trivial

is it possible to make a (local) script which would allow peepz like me to run a command

!playnext

which mirc would nicelly parse to winamp ... and change to the next song

NEVER MIND

i found a program that can be run with command to do this .. and made a few links to the program with correct options .. and bind those to my keyboard's quick buttons .. tnx anyway - the other script request is still valid ;)

Edited by Guest

Share this post


Link to post

ok ppl, this is a easy one. I need a script that if you are not on a certain list for something, and you use a certain weapon, it kills you. Please send it to me w/o aliases.... thanks.

Share this post


Link to post

ok nvm i got that last request already.. man thats outdated, uhh but i do need the correct parameters for mta.magcops, cuz my RPG is poping back errors about it not being connected. Or according to mIRC:

* /mta.msgcops: not connected to server

Anyone have any insight on whats wrong? heres the Alias its in...

alias mta.on {

set %RPG on

set %joint off

writeini "Skin.ini" Score Cop 0

writeini "Skin.ini" Score Robber 0

remini "RPG2.txt" Sell

remini "RPG2.txt" Sell1

set %bet off

set %hack off

.timer 1000000 60 mta.msgcops $1-

.timer 100000 150 writeini "RPG2.txt" Cash Showroom $calc($readini(RPG2.txt, Cash, Showroom) + 7000)

mta.checker1 $1-

}

so you know, i didnt write this one...lol

Share this post


Link to post

That error occurs when the alias doesnt exist so it tires to send the command to the server. You might want to check the number of braces you;re using.

Share this post


Link to post
on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
   if (%a == $null) {
     mta.say $1 $mta.name($1,$2)  Skin: $mta.skin($1,$2).name
   }
   elseif ($mta.name($1,%a) == Unknown) {
     mta.say $1 Error, ID Not Present!
   }
   else {
     mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,$4).name
   }
 }
} 

surely that could be cut down to just

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
   if (%a != $null) {
     mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name
   }
   else {
     mta.say $1 Error, ID Not Present!
   }
 }
}

although im not even sure you would still need the else

Share this post


Link to post

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
   if (%a != $null) {
     mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name
   }
   else {
     mta.say $1 Error, ID Not Present!
   }
 }
}

although im not even sure you would still need the else

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) { mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name }
}

or just ^^.

Share this post


Link to post
on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
   if (%a != $null) {
     mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name
   }
   else {
     mta.say $1 Error, ID Not Present!
   }
 }
}

although im not even sure you would still need the else

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) { mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name }
}

or just ^^.

or

on *:SIGNAL:mta.command: {
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 if ($3 == !skin) {
if (%a == -1) mta.say $1 Error, ID Not Present!
else mta.say $1 $mta.name($1,%a)  Skin: $mta.skin($1,%a).name 
}
}

Share this post


Link to post

There's many ways you can do it, tis part of the fun finding the best..

The check to see if the name's unknown was needed in 0.5 because you used to get unknowns through the playerlist, not sure if that still happens.

Share this post


Link to post

ok i dont get this... i setup the information in my ini to make a place, buyable, and sellable. when i try to buy it it says " bought the 1 for 1." i think i may have a !buyplace code error. I didnt write this but here it is... Please let me know.

var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)

if ($3 == !buyplace) {
     if ($mta.area($1,$2) == Vice-City) { 
       mta.msg $1 $2 There is no property here that you can purchase
     }
     else {
       if $readini(vcpdata.txt, %a, Owner) = $mta.name($1,$2) {
         mta.msg $1 $2 You already own this property
       }
       else {
         if ( $readini(RPG2.txt, Cash, $mta.name($1,$2)) > $calc($readini(vcpdata.txt, %a, Price) + 1) ) {
           mta.say $1 $mta.name($1,$2) purchased the %a for $ $calc($readini(vcpdata.txt, %a, Price) + 1)
           writeini "vcpdata.txt" Properties $readini(vcpdata.txt, %a, Owner) $calc($readini(vcpdata.txt, Properties, $readini(vcpdata.txt, %a, Owner)) - 1)
           writeini "RPG2.txt" Cash $mta.name($1,$2) $calc($readini(RPG2.txt, Cash, $mta.name($1,$2)) - $calc($readini(vcpdata.txt, %a, Price) + 1))
           writeini "RPG2.txt" Cash $readini(vcpdata.txt, %a, Owner) $calc($readini(RPG2.txt, Cash, $readini(vcpdata.txt, %a, Owner)) + $calc($readini(vcpdata.txt, %a, Price) + 1))
           writeini "vcpdata.txt" Properties $mta.name($1,$2) $calc($readini(vcpdata.txt, Properties, $mta.name($1,$2)) + 1)
           writeini "vcpdata.txt" %a Owner $mta.name($1,$2)
           writeini "vcpdata.txt" %a Price $calc($readini(vcpdata.txt, %a, Price) + 1) 
         }
         else {
           mta.msg $1 $2 Not enough Money.
         }
       }
     }
   }

I greatly Appreciate it.

Share this post


Link to post
Guest

Hello, I have been trying to get this Capture the Whoopee script working for a long time, but it does not work. Could anybody fix it for me?

Here it is:

on *:SIGNAL:mta.join:{
 if ($timer(ctw $+ $1)) {
   mta.msg $1 $2 Welcome, Capture the Whoopee active!
   mta.msg $1 $2 Stay as long as possible in the Whoopee (Round time left: $duration($timer(ctw $+ $1).secs))
 }
}
on *:SIGNAL:mta.command:{
 if ($timer(ctw $+ $1)) {
   if ($3 == !time) {
     mta.say $1 Time left: $duration($timer(ctw $+ $1).secs))
   }
  if ($3 == !ctw { ctw $1 $4- }
   if ($3 == !score) {
     !writeini ctw.ini S $+ $1 ID $+ $gettok(% [ $+ [ $1 ] ],1,32) $calc($readini(ctw.ini,S $+ $1,ID $+ $gettok(% [ $+ [ $1 ] ],1,32)) + $ticks - $gettok(% [ $+ [ $1 ] ],2,32))
     % [ $+ [ $1 ] ] = $gettok(% [ $+ [ $1 ] ],1,32) $ticks
     var %a = $ctw2($1)
     mta.say $1 $mta.name($1,%a) is leading with a time of $duration($calc($readini(ctw.ini,S $+ $1,ID $+ %a)/1000)) !
   }
 }
}
alias ctw {
 if ($4 == on) {
   !.timer 1 0 mta.say $1 Capture the Whoopee activated!
   !.timer 1 2 mta.say $1 Stay as long as possible in the Whoopee in a round of 30 mins!
   remini ctw.ini S $+ $1
   .timerctw $+ $1 1 1800 ctw $1 stop
   unset % [ $+ [ $1 ] ]
 }
 if ($4 == off) {
   if (% [ $+ [ $1 ] ]) !writeini ctw.ini S $+ $1 ID $+ $gettok(% [ $+ [ $1 ] ],1,32) $calc($readini(ctw.ini,S $+ $1,ID $+ $gettok(% [ $+ [ $1 ] ],1,32)) + $ticks - $gettok(% [ $+ [ $1 ] ],2,32))
   var %a = $ctw2($1)
   mta.say $1 Capture the Whoopee deactivated!
   mta.say $1 $mta.name($1,%a) has won with a time of $duration($calc($readini(ctw.ini,S $+ $1,ID $+ %a)/1000)) !
   remini ctw.ini S $+ $1
   .timerctw $+ $1 off
   unset % [ $+ [ $1 ] ]
 }
 if ($4 == stop) {
   if (% [ $+ [ $1 ] ]) !writeini ctw.ini S $+ $1 ID $+ $gettok(% [ $+ [ $1 ] ],1,32) $calc($readini(ctw.ini,S $+ $1,ID $+ $gettok(% [ $+ [ $1 ] ],1,32)) + $ticks - $gettok(% [ $+ [ $1 ] ],2,32))
   var %a = $ctw2($1)
   mta.say $1 Time up! New round!
   mta.say $1 $mta.name($1,%a) has won with a time of $duration($calc($readini(ctw.ini,S $+ $1,ID $+ %a)/1000)) !
   mta.say $1 Stay as long as possible in the Whoopee in a round of 30 mins!
   remini ctw.ini S $+ $1
   .timerctw $+ $1 1 1800 ctw $1 stop
   unset % [ $+ [ $1 ] ]
 }
}
alias ctw2 {
 var %a = 1,%b,%c = 0
 while ($ini(ctw.ini,S $+ $1,0) >= %a) {
   if ($readini(ctw.ini,S $+ $1,$ini(ctw.ini,S $+ $1,%a)) > %c) {
     %c = $readini(ctw.ini,S $+ $1,$ini(ctw.ini,S $+ $1,%a))
     %b = $right($ini(ctw.ini,S $+ $1,%a),-2)
   }
   inc %a
 }
 return %b
}
alias mta.car {
 if ($timer(ctw $+ $1)) {
   if ($gettok(% [ $+ [ $1 ] ],1,32) == $2) {
     mta.say $1 $mta.name($1,$2) lost the Whoopee!
     !writeini ctw.ini S $+ $1 ID $+ $2 $calc($readini(ctw.ini,S $+ $1,ID $+ $2) + $ticks - $gettok(% [ $+ [ $1 ] ],2,32))
     unset % [ $+ [ $1 ] ]
   }
   if ($mta.vehicle($1,$2).name == Mr. Whoopee) {
     mta.say $1 $mta.name($1,$2) has the Whoopee!
     if (% [ $+ [ $1 ] ]) !writeini ctw.ini S $+ $1 ID $+ $gettok(% [ $+ [ $1 ] ],1,32) $calc($readini(ctw.ini,S $+ $1,ID $+ $gettok(% [ $+ [ $1 ] ],1,32)) + $ticks - $gettok(% [ $+ [ $1 ] ],2,32))
     % [ $+ [ $1 ] ] = $2 $ticks
   }
 }
}

Share this post


Link to post

sry toucan, i dont understand the clips like

$gettok(% [ $+ [ $1 ] ],1,32)) + $ticks -

to confusing...

BUT... I did fix my script... the author forgot var %a = $mta.area($1,$2) in several areas, not just this chunk.. i detected it all on my own :P

Share this post


Link to post
Guest

hehe i need someone then who knows timers to help me out :wink:

Share this post


Link to post
Guest

pretty much everything, no data is written to the ini, i went !ctw on and nothing happened, I do not think that in general it is scripted correctly, especially timers

Share this post


Link to post

Hey,

well i took a quick glance at it and i saw u have no $ infront of ctw. Maby that the problem? Im am not 100% sure but try like (Under mta.join signal) ($ctw $+ $1) or what ever it was. Well hope that helps!

Cya,

[XE]Tommis

Share this post


Link to post
Hey,

well i took a quick glance at it and i saw u have no $ infront of ctw. Maby that the problem? Im am not 100% sure but try like (Under mta.join signal) ($ctw $+ $1) or what ever it was. Well hope that helps!

you only do that if its a function that returns a value, like $mta.name($1,$2) checks an ini for a name then uses !return to give it back, no sure what the code looks like but im guessing it could be something like

!return $readini($1 $+ .ini,$2,name)

Share this post


Link to post

  • Recently Browsing   0 members

    No registered users viewing this page.