This is a code meant to allow users to give each other karma, and take it away as well. It also self-limits; you can only give or take karma once each per hour.
Issues:
1) This code does not like dynamic IPs, just like any code that uses $address as a dynamic variable.
2) in the rare event that the person with top karma is de-karma'd below the person with bottom karma this code will not correct it. simply karma someone else higher than bottom karma to remedy it. same for if the person with bottom karma is karma'd above top karma.
/*
############ KARMA by PonyToast ##################
*/
;optional help module
on *:text:!help karma:*: {
Notice $nick KARMA by PONYTOAST
Notice $nick -karma (Check your karma)
Notice $nick -karma <nick> (check someone else's karma)
Notice $nick <nick>++ (give karma)
Notice $nick <nick>-- (Remove Karma)
Notice $nick -kreset (Reset hour-cooldowns for everyone. Halfops and above)
}
; a name followed by ++ triggers this command. It will not work for non-nicknames
on *:TEXT:*++:#: {
; a name followed by -- triggers this command. It will not work for non-nicknames
set %karmatarget $remove($$1,++)
if (%plus. [ $+ [ $address($nick,2) ] ] = 1) {
msg $chan $nick $+ :You cannot give positive karma for another $duration($calc(%plustime. [ $+ [ $address($nick,2) ] ] - $ctime ))
}
else {
if ( $address($nick,2) = $address(%karmatarget,2) ) {
msg $chan You cannot karma yourself, $nick $+ .
}
else {
if ( $address($remove($$1,++),2) = $null ) {
msg $chan Nick not found!
unset %karmatarget
}
else {
set -u3600 %plus. [ $+ [ $address($nick,2) ] ] 1
set -u3600 %plustime. [ $+ [ $address($nick,2) ] ] $calc($ctime + 3600)
;You can only give positive karma once per hour
inc %karma. [ $+ [ $address(%karmatarget,2) ] ] 1
msg $chan %karmatarget $+ 's karma is now %karma. [ $+ [ $address(%karmatarget,2) ] ] $+ .
if (%botkarma3 = $address(%karmatarget,2)) {
inc %botkarma 1
}
if (%karma. [ $+ [ $address(%karmatarget,2) ] ] > %TopKarma) {
set %topkarma %karma. [ $+ [ $address(%karmatarget,2) ] ]
set %topkarma2 %karmatarget
set %topkarma3 $address(%karmatarget,2)
msg $chan %topkarma2 is top Karma!
}
}
}
}
}
on *:TEXT:*--:#: {
; a name followed by -- triggers this command. It will not work for non-nicknames
set %karmatarget $remove($$1,--)
if (%minus. [ $+ [ $address($nick,2) ] ] = 1) {
msg $chan $nick $+ :You cannot give negative karma for another $duration($calc(%minustime. [ $+ [ $address($nick,2) ] ] - $ctime ))
}
else {
if ( $address($nick,2) = $address(%karmatarget,2) ) {
msg $chan You cannot karma yourself, $nick $+ .
}
else {
if ( $address($remove($$1,--),2) = $null ) {
msg $chan Nick not found!
unset %karmatarget
}
else {
set -u3600 %minus. [ $+ [ $address($nick,2) ] ] 1
set -u3600 %minustime. [ $+ [ $address($nick,2) ] ] $calc($ctime + 3600)
;You can only give negative karma once per hour
dec %karma. [ $+ [ $address(%karmatarget,2) ] ] 1
msg $chan %karmatarget $+ 's karma is now %karma. [ $+ [ $address(%karmatarget,2) ] ] $+ .
if (%topkarma3 = $address(%karmatarget,2)) {
dec %topkarma 1
}
if (%karma. [ $+ [ $address(%karmatarget,2) ] ] < %BotKarma) {
set %Botkarma %karma. [ $+ [ $address(%karmatarget,2) ] ]
set %Botkarma2 %karmatarget
set %Botkarma3 $address(%karmatarget,2)
msg $chan %botkarma2 is Bottom Karma!
}
}
}
}
}
on *:TEXT:-karma*:#: {
if ($2 = $null) {
;check your own karma
if ( %karma. [ $+ [ $address($nick,2) ] ] = $null ) {
set %karma. [ $+ [ $address($nick,2) ] ] 0
msg $chan $nick $+ : You have %karma. [ $+ [ $address($nick,2) ] ] karma.
}
else {
msg $chan $nick $+ : You have %karma. [ $+ [ $address($nick,2) ] ] karma.
}
}
else {
if ( $address($2,2) = $null ) {
msg $chan Nick not found!
}
else {
;check someone else's karma
if ( %karma. [ $+ [ $address($2,2) ] ] = $null ) {
set %karma. [ $+ [ $address($2,2) ] ] 0
msg $chan $2 has %karma. [ $+ [ $address($2,2) ] ] karma.
}
else {
msg $chan $2 has %karma. [ $+ [ $address($2,2) ] ] karma.
}
}
}
}
on *:TEXT:-kreset:#: {
if ($nick isop $chan) {
unset %plus.*
unset %minus.*
unset %plustime.*
unset %minustime.*
msg $chan Hour-limits reset
}
else {
halt
}
}
on *:TEXT:-ranks:#: { msg $chan %Topkarma2 is Top karma, with %topkarma karma. %Botkarma2 is Bottom karma, with %Botkarma karma. }
Here is a version I edited (I have changed karma to rep)
/*
############ rep by PonyToast ##################
*/
;optional help module
on *:text:!rephelp:*: {
msg $chan -rep (Check your rep)
msg $chan -rep <nick> (check someone else's rep)
msg $chan <nick>++ (give rep)
msg $chan <nick>-- (Remove rep)
}
; a name followed by ++ triggers this command. It will not work for non-nicknames
on *:TEXT:*++:#: {
; a name followed by -- triggers this command. It will not work for non-nicknames
set %reptarget $remove($$1,++)
if (%plus. [ $+ [ $address($nick,2) ] ] = 1) {
msg $chan $nick $+ :You cannot give positive rep for another $duration($calc(%plustime. [ $+ [ $address($nick,2) ] ] - $ctime ))
}
else {
if ( $address($nick,2) = $address(%reptarget,2) ) {
msg $chan You cannot rep yourself, $nick $+ .
}
else {
if ( $address($remove($$1,++),2) = $null ) {
msg $chan Nick not found!
unset %reptarget
}
else {
set -u3600 %plus. [ $+ [ $address($nick,2) ] ] 1
set -u3600 %plustime. [ $+ [ $address($nick,2) ] ] $calc($ctime + 3600)
;You can only give positive rep once per hour
inc %rep. [ $+ [ $address(%reptarget,2) ] ] 1
msg $chan %reptarget $+ 's rep is now %rep. [ $+ [ $address(%reptarget,2) ] ] $+ .
if (%botrep3 = $address(%reptarget,2)) {
inc %botrep 1
}
if (%rep. [ $+ [ $address(%reptarget,2) ] ] > %Toprep) {
set %toprep %rep. [ $+ [ $address(%reptarget,2) ] ]
set %toprep2 %reptarget
set %toprep3 $address(%reptarget,2)
msg $chan %toprep2 is top rep!
}
}
}
}
}
on *:TEXT:*--:#: {
; a name followed by -- triggers this command. It will not work for non-nicknames
set %reptarget $remove($$1,--)
if (%minus. [ $+ [ $address($nick,2) ] ] = 1) {
msg $chan $nick $+ :You cannot give negative rep for another $duration($calc(%minustime. [ $+ [ $address($nick,2) ] ] - $ctime ))
}
else {
if ( $address($nick,2) = $address(%reptarget,2) ) {
msg $chan You cannot rep yourself, $nick $+ .
}
else {
if ( $address($remove($$1,--),2) = $null ) {
msg $chan Nick not found!
unset %reptarget
}
else {
set -u3600 %minus. [ $+ [ $address($nick,2) ] ] 1
set -u3600 %minustime. [ $+ [ $address($nick,2) ] ] $calc($ctime + 3600)
;You can only give negative rep once per hour
dec %rep. [ $+ [ $address(%reptarget,2) ] ] 1
msg $chan %reptarget $+ 's rep is now %rep. [ $+ [ $address(%reptarget,2) ] ] $+ .
if (%toprep3 = $address(%reptarget,2)) {
dec %toprep 1
}
if (%rep. [ $+ [ $address(%reptarget,2) ] ] < %Botrep) {
set %Botrep %rep. [ $+ [ $address(%reptarget,2) ] ]
set %Botrep2 %reptarget
set %Botrep3 $address(%reptarget,2)
msg $chan %botrep2 is Bottom rep!
}
}
}
}
}
on *:TEXT:-rep*:#: {
if ($2 = $null) {
;check your own rep
if ( %rep. [ $+ [ $address($nick,2) ] ] = $null ) {
set %rep. [ $+ [ $address($nick,2) ] ] 0
msg $chan $nick $+ : You have %rep. [ $+ [ $address($nick,2) ] ] rep.
}
else {
msg $chan $nick $+ : You have %rep. [ $+ [ $address($nick,2) ] ] rep.
}
}
else {
if ( $address($2,2) = $null ) {
msg $chan Nick not found!
}
else {
;check someone else's rep
if ( %rep. [ $+ [ $address($2,2) ] ] = $null ) {
set %rep. [ $+ [ $address($2,2) ] ] 0
msg $chan $2 has %rep. [ $+ [ $address($2,2) ] ] rep.
}
else {
msg $chan $2 has %rep. [ $+ [ $address($2,2) ] ] rep.
}
}
}
}
on *:TEXT:-kreset:#: {
if ($nick isop $chan) {
unset %plus.*
unset %minus.*
unset %plustime.*
unset %minustime.*
msg $chan Hour-limits reset
}
else {
halt
}
}
on *:TEXT:-ranks:#: { msg $chan %Toprep2 is Top rep, with %toprep rep. %Botrep2 is Bottom rep, with %Botrep rep. }
nice.. i changed the time to 30seconds but it wont do --rep