|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
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.
|
|
|
|
Joined: Jan 2007
Posts: 259
Fjord artisan
|
Fjord artisan
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.
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
Joined: Feb 2007
Posts: 91 |
maybe you can say web page where i can request scripts? but i still hope someone will help here
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Since I feel like being generous, here's a simple one for you.
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
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
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.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Typo thanks to copying part from another script of mine...
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
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
Joined: Feb 2007
Posts: 91 |
|
|
|
|
Joined: Jan 2007
Posts: 280
Fjord artisan
|
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.
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
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.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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
|
|
|
|
Joined: Jul 2006
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jul 2006
Posts: 107 |
Using mIRC v6.16, I got an error msg /filter: invalid parametersand just had to change filter -ffcuten 2 32 hash.tmp to filter -ffcuten 2 32 hash.tmp hash.tmp (I was curious about that, as Duxxie said it worked.)
LonDart
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You're right. I copy/pasted and yet somehow didn't copy that twice.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
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.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Ok, figured it out now that I could test it. Sorry for the inconvenience.
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
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
Joined: Feb 2007
Posts: 91 |
now it shows all places 1/9999 or 1/9900 but i have about 10 users added
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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
|
|
|
|
Joined: Feb 2007
Posts: 91
Babel fish
|
OP
Babel fish
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
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
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. Change:
msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ %points with $gettok(%data,2,32) points
To:
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
|
|
|
|
Joined: Jul 2006
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jul 2006
Posts: 107 |
change msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ %points with $gettok(%data,2,32) points back to msg $chan $hget(TopScores,$gettok(%data,1,32)).item is 1/ $+ $hget(TopScores,0).item with $gettok(%data,2,32) points
LonDart
|
|
|
|
|