Jump to content

!admin help


SamB

Recommended Posts

where are stored the levels for admins?

in my example they are in $readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a)), change it to whatever

on *:SIGNAL:mta.command:{
 if (!admin* iswm $3) {
   var %a = 0,%b
   while (%a <= $mta.server($1).cmax) {
     if ($readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a)) >= 1) {
       if (!%b) %b = $mta.nick($1,%a) $+ (Level: $readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a)) $+ )
       elseif (%b) %b = %b $+ , $mta.nick($1,%a) $+ (Level: $readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a)) $+ )
     }
     !inc %a
   }
   mta.text $1 $iif(%b,Admins online: %b,There are currently no admins online)
 }
}

Link to comment

hmm, i can't find any mistake in my script.. is admins.ini in the same dir as the script? does it give up any errors? i don't know how to help you.. i gave you an example of an !admin script that must work fine imo

try this

on *:SIGNAL:mta.command:{
 if (!admin* iswm $3) {
   var %a = 0,%b,%c
   while (%a <= $mta.server($1).max) {
     if ($readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a)) >= 1) {
       %c = $readini($scriptdir $+ admins.ini,levels,$mta.nick($1,%a))
       if (!%b) %b = $mta.nick($1,%a) $+ (Level: %c $+ )
       elseif (%b) %b = %b $+ , $mta.nick($1,%a) $+ (Level: %c $+ )
     }
     !inc %a
   }
   mta.text $1 $iif(%b,Admins online: %b,There are currently no admins online)
 }
}

Link to comment

lets start with the beginning

script type admins are different then rcon admins

that said

do you even have script admins ?

if the answer is no, well .. change that first

if your trying to write your own script its still not a bad idea to 'borrow' the admin part of a ready script .. just ask the author for permision

maybe u can use tommis script

Link to comment

hmm well i was thinking all the admins on my server i put in a .ini

[Admins]

{XN}Boylett 5

{XN}Tomson 3

{XN}Paddy 5

paulgti 4

etc.

then i was thinking of a script which does this:

someone says !admin or !admins

the script looks at admins.ini

it sees if any of those ppl are online

if one of them is online it shows their name and their lvl like so:

{XN}Boylett 5, {XN}Tomson 3 etc. (this wud be if only me and tomson were online)

so it doesnt bother with rcon it just shows someones name if they admin and online :D

i think its an ok idea to use if u wanna keep RCON

i was thikning maybe:

on *:SIGNAL:mta.command: { 
 if ($3 == !admins) { 
  ($readini admins.ini)
 If ($4 == mta.online)
 mta.text $1 mta.nick $1 $2 mta.level
 elseif ($4 == mta.offline)
 mta.nothing
 }
}

i no its all messed and mangled like my SA car but i was thinking a good scripter cud fix it. i have no idea wat anything means anyway :oops:

Link to comment

you do realise

with the ini and the !admin command

IF you get both running

STILL you wont have functional admins

try this code

ingame type !set

(dont mess manualy with the ini file , type !set once to make yourself admin level 10

and use !setlevel nickname 5 to add a level 5 admin )

on *:SIGNAL:mta.command: {
 ;Parameters:
 ;$1 = Server
 ;$2 = ID
 ;$3 = Command
 ;$4- = Parameters
 if ($3 == !admin) || ($3 == !admins) {
   var %aa = 0,%bb,%cc,%dd
   while (%aa <= $mta.server($1).cmax) {
     if ($readini($scriptdir $+ admin.ini,ADMIN,$mta.nick($1,%aa)) >= 2) {
       if (!%bb) %bb = $mta.nick($1,%aa)
       elseif ($numtok(%bb,32) <= 7) %bb = %bb  $mta.nick($1,%aa)
       elseif (!%cc) %cc = $mta.nick($1,%aa)
       elseif ($numtok(%cc,32) <= 7) %cc = %cc  $mta.nick($1,%aa)
       elseif (!%dd) %dd = $mta.nick($1,%aa) 
       elseif ($numtok(%dd,32) <= 7) %dd = %dd  $mta.nick($1,%aa)
     }
     !inc %aa
   }
   if (%bb) {
     mta.text $1 Online Admin(s): %bb
     if (%cc) mta.text $1 %cc
     if (%dd) mta.text $1 %dd
   }
   else mta.text $1 There are no online admins.
 }
 elseif ($3 == !setlvl) || ($3 == !setlevel) {
   if ($gus.level($1,$2) >= 10) {
     if ($4 && $5) {
       if ($4 && $5 isnum) {
         if ($5 >= $gus.level($1,$2)) mta.pm $1 $2 Error - Cannot set a level higher or equal to yours
         else {
           if (%a == -1) mta.pm $1 $2 Error - Absent ID
           else {
             mta.text $1 $mta.nick($1,%a) $+ 's Level changed from $gus.level($1,%a) to $5
             !writeini -n " $+ $scriptdir $+ admin.ini" ADMIN $mta.nick($1,%a) $5
             !writeini -n " $+ $scriptdir $+ admin.ini" IP $mta.nick($1,%a) $mta.ip($1,%a)
           }
         }
       }
       else mta.pm $1 $2 Error - Syntax: $3 
     }
     else mta.pm $1 $3 Error - Syntax: $3 
   }
   else mta.pm $1 $2 Error - You need to be level 10 to use this command
 }
 elseif ($3 == !set) {
   if ($readini($scriptdir $+ admin.ini,SET,SET) == $null) {
     !writeini -n " $+ $scriptdir $+ admin.ini" SET SET 1
     !writeini -n " $+ $scriptdir $+ admin.ini" ADMIN $mta.nick($1,$2) 10
     !writeini -n " $+ $scriptdir $+ admin.ini" IP $mta.nick($1,$2) $mta.ip($1,$2)
     !writeini -n " $+ $scriptdir $+ options.ini" OPTIONS maker $mta.nick($1,$2)
     mta.text $1 Nick " $+ $mta.nick($1,$2) $+ " Added with Admin Level 10
     mta.pm $1 $2 Type !setupload to add a Upload URL!
     mta.pm $1 $2 Type !setwelcomemsg to add a Welcome Message!
   }
   else mta.pm $1 $2 Error - You can only use this command once!
 }
}


