mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Ok, I am currently stuck on a little thing I am working on, As the title entails, its a 'warning' system, Basically when someone types !warn <user> it will either warn them or say you need to input a name if you have set it to null, another feature !rwarn you can add a reason for warning someone, it can go up to as many words as you wish, if you want to copy, by default it has 10 words max this feature also has a timestamp with date. (thanks to sakana) The final feature is !listwarns <user> where it tell you how many warnings the user has.

Here is my main problem which I don't see what's going wrong. In the 'console' it inputs this

Code:
/writeini: insufficient parameters (line 21, script3.ini)


Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings $calc(%val + %add)
  if (%val($2) == 3) {
    msg $chan %user has had the maximum warnings!  Timing out the %user
    msg $chan /timeout 600 $2
  }
  else (%user)
  msg $chan %user has been warned
  writeini -n warns.ini %user warnings $calc(%val + %add)
  timeout 1
}

// On join load warnings
ON *:JOIN:#: {
  var %user = $nick
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings %val
}

// Add warning reason plus time
ON 4:TEXT:!rwarn*:#: { 
  var %user = $2
  var %date = Day: $day Date: $date Time: $time 
  var %reason = $3 $4 $5 $6 $7 $8 $9 $10
  writeini -n rwarn.ini %user timestamp %date Reason %reason
}


That is my full code (discluding the !listwarns), I have several issues (Keep in mind, most thing's I have made is with help.), For starters when someone types for example "!warnlist michaelukz" it outputs '
michaelukz has been warned'

This is what I wish for main help with >

Code:
// On join load warnings
ON *:JOIN:#: {
  var %user = $nick
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings %val
}
< That outputs the first error
Code:
/writeini: insufficient parameters (line 21, script3.ini)


The other problem with this batch is the else's do not seem to work at all.

Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Here is my !listwarns commands

Code:
// Checks warnings
ON 3:TEXT:!listwarns $:#: {
  var %user = $2
  var %warns = $readini(warns.ini, %user, warnings)
  if (%user) == null {
    msg $chan Please type a users name!
  }
  else { 
    msg $chan /me $2 has %warns warnings!
  }
}


Currently it seems to do nothing also, I had it working but I wished to add the if and else, and it seemed to break, Again this is my first time with if and else statements

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Try this guide

http://en.wikichip.org/wiki/mirc/commands/writeini

Also seems like you have some wrong syntax.

For example
Code:
else (%user)


Do you mean
Code:
elseif (%user) {
?

Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Everything works except the alert

Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini( warns.ini, %user, warnings )
  writeini -n warns.ini %user warnings $calc(%val + 1)
  if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Code:
  if (%val == $3) { msg $chan %user has had the maximum warnings! }

maybe that's supossed to be 3?
Code:
  if (%val == 3) { msg $chan %user has had the maximum warnings! }


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
I had had it at 3 and yet it still did nothing so was testing if it was similiar to $null not null

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Originally Posted By: michaelukz
Everything works except the alert

Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini( warns.ini, %user, warnings )
  writeini -n warns.ini %user warnings $calc(%val + 1)
  if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}

Its worth noting that you are setting %val before incriminating the number of warns that the person has received.

Also the if/elseif are weird. What are you actually attempting to do here?

Last edited by Belhifet; 01/02/15 07:05 PM.
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Code:
if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}


The if being if it has more than 3 warnings message "%user has had the maximum warnings!" else just add one to the warnings.

Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
*Bump*

Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
*Rebump*

Anyone got a fix?

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
if (%val >= 3) { msg $chan %user has had the maximum warnings! }
else {


Link Copied to Clipboard