mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Points system with top5 #171699 27/02/07 08:31 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
I need a snippet so a admin can type !addpoint nick 3 and it will add 3 points to a user.. also for !addpoint nick 2 and !addpoint nick 1 .. More i need !delpoint nick 3 !delpoint nick 2 and !delpoint nick 1 or !delpoint nick all - then it deletes all points.. also !delpoints - clears all points.. And when some user types !top5 it shows.

1. nick is 1/204 with 23 points(204 is number of total users that have any point)
2. nick is 2/204 with 22 points
3. nick is 3/204 with 21 points
4. nick is 4/204 with 20 points
5. nick is 5/204 with 19 points

Last edited by spermis; 27/02/07 11:27 PM.
Re: Points system with top5 [Re: spermis] #171700 27/02/07 08:33 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
This isn't a script request forum. We help you making a script, we don't usually make them for you.
Try /help, /help if, /help set, /help on text. That should be enough to get you started.


Those who can, cannot. Those who cannot, can.
Re: Points system with top5 [Re: Kardafol] #171709 27/02/07 11:26 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
maybe you can say web page where i can request scripts? but i still hope someone will help here

Re: Points system with top5 [Re: spermis] #171712 28/02/07 12:12 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The Hawkee website has a script request forum, however, it is best if you try to write the script yourself. The help file really is of help (unlike some I've seen).

Also please note that requests like yours have been done before, so you'd be smart to search the site and/or the internet (I suggest using Google) for scripts like yours.

Re: Points system with top5 [Re: spermis] #171726 28/02/07 04:44 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Since I feel like being generous, here's a simple one for you.

Code:
on *:start: {
  hmake TopScores 100
  if ($isfile($scriptdir\topscores.hsh)) { hload TopScores $qt($scriptdir\topscores.hsh) }
}

on *:text:!addpoint & &:#: {
  if ($nick isop $chan && $3 isnum) {
    hadd TopScores $2 $calc($hget(TopScores,$2) + $3)
    .notice $nick Added $3 points to $2 $+ .
  }
  hsave TopScores $qt($scriptdir\topscores.hsh)
}

on *:text:!delpoint & &:#: {
  if ($nick isop $chan) {
    if ($3 isnum) {
      hadd TopScores $2 $iif($calc($hget(TopScores,$2) - $3) >= 0,$v1,0)
      .notice $nick Subtracted $3 points from $2 $+ .
    }
    elseif ($3 == all) {
      hadd TopScores $2 0
      .notice $nick Removed ALL points from $2 $+ .
    }
    hsave TopScores $qt($scriptdir\topscores.hsh)
  }
}

on *:text:!top5:#: {
  if (%Top5.fld) { return }
  set -u10 %Top5.fld On
  filter -ffcuten 2 32 hash.tmp
  var %cnt = 1
  while (%cnt <= 5) {
    var %data = $read(hash.tmp,%cnt)
    msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ $hget(TopScores,0).item with $gettok(%data,2,32) points
    inc %cnt
  }
  .remove hash.tmp
}


This allows all ops or higher to use the add/del commands. If you want only admins to use it, you'll need to put them into your userlist and then make the script work from the userlist instead.

Keep in mind that 5 lines displayed all at once *could* get you flooded off the server. It's set up to not allow more than 1 Top5 display every 10 seconds (-u10), but just displaying the 5 may be too much on certain networks. Just try and you'll know.

I didn't bother adding error messages. It checks to prevent errors, but it won't tell the user that there was an error. If you want that and can't add it yourself, just say so and I or someone else will do it.


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: Riamus2] #171731 28/02/07 07:17 AM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
when typing !top5 nothing happens.. i added 5 users with !addpoints nick points but still nothing happens.
Ok i got another script

Last edited by spermis; 28/02/07 09:20 AM.
Re: Points system with top5 [Re: spermis] #171747 28/02/07 02:19 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Typo thanks to copying part from another script of mine...

