Jump to content

MTA:MA Scripting


Harry

Recommended Posts

  • Replies 357
  • Created
  • Last Reply

Top Posters In This Topic

Posted

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
   }
 }
}

Posted

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

A signature is a little text that can be added at the bottom of your posts.

It's limited to 500 characters on 5 line(s) and 1 image(s) with none larger than 150x650 pixels and for a maximum of 150Kb.

In your text, no more than 100 characters without space too. oh now you tell me.

Posted
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

"Never argue with an idiot. They bring you down to their level and beat you with experience."

"Arguing on the internet is like the Special Olympics. Even if you win, you're still retarded."

signature.gif

  • 2 weeks later...
Posted

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

coz_sig_oob.png

Server Blog | Server quickinfo

STFU and dont bug the mta team with ''when is DM comming''

or risk theyre spending more time explaining they're still working on DM than actually getting work done :shock:

Posted (edited)

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

coz_sig_oob.png

Server Blog | Server quickinfo

STFU and dont bug the mta team with ''when is DM comming''

or risk theyre spending more time explaining they're still working on DM than actually getting work done :shock:

Posted

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.

Posted

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

Posted

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.

av.png

Posted
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

Kevuwk

Any comments made are purely my own and do not represent the interests of the MTA Team

Posted

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 ^^.

Posted
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 
}
}

asherbert.png
Posted

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.

Posted

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.

Posted

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
   }
 }
}

Posted

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

Posted

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

Posted

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

Posted

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

xe6za.gif

banner.gif

Best game server hosting. America East&West Coast, and many European locations available.

Click on the above link to check us out!

Posted
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)

Kevuwk

Any comments made are purely my own and do not represent the interests of the MTA Team

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...