Jump to content

New to scripting, need help.


PoLiNi

Recommended Posts

Hey,

I'm having a join challenge for a clan. And the challenge is to make a script.

---

Script:

When there are no admins in the server and there is someone cheating than a player has to be able to type something like !admin *Name* uses cheats.

Than the first admin who comes online after this message has been typed by one or more players, he will recieve the message, and at what time it was sent. This PM has to been send when there 40% of the players that are in the server have used this command.

When the first admin that has been arrived recieves this message, the message shouldn't be sent to other admins who arrive later in the server, so it has to be deleted...

---

Now i don't know at all what and how i should make this script. The only thing i know that it has to be used on a MTA:SA DD server.

If anyone can give me some advice, what language I should use and which programme or whatever I should use and can tell me where i should look, than i will try to make a script and after that I will post it here.

Thanks alot already,

Polini

Link to comment

Okay, i'm almost finished. I got a little copy from some1 else, though 2 things i dont understand yet...

on *:SIGNAL:mta.start:command 
if ($2 == The script has started succesfully) { 
$mta.console Started the cheat pm script. 
} 
on *:SIGNAL:mta.command: { 
if ($1 == !admin $mta.nick) { 
var %cheat1 = (admin-cheat$1,$2) != $readini($mta.nick,Cheater($1,$2) 
else  
} 
on *:SIGNAL:mta.pm:command { 
if ($4- == !admin $mta.nick) { 
var %cheat1 = (admin-cheat$1,$2) != $readini($mta.nick,Cheater($1,$2) $mta.pm * PM Sent to Admin : Hello admin, the player named $mta.nick is or was cheating, could you please ban him? 
} 
on *:SIGNAL:mta.login:command 
if ($2 == !checkpm ) { 
var %pm = (pm,$1,$2) != $readini($mta.nick,pm($1,$2) 
else 
var %pm = (pm,$1,$2) != $readini($mta.nick,pm($1,$2) $mta.pm At the moment you don't have any messages. 
var %pm = (pm,$1,$2) != $readini($mta.nick,pm($1,$2) Hello admin, $mta.nick was or is cheating, could you please ban him?!} 
} 
on *:SIGNAL:mta.addban:command 
if ($2 == !ban $mta.ip,$mta.nick ) { 
} 
$mta.text Name: $mta.nick IP: $mta.ip has been banned from the server! 
} 
} 

There is 1 thing I doubt about and 1 thing i dont understand (the copied part)

First the thing i dont understand.

The $readini command, is this a command which is for reading the admins inbox?

Now the 2nd part, and thats about my last part of the script with the addban command.

I would like to have when the script bans the ip AND the nickname of the player at the same time. So i've done it like this

on *:SIGNAL:mta.addban:command 
if ($2 == !ban $mta.ip,$mta.nick ) { 
} 
$mta.text Name: $mta.nick IP: $mta.ip has been banned from the server! 
} 
} 

however i dont know if its possible to put $mta.ip and $mta.nick into one ban command

Please tell me how my script is and eventually make some fixes into it? :D

Link to comment

hi, u look like youve been busy and i guess by now ur probably pulling ur hair out trying to make this.

im working at the moment, but when i get online later, i'll write this for u (since it will be much faster than trying to explain)

coz i can tell u have no idea what ur doing. 10/10 for effort tho.

Link to comment

ok, here goes. this script should work for anyone else who needs it.

just paste into a .mrc file and load it with mirc.

on *:SIGNAL:mta.connect: { 
  .timershowtext 0 600 showtext $1 
} 
alias showtext { 
  if ($mta.server($1).players > 1) mta.text $1 Report cheaters to an admin with !report 
} 
alias get.playerid { 
  if ($3 == $null) !return $2  
  var %a = 0 
  while (%a < $mta.server($1).cmax) { 
    if ($3 isin $mta.nick($1,%a)) !return %a 
    !inc %a 
  } 
  !return -1 
} 
on *:SIGNAL:mta.command: { 
  var %a = $get.playerid($1,$2,$4) 
  if ($3 == !report) { 
    if (!$4) { 
      mta.pm $1 $2 To report a cheater/modder  
      .timer 1 1 mta.pm $1 $2 type !report <name> <reason> 
    } 
    else reportplayer $1 $2 %a $5- 
  } 
  elseif ($3 == !banip) banip $1 $4 
  elseif ($3 == !unbanip) unbanip $1 $4 
  elseif ($3 == !shownewmsg) shownewmsg $1- 
  elseif ($3 == !showoldmsg) showoldmsg $1- 
  elseif ($3 == !reports) mta.pm $1 $2 Total Reports - New: $totalnewmsgs - Old: $totaloldmsgs 
  elseif ($3 == !remold) deletereports $1 $2 Old 
  elseif ($3 == !remnew) deletereports $1 $2 New 
  elseif ($3 == !remall) deletereports $1 $2 All 
  elseif ($3 == !extra) extra $1 $2 
} 
alias deletereports { 
  if ($mta.level($1,$2) < 5) mta.pm $1 $2 Error: level 5 Command 
  else { 
    if ($3 == new) !remini -n " $+ $scriptdirReports.ini" newmsg 
    elseif ($3 == old) !remini -n " $+ $scriptdirReports.ini" oldmsg 
    else !remove " $+ $scriptdirReports.ini"  
    mta.pm $1 $2 $iif($3 == all,All Msgs Removed.,All $3 Msgs Removed.) 
  } 
} 
alias reportplayer { 
  if (!$4) mta.pm $1 $2 Error: Specify Reason, !report <name> <reason> 
  elseif ($2 == $3) mta.pm $1 $2 Error: Cannot Report Self 
  elseif ($3 == -1) mta.pm $1 $2 Error: No Such Player 
  else { 
    !writeini -n " $+ $scriptdirReports.ini" newmsg $calc($totalnewmsgs + 1) $mta.nick($1,$2) $+ ( $+ $mta.ip($1,$2) $+ ) Reported $mta.nick($1,$3) $+ ( $+ $mta.ip($1,$3) $+ ) - Reason: $4- 
    mta.pm $1 $2 $mta.nick($1,$3) Reported. 
  } 
} 
alias banip { 
  if ($mta.level($1,$2) > 0) { 
    if (*.*.*.* isin $4) { 
      mta.addban $1 $4 
      mta.pm $1 $2 The IP $4 Is Now banned. 
    } 
  } 
  else mta.pm $1 $2 Admins Only 
} 
alias unbanip { 
  if ($mta.level($1,$2) > 0) { 
    if (*.*.*.* isin $4) { 
      mta.unban $1 $4 
      mta.pm $1 $2 The IP $4 Is Now Unbanned. 
    } 
  } 
  else mta.pm $1 $2 Admins Only 
} 
alias totalnewmsgs !return $iif($ini($scriptdirreports.ini,newmsg,0) == $null,0,$v1) 
alias totaloldmsgs !return $iif($ini($scriptdirreports.ini,oldmsg,0) == $null,0,$v1)  
on *:SIGNAL:mta.login: { 
  if ($4 == 0) {  
    .timer 1 5 mta.pm $1 $2 You Have $iif($totalnewmsgs == 0,No,$v1) New $iif($totalnewmsgs == 1,Message,Messages) 
    if ($totalnewmsgs != 0) .timer 1 8 mta.pm $1 $2 type !shownewmsg to see the next message in order. 
    .timer 1 30 mta.pm $1 $2 type !extra to see extra commands. 
  } 
} 
 alias extra { 
  var %a == $mta.level($1,$2)  
  mta.pm $1 $2 Extra Commands: !report $iif(%a > 0,!reports !shownewmsg !showoldmsg !banip !unbanip) 
  if (%a > 0) .timer 1 5 mta.pm $1 $2 !remold !remnew !remall 
} 
alias shownewmsg { 
  if ($mta.level($1,$2) > 0) { 
    if ($totalnewmsgs == 0) mta.pm $1 $2 No New Messages 
    else { 
      !writeini -n " $+ $scriptdirReports.ini" oldmsg $calc($totaloldmsgs + 1) $readini($scriptdirReports.ini,newmsg,$totalnewmsgs) 
      mta.pm $1 $2 Msg: $readini($scriptdirReports.ini,newmsg,$totalnewmsgs) 
      !remini -n " $+ $scriptdirReports.ini" newmsg $totalnewmsgs 
    } 
  } 
  else mta.pm $1 $2 Admins Only! 
} 
alias showoldmsg { 
  if ($mta.level($1,$2) > 0) { 
    if (($4 isnum) && ($4 > 0) && ($4 <= $totaloldmsgs)) mta.pm $1 $2 MSG No. $+ $4 $+ : $readini($scriptdirReports.ini,oldmsg,$4) 
    else { 
      mta.pm $1 $2 Total Old Msgs: $totaloldmsgs 
      if ($totaloldmsgs > 0) .timer 1 1 mta.pm $1 $2 type !showoldmsg $iif($totaloldmsgs == 1,1,<1- $+ $totaloldmsgs $+ >) 
    } 
  } 
  else mta.pm $1 $2 Admins Only! 
} 

general commands are listed in the script but heres a quick rundown:

!report - for anyone to report a player - records users name+IP, reported players name+ip and reason

!banip - for an admin to ban an ip

!unbanip - for an admin to unban an ip

!shownewmsg - to view new reports

!showoldmsg - to view selected old reports

!reports - to show how many reports are stored, new and old

!remold - to remove all old reports

!remnew - to remove all new reports

!remall - to remove all new and old reports

!extra - to list the extra commands listed here.

any probs, post here. hope this is ok for u. :)

Link to comment
  • Recently Browsing   0 members

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