Code:
on *:start: {
  hmake TopScores 100
  if ($isfile($scriptdir\topscores.hsh)) { hload TopScores $qt($scriptdir\topscores.hsh) }
}

on *:text:!addpoint & &:#: {
  if ($nick isop $chan && $3 isnum) {
    hadd TopScores $2 $calc($hget(TopScores,$2) + $3)
    .notice $nick Added $3 points to $2 $+ .
  }
  hsave TopScores $qt($scriptdir\topscores.hsh)
}

on *:text:!delpoint & &:#: {
  if ($nick isop $chan) {
    if ($3 isnum) {
      hadd TopScores $2 $iif($calc($hget(TopScores,$2) - $3) >= 0,$v1,0)
      .notice $nick Subtracted $3 points from $2 $+ .
    }
    elseif ($3 == all) {
      hadd TopScores $2 0
      .notice $nick Removed ALL points from $2 $+ .
    }
    hsave TopScores $qt($scriptdir\topscores.hsh)
  }
}

on *:text:!top5:#: {
  if (%Top5.fld) { return }
  set -u10 %Top5.fld On
  hsave TopScores hash.tmp
  filter -ffcuten 2 32 hash.tmp
  var %cnt = 1
  while (%cnt <= 5) {
    var %data = $read(hash.tmp,%cnt)
    msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ $hget(TopScores,0).item with $gettok(%data,2,32) points
    inc %cnt
  }
  .remove hash.tmp
}


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: Riamus2] #171759 28/02/07 05:54 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
still doesnt work

Re: Points system with top5 [Re: spermis] #171760 28/02/07 06:06 PM
Joined: Jan 2007
Posts: 280
DuXxXieJ Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2007
Posts: 280
With my mIRC (i've tested it) it works.
Maybe you need to paste it in a new file, or maybe is your remote off? (/remote on)


Squee whenever a squee squee's. Squee whenever a squee does not squee.
Re: Points system with top5 [Re: DuXxXieJ] #171764 28/02/07 07:16 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
i pasted in new file, typed /remote on.. still dont work

i created a .mrc file and typed /load -rs points.mrc also. but dont work. it adds points and removes them but when i type top5 it just dont show..

Last edited by spermis; 28/02/07 07:21 PM.
Re: Points system with top5 [Re: spermis] #171771 28/02/07 10:10 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Check for any error messages (status window and active). Even if it wasn't working correctly, you would still see something messaged to the channel. You *are* typing !top5 from somewhere other than the client running the script, right? I assume you are because you said the adding/subtracting works, but I have to ask.

If nothing else, put an ECHO line as the first line after the on TEXT in the !top5 part. Something simple, such as:

echo -a WORKS

Try the trigger (!top5) and see if it echoes. If it does, move the line down one line and test. Keep doing this until you don't get an echo. This will tell you where the problem is located.

And, just double check that you are in fact using the latest version I posted.

As another option, install a clean copy of mIRC in another folder and test it there. Then you can see if perhaps it's because of a conflict with another script that you have.


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: spermis] #171777 28/02/07 10:38 PM
Joined: Jul 2006
Posts: 107
L
LonDart Offline
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
Using mIRC v6.16, I got an error msg /filter: invalid parameters

and just had to change
Code:
filter -ffcuten 2 32 hash.tmp

to
Code:
filter -ffcuten 2 32 hash.tmp hash.tmp


(I was curious about that, as Duxxie said it worked.)


LonDart
Re: Points system with top5 [Re: LonDart] #171786 01/03/07 03:17 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
You're right. I copy/pasted and yet somehow didn't copy that twice. frown


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: Riamus2] #171804 01/03/07 10:38 AM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
I checked that im using last version about 5 times. now checking
filter -ffcuten 2 32 hash.tmp hash.tmp

EDIT:
YAY! Thanks. It works

EDIT2:
is 1/8 with 1000 points
nick is 1/8 with 998 points
nick2 is 1/8 with 997 points
nick3 is 1/8 with 996 points
is 1/8 with 995 points

