mIRC Home    About    Download    Register    News    Help

Print Thread
#245589 28/04/14 08:56 PM
Joined: Apr 2014
Posts: 19
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Apr 2014
Posts: 19
I added a point system and I was hoping someone would know how I could check how many points someone has.

This is what I have so far:

alias -l addPoints {
if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
var %topic $+($chan,.,$nick)
var %points $calc($readini(Points.ini,%topic,Points) + $1)
writeini -n Points.ini %topic Points %points
return %points
}

alias -l lookUpPoints {
var %topic $+($chan,.,$nick)
var %points $readini(Points.ini,%topic,Points)
return %points
}
alias doaddpoints {
if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
var %topic $+($1,.,$2)
var %points $calc($readini(Points.ini,%topic,Points) + $3)
writeini -n Points.ini %topic Points %points
echo -a Added points for %topic
}

alias dorempoints {
var %topic $+($1,.,$2)
remini -n Points.ini %topic Points
echo -a Removed points for %topic
}

on *:text:!points:#:{
if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
set -u10 %floodpoints On
set -u30 %floodpoints. $+ $nick On
msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

on $*:text:/!points (add|remove)/Si:#:{
if ($nick isop #) {
if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
{ msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. }
}
else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

Joined: Nov 2013
Posts: 19
D
Pikka bird
Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
You type !points inside the chat, it's reading off a .ini file inside of your mIRC directory called Points.ini.

Joined: Apr 2014
Posts: 19
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Apr 2014
Posts: 19
I mean, is there a script to check how many points someone else has without them using the command themselves or manually opening the ini file?

Last edited by RapidHaste; 28/04/14 10:04 PM.
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
This is untested... Let me know if it works or not. If not I'll do a little debugging wink

Just do !points nickhere

Code:
on *:text:!points *:#:{
if ((%floodpoints) || ($($+(%,floodpoints.,$2),2))) { return }
set -u10 %floodpoints On
set -u30 %floodpoints. $+ $nick On 
msg # $2 has $readini(Points.ini,$+(#,.,$2),Points) total points. 
}

Last edited by Bramzee; 28/04/14 10:40 PM.
Joined: Apr 2014
Posts: 19
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Apr 2014
Posts: 19
It works wonderfully, thank you very much!

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
It won't work with the add|remove... Just tried.

The fix:

!pointcheck NICK

Code:
on *:text:!pointcheck *:#:{
if ((%floodpointcheck) || ($($+(%,floodpointcheck.,$2),2))) { return }
set -u10 %floodpointcheck On
set -u30 %floodpointcheck. $+ $nick On 
msg # $2 has $readini(Points.ini,$+(#,.,$2),Points) total points. 
}


I would also suggest changing the normal !points to !pointcheck to avoid confusion... But, that's just me.

Code:
on *:text:!pointcheck:#:{
  if ((%floodpointcheck) || ($($+(%,floodpointcheck.,$nick),2))) { return }
  set -u10 %floodpointcheck On
  set -u30 %floodpointcheck. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

Last edited by Bramzee; 28/04/14 11:12 PM.
Joined: Apr 2014
Posts: 19
R
Pikka bird
OP Offline
Pikka bird
R
Joined: Apr 2014
Posts: 19
Is there a way to make it so that only moderators can use this command?

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Untested, but this should work... If not, let me know and I'll figure it out.

Code:
on *:text:!pointcheck *:#:{
if ($nick isop #) {
if ((%floodpointcheck) || ($($+(%,floodpointcheck.,$2),2))) { return }
set -u10 %floodpointcheck On
set -u30 %floodpointcheck. $+ $nick On 
msg # $2 has $readini(Points.ini,$+(#,.,$2),Points) total points. 
}
if ($nick !isop #) {
    msg $chan $nick -> You don't have permission to do that. Sorry.
  }
}

Last edited by Bramzee; 28/04/14 11:44 PM.

Link Copied to Clipboard