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.