Jump to content

MTAMA Scripting


Si|ent

Recommended Posts

Posted

mta.exit is when you leave a car :P

Also - i though $s were used for identifiers, not commands (correct me if i'm wrong and tell me why ;))

  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

This is wot i have for mta.part

on *:SIGNAL:mta.part:{
 if ($readini(bjack.ini,adminlist,$mta.name($1,$2)) != $null) {
   writeini bjack.ini onlineadmin current $remtok($readini(bjack.ini,onlineadmins,current),$mta.name($1,$2),1,46)	
   mta.say $1 $mta.name($1,$2) has logged off as admin!
 }
 else { mta.say $1 $mta.name($1,$2) has left the game!
 }
}

it wont work summat wrong wit the $remtok

Posted
This is wot i have for mta.part

on *:SIGNAL:mta.part:{
 if ($readini(bjack.ini,adminlist,$mta.name($1,$2)) != $null) {
   writeini bjack.ini onlineadmin current $remtok($readini(bjack.ini,onlineadmins,current),$mta.name($1,$2),1,46)	
   mta.say $1 $mta.name($1,$2) has logged off as admin!
 }
 else { mta.say $1 $mta.name($1,$2) has left the game!
 }
}

it wont work summat wrong wit the $remtok

try

on *:SIGNAL:mta.part:{
 if ($readini(bjack.ini,adminlist,$mta.name($1,$2)) != $null) {
   writeini bjack.ini onlineadmin current $remtok($readini(bjack.ini,onlineadmin,current),$mta.name($1,$2),1,46)	
   mta.say $1 $mta.name($1,$2) has logged off as admin!
 }
 else { mta.say $1 $mta.name($1,$2) has left the game!
 }
}

Posted

take a closer look its not you typo

(bjack.ini,onlineadmins,current),$mta.name($1,$2),1,46)

(bjack.ini,onlineadmin,current),$mta.name($1,$2),1,46)

you had onlineadmins instead of onlineadmin look closer next time..

Posted

MIRC says this writeini has incorrect parameters can sum 1 correct this

writeini bjack.ini onlineadmin current $remtok($readini(bjack.ini,onlineadmin,current),$mta.name($1,$2),1,46)  

Posted

i need to see the contents of the ini

also.. why are u using tokens for such a simple purpose?

Posted

