Hey, so I'm trying to code everything myself to learn better, and I'm sure there's some copy/paste option out there but that's not what I'm looking for. I'm trying to make a code system, where !addcode <code> and !remcode <code> edit the Codes.ini, and !redeem <code> triggers either a redeem, an 'this has already been used', or an 'this code doesn't exist.'
alias lookUpCode {
var %code $2
var %status $readini(Codes.ini,%code,Status)
return %status
}
alias doAddCode {
var %code $2
writeini -n Codes.ini %code status true
}
alias doRemCode {
var %code $2
writeini -n Codes.ini %code status false
}
on *:TEXT:*!redeem*:#atkion:{
var %status lookUpCode($$2)
if (%status == true) {
msg $chan $nick has just redeemed code $$2!
doRemCode($$2)
}
elseif (%status == false) {
msg $chan $nick , that code has already been used!
}
else {
msg $chan $nick , that code doesn't exist! The format for this command is !redeem <code>.
}
}
on 2:TEXT:!addcode*:#atkion:{
doAddCode($$2)
msg $chan Code $$2 successfully added!
}
on 2:TEXT:!remcode*:#atkion:{
doRemCode($$2)
msg $chan Code $$2 successfully removed!
}
As it is right now, the !addcode returns positive but doesn't edit the .ini, and !redeem always returns 'this doesn't exist', regardless of whether it's in the file.
Thanks in advance for any help! And sorry again for how much of a noob I am.