See - it shows all 1/8 and first and last place dont show nick

Last edited by spermis; 01/03/07 10:50 AM.
Re: Points system with top5 [Re: spermis] #171816 01/03/07 02:23 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Ok, figured it out now that I could test it. Sorry for the inconvenience.

Code:
on *:start: {
  hmake TopScores 100
  if ($isfile($scriptdir\topscores.hsh)) { hload TopScores $qt($scriptdir\topscores.hsh) }
}

on *:text:!addpoint & &:#: {
  if ($nick isop $chan && $3 isnum) {
    hadd TopScores $2 $calc($hget(TopScores,$2) + $3)
    .notice $nick Added $3 points to $2 $+ .
  }
  hsave TopScores $qt($scriptdir\topscores.hsh)
}

on *:text:!delpoint & &:#: {
  if ($nick isop $chan) {
    if ($3 isnum) {
      hadd TopScores $2 $iif($calc($hget(TopScores,$2) - $3) >= 0,$v1,0)
      .notice $nick Subtracted $3 points from $2 $+ .
    }
    elseif ($3 == all) {
      hadd TopScores $2 0
      .notice $nick Removed ALL points from $2 $+ .
    }
    hsave TopScores $qt($scriptdir\topscores.hsh)
  }
}

on *:text:!top5:#: {
  if (%Top5.fld) { return }
  set -u10 %Top5.fld On
  hsave -n TopScores hash.tmp
  filter -ffcuten 2 32 hash.tmp hash.tmp
  var %cnt = 1, %points
  var %total = $hget(TopScores,0).item
  while (%cnt <= %total) {
    inc %points $hget(TopScores,%cnt).data
    inc %cnt
  }
  var %cnt = 1
  while (%cnt <= 5) {
    var %data = $read(hash.tmp,%cnt)
    msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ %points with $gettok(%data,2,32) points
    inc %cnt
  }
  .remove hash.tmp
}


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: Riamus2] #171822 01/03/07 03:11 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
now it shows all places 1/9999 or 1/9900 but i have about 10 users added

Re: Points system with top5 [Re: spermis] #171827 01/03/07 06:52 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Try removing the hash data as it's working fine here. Go into your script's folder and find TopScores.hsh and delete it. Then, either restart mIRC or else type:

/hfree TopScores
/hmake TopScores 100

Then add your people and scores and try the !top5 listing.

Also, make sure that you don't have the hash.tmp file in your mIRC folder.


Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: Riamus2] #171830 01/03/07 07:43 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
|| 21:42:32 || <@tram> riitmm is 1/1188 with 992 points
|| 21:42:32 || <@tram> hashdshd is 1/1188 with 93 points
|| 21:42:32 || <@tram> ahahs is 1/1188 with 92 points
|| 21:42:32 || <@tram> triljalja is 1/1188 with 9 points
|| 21:42:32 || <@tram> aahhs is 1/1188 with 2 points

dont showing place but at least it shows 992 on first place and 2 points on last

Re: Points system with top5 [Re: spermis] #171839 01/03/07 08:26 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Oh, I see what you're saying. I have *no* idea why I didn't see that or why I did that. I hardcoded "1" as the rank. frown

Change:
Code:
    msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ %points with $gettok(%data,2,32) points



To:
Code:
    msg $chan $hget(TopScores,$gettok(%data,1,32)).item is %cnt $+ / $+ %points with $gettok(%data,2,32) points



Invision Support
#Invision on irc.irchighway.net
Re: Points system with top5 [Re: spermis] #171841 01/03/07 08:30 PM
Joined: Jul 2006
Posts: 107
L
LonDart Offline
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
change
Code:
msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ %points with $gettok(%data,2,32) points

back to
Code:
msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ $hget(TopScores,0).item with $gettok(%data,2,32) points



LonDart
Page 1 of 2 1 2