if ($3 == !warned) {
   unset %warned
   set %countwarned 0
   while (%countwarned < 26 ) {
     if ($mta.name($1,%countwarned) != Unknown) && (if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       if (%warned == $null) {
         %warned = $mta.name($1, %countwarned) ( $+ if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       }
       else {
         %warned = %warned $+ , $mta.name($1, %countwarned) ( $+ if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       }
     }
     %countwarned = %countwarned + 1
   }
   if ( %warned == $null ) {
     mta.say $1 No people warned in this server.
   }
   else {
     mta.say $1 Warned people: %warned
   }
   unset %warned
   unset %countwarned
 }

why is this dont work ??

Posted
MIRC says this writeini has incorrect parameters can sum 1 correct this

writeini bjack.ini onlineadmin current $remtok($readini(bjack.ini,onlineadmin,current),$mta.name($1,$2),1,46)  

%current = $remtok($readini(bjack.ini,onlineadmin,current),$mta.name($1,$2),1,32)  
if (%current != $null) {
 writeini bjack.ini MTA onlineadmin current
}
else {
 remini bjack.ini MTA onlineadmin current
}

This use create bjack.ini structured like:

[MTA]

onlineadmin = a b c d e

something = else

Posted

Harry can you fix this ?

if ($3 == !warned) {
   unset %warned
   set %countwarned 0
   while (%countwarned < 26 ) {
     if ($mta.name($1,%countwarned) != Unknown) && (if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       if (%warned == $null) {
         %warned = $mta.name($1, %countwarned) ( $+ if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       }
       else {
         %warned = %warned $+ , $mta.name($1, %countwarned) ( $+ if ($readini( "MTAwarn.ini", main, $mta.name( $1, %countwarned ) ) ) {
       }
     }
     %countwarned = %countwarned + 1
   }
   if ( %warned == $null ) {
     mta.say $1 No people warned in this server.
   }
   else {
     mta.say $1 Warned people: %warned
   }
   unset %warned
   unset %countwarned
 }


Posted
if $3 == !warned {
 var %a = 0,%b
 while %a < $mta.maxplayers($1) {
   if $ini($mta.dir $+ $1.ini,ID $+ %a) && $readini(MTAwarn.ini,main,$mta.name($1,%a)) {
     if %b == $null { %b = $mta.name($1,%a) }
     else { %b = %b $+ , $mta.name($1,%a) }
   }
   !inc %a
 }
 mta.say $1 $iif(%b == $null,No people warned in this server.,Warned people: %b)
}


Posted

;!timeban Script - Edited! 
;Code: 

alias mta.start { 
 .timerunban 0 10 mta.timeunban 
} 
alias mta.text { 
 if ($readini($scriptdir $+ $1.ini,ID $+ $2,op)) { 
   if ($3 == !timeban) { 
     if ($4 != $null) { 
       if ($5 != $null) { 
         if ($6 != $null) { 
           if ($mta.name($1,$4) == unknown) { 
             mta.say $1 Error! ID $4 don't exist! 
           } 
           else { 
             if ($6 == sec || $6 == min || $6 == hour || $6 == day || $6 == week) { 
               mta.timeban $1- 
             } 
             else { 
               mta.say $1 Error of synthesis, use: !timeban  value (sec,min,hour,day or week). 
             } 
           } 
         } 
         else { 
           mta.say $1 Error of synthesis, use: !timeban  value (sec,min,hour,day or week). 
         } 
       } 
       else { 
         mta.say $1 Error of synthesis, use: !timeban  value (sec,min,hour,day or week). 
       } 
     } 
     else { 
       mta.say $1 Error of synthesis, use: !timeban  value (sec,min,hour,day or week). 
     } 
   } 
 } 
} 
alias mta.timeban { 
 %id = $4 
 %ip = $mta.ip($1, %id) 
 %currenttime = $ctime 

 if (%id == -1) { 
   !return 
 } 
 %factor_text = $6 
 if (%factor_text == sec) { 
   %factor = 1 
 } 
 elseif (%factor_text == min) { 
   %factor = 60 
 } 
 elseif (%factor_text == hour) { 
   %factor = 3600 
 } 
 elseif (%factor_text == day) { 
   %factor = 86400 
 } 
 elseif (%factor_text == week) { 
   %factor = 604800 
 } 

 %ban_until = $calc(%currenttime + $5 * %factor) 
 mta.say $1 $mta.name($1,$4) has been BANned by $mta.name($1,$2) until $asctime(%ban_until) 
 %bans = $readini( "MTAbans.ini", bans, ips) 
 %bans = $addtok(%bans, $longip(%ip), 32) 

 %servers = $readini( "MTAbans.ini", servers, $longip(%ip)) 
 %servers = $addtok(%servers, $1, 32) 

 writeini "MTAbans.ini" bans ips %bans 
 writeini "MTAbans.ini" banduration $longip(%ip) %ban_until 
 writeini "MTAbans.ini" server $longip(%ip) %servers 
 writeini "MTAbans.ini" name $longip(%ip) $mta.name($1,%id) 
 writeini "MTAbans.ini" ip $longip(%ip) $mta.ip($1,%id) 
 mta.ban $1 %id 
} 
alias mta.timeunban { 
 %bans = $readini( "MTAbans.ini", bans, ips) 
 %num_bans = $numtok(%bans, 32) 
 %currenttime = $ctime 
 %counter = 0 

 while (%counter < %num_bans) { 
   if (%num_bans > 1) { 
     %banned = $gettok( %bans , %counter + 1 , 32) 
   } 
   else { 
     %banned = %bans 
   } 
   if (%banned != $null) { 
     %ban_until = $readini( "MTAbans.ini", banduration, %banned ) 
     if (%ban_until <= %currenttime) { 
       %servers = $readini( "MTAbans.ini", server, %banned) 
       %name = $readini( "MTAbans.ini", name, %banned) 
       %num_servers = $numtok(%servers,32) 
       %counter2 = 0 
       while (%counter2 <= %num_servers) { 
         %server = $gettok( %servers , %counter2 + 1 , 32) 
         mta.say %server  %name has been unBANned ... 
         mta.unban %server $longip(%banned) 
         %counter2 = %counter2 + 1 
       } 
       %bans = $remtok(%bans, %banned, 32) 
       %num_bans = $calc(%num_bans - 1) 
       %counter = %counter - 1          
       remini "MTAbans.ini" banduration %banned 
       remini "MTAbans.ini" server %banned 
       remini "MTAbans.ini" name %banned 
       remini "MTAbans.ini" ip %banned 
     } 
   } 
   %counter = %counter + 1 
 } 
 if (%bans != $null) { 
   writeini "MTAbans.ini" bans ips %bans 
 } 
 else { 
   remini "MTAbans.ini" bans ips 
 } 
} 
alias mta.pm { 
 if ($3- == server secret) { 
   mta.say $1 Admin rights given to $mta.name($1,$2) 
   writeini $+(",$scriptdir,$1.ini") ID $+ $2 op 1 
 } 
}
;Tested with success...

Lol, i do !timeban 0 1 sec i wait 20 sec or longer and i'am unbanned can somone PLEASE fix it ?

Posted

Decrease the timer to check more often.

(this might also incluse a system crash becuase of low resources, caused by the constant checking)

Posted
ok this is nothing to do with ur conversation at all but it is a script suggestion.

could u make a DM script? now that does sound stupid, but i'll explain.

there is a 30min time limit. the scoreboard is reset before hand. ppl kill, mtama monitors it like the scoreboard. at the end of the round there is a 'champ', who got the most kills and every1 is slapped to death for the next round, and scores reset. the 'champ' gets a 'champ point' for winning the round. in the next round, the name of the champ is randomly spammed (just to give him sum glory). and after say...2hrs the person with the most 'champ points' wins the...ermm.. the...set? ok so the champ points idea isnt realy needed, but i reckon this will give thecurrent gamemode a much better, and fun effect. ty

bleh nuff quoted

Posted
elseif ($3 == !kick) && (%ismoderator. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == true || %isadmin. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == true) {

mta.say $1 $mta.name( $1 , $2 ) has kicked $mta.name( $1 , $4 ) $+ . Reason: $5-

set %kicks $calc($readini("MTAscript.ini",kicks,$mta.name( $1 , $2 )) + 1)

writeini -n "MTAscript.ini" kicks $mta.name( $1 , $2 ) %kicks

echo -a Server $1 : $mta.name( $1 , $2 ) kicked nr. %kicks

mta.kick $1 $4 $5-

}

can you tell me 1) how i can make this work using wildcards, 2) make it so i cant kick myself, and 3) give me an error if there is an incorrect ID/name used

Posted (edited)

1)

$iif($4 isnum,$4,$mta.getid($1,$4)

this will get you the id for the player - using either !kick or !kick

2) Put

if ($iif($4 isnum,$4,$mta.getid($1,$4) != $2)

at the start.

3)

if ($mta.name($1,$iif($4 isnum,$4,$mta.getid($1,$4)) != unknown)

Here's the whole script with the new bits added as my explanations were crap

elseif ($3 == !kick) && (%ismoderator. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == true || %isadmin. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == true) { 
 %a = $iif($4 isnum,$4,$mta.getid($1,$4))
 if (%a == $2) mta.msg $1 $2 You cannot kick yourself!
 elseif ($mta.name($1,%a) == unknown) mta.msg $1 $2 Invalid ID/Name
 else {
   mta.say $1 $mta.name($1,$2) has kicked $mta.name($1,%a) $+ . Reason: $5- 
   set %kicks $calc($readini("MTAscript.ini",kicks,$mta.name($1,$2)) + 1) 
   !writeini -n "MTAscript.ini" kicks $mta.name($1,$2) %kicks 
   echo -a Server $1 $+ : $mta.name($1,$2) kicked nr. %kicks 
   mta.kick $1 %a
 }
 unset %a 
}

Hope i haven't made any mistakes :P

Edited by Guest
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...