on *:SIGNAL:mta.join: {
 !writeini -n " $+ $scriptdir $+ alias.ini" GETIP $mta.nick($1,$2) $mta.ip($1,$2)
 !writeini -n " $+ $scriptdir $+ alias.ini" GETNICK $mta.ip($1,$2) $mta.nick($1,$2)
 !writeini -n " $+ $scriptdir $+ stats.ini" VISITS $mta.nick($1,$2) $gus.add($gus.visits($1,$2),1)
 if ($gus.level($1,$2) == $null) !writeini -n " $+ $scriptdir $+ admin.ini" ADMIN $mta.nick($1,$2) 1
 if ($gus.level($1,$2) >= 2) {
   if ($readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2)) == $null) !writeini -n " $+ $scriptdir $+ admin.ini" IP $mta.nick($1,$2) $mta.ip($1,$2)
   elseif ($readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2))) {
     if ($gettok($mta.ip($1,$2),1-2,46) isin $readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2))) {
       mta.text $1 Welcome Back $mta.nick($1,$2)
     }
     else {
       mta.text $1 $mta.nick($1,$2) - Invalid IP Match
       mta.kick $1 $2
     }
   }
 }
}

on *:SIGNAL:mta.nick: {
 ;Parameters:
 ;$1 = Server
 ;$2 = ID
 !writeini -n " $+ $scriptdir $+ alias.ini" GETIP $mta.nick($1,$2) $mta.ip($1,$2)
 !writeini -n " $+ $scriptdir $+ alias.ini" GETNICK $mta.ip($1,$2) $mta.nick($1,$2)
 !writeini -n " $+ $scriptdir $+ stats.ini" VISITS $mta.nick($1,$2) $gus.add($gus.visits($1,$2),1)
 if ($gus.level($1,$2) >= 2) {
   if ($readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2)) == $null) !writeini -n " $+ $scriptdir $+ admin.ini" IP $mta.nick($1,$2) $mta.ip($1,$2)
   elseif ($readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2))) {
     if ($gettok($mta.ip($1,$2),1-2,46) isin $readini($scriptdir $+ admin.ini,IP,$mta.nick($1,$2))) {
       mta.text $1 $mta.nick($1,$2) Logged into Admin. (Level: $gus.level($1,$2) $+ )
     }
     else {
       mta.text $1 $mta.nick($1,$2) - Invalid IP Match
       mta.kick $1 $2
     }
   }
 }
}

but still .. when this works you'll have a admin thing

but no admin commands :P

example

place this in the on *:command section before the last closing }

 elseif ($3 == !kick) {
   if ($gus.level($1,$2) >= 5) {
     if (%a == -1) mta.pm $1 $2 Error - Absent ID
     elseif (%a == $2) mta.pm $1 $2 Error - Cannot $3 yourself
     elseif ($gus.level($1,%a) >= $gus.level($1,$2)) mta.pm $1 $2 Error - You cannot $3 a preson with the same or higer level.
     else mta.kick $1 %a
   }
   else mta.pm $1 $2 Error - You need to be level 3 to use this command
 }

(tnx to tommis for this script)

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...