I have a hash table that has numbers as items and nicknames as data, the hash table is called helpreqs. Its a quite short help query script to make "turns" for people in a channel. theres also another hash tables where I have the helpers, there the items are nicknames and the data is a 1 only to check if it exists.
The problem is that I created a command that should read a query window and if the messager is in the helpers list it should voice the next N data items in 'helpreqs' and sort the hash table.
Should work like this: pnn N , where N is the number of people to voice.
Heres the code:
on 1:TEXT:*:?:{
if ( hlogin == $1 ) {
if ( $2 == %helperpass) {
hadd -sm helpers $nick 1
msg $nick Helper $nick added succesfully
halt
}
}
}
on 1:TEXT:*:?:
if ( pnn isin $1 ) {
var %hnum = $2
if ( $hfind(helpers,$nick).data !== $null) {
var %i = 1
while (%i <= %hnum) {
mode #newbiehelp +m $hfind(helpreqs,%i).data
inc %i
}
var %i = 1
while (%i <= $hget(helpreqs,0).item ) {
hadd -s helpreqs %i $hfind(helpreqs,(%i + 1)).data
hdel -s helpreqs (%i + 1)
inc %i
}
}
}
Anyone has an idea why this is not working?
Thanks
[EDIT]
The main problem is that it wont add anything to the helpers table. Im not sure why isnt it reading the query.
Well maybe im missing some information so you can understand how I tried to work this.
Code for when people joins
on *:join:#newbiehelp:
if ($hfind(helpreqs,$nick).data !== $null) {}
else {
/hadd -ms helpreqs ( $hget(helpreqs,0).item + 1) $nick
/echo -st $nick added to list
}