mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2014
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Jul 2014
Posts: 3
Ok hey guys i am really nooby at this i can just manage to make on text on join on part etc... commands but i wanted to have a point and raffle system so i found a points system where every 10 mins u get 2 points blahblah and so i copied that pasted it i understand some of it but not all but i was missing 1 thing... The raffle system so i am asking for your help to add a raffle system to this code!
------------------------------------

Things i need please!:
- minus 50 points from their total points to enter the raffle if they dont have 50 points then they arent allowed to enter the raffle!
-!draw - To draw the winner and stops it after drawing a winner!
-!raffle start - to start the raffle
-!raffle - to enter the raffle

Thanks to whoever helps me in advancedd THANKS GUYS!

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 -u5 %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. }
}

Joined: Jul 2014
Posts: 48
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Jul 2014
Posts: 48
check this out https://forums.mirc.com/ubbthreads.php/topics/247121/Re:_Raffle_system_help#Post247121

!raffle is basically just ontext command. Within the on text command is where you will want to check if the user has enough points to buy a ticket, and decide how many tickets they are allowed to buy. Use floodcommands to help limit number of tickets. Also, you will be subtracting the points in this block of code, as well as storing the number of tickets the user has. The best way for this is maybe write the user data to a textini file similar to how the points are stored. Now, you will either need a timer to automatically end the raffle, or another ontext command to end it. With another ontext to end, you will want a variable to check if raffletime is on/true/set/w.e in this block of code before you do anything.


!draw
you will want this block to check if the user has any tickets, and then how much. If you are only doing 1 ticket per person, then just check who has tickets, and store each one to a list, then random number from that list. That person wins, and reset all tickets from each user, and print msg that that specific user won. I guess you could also put the variable to end the raffle in this block of code, too.

Joined: Jul 2014
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Jul 2014
Posts: 3
Hey thanks for your help but i dont seem to be able to figure it out i think i did it totally wrong as i said i am very very inexperienced about this all!
Thanks for you help can you please show me a code that i can observe and see what is happening please! THANKS!

Joined: Jul 2014
Posts: 48
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Jul 2014
Posts: 48
I'm not going to give you the straight up answer, as this won't help you learn what does what in mIRC script language, but I will post an outline for you, and we can go from there if you are still confused.

In addition to your points code, add an on text command for your raffle system. You can name the command whatever you want. In this example, I named it "raffle". ***I've paraphrased a lot of the code, this is not copy/paste material, and will not work without modifying.***
Code:
on *:text:!raffle:#:{
   ;flood command/variable here to stop purchasing of more than 1 ticket. OR have a variable check if user has already bought a ticket.
   ;check if the amount of points a user has is enough to buy a ticket (whatever the cost of 1 ticket is)
       ;execute this code if user has enough
       ;subtract # of points = 1 ticket from user points total
       ;add 1 ticket to # of tickets a user has. (most likely, you will need to store the tickets same as the points are stored (like tickets.ini) Basically just copy and paste the write points code block, and use here with different names for variables and file
   ;user did not have enough points
       ;msg # $nick does not have enough points
}

Now you need the command to draw a winner. I use the name "draw" in this example
Code:
on *:text:!draw:#:{
   ;make op only. Don't want random users calling the draw command when you aren't ready to draw a winner
   ;if using variable to turn raffle off, set it here.
   ;iterate through the list/file storing who has purchased tickets. Pick one at random.
   ;msg the channel saying whoever won, won.
   ;reset all tickets.
}


Now.
!raffle
-will add 1 ticket to whoever issued that command in the chat. Flood command or variable check will limit it to 1 ticket, or rather, 1 use of the command.

!draw
-will stop people from using the raffle command (if you set the variables this way)
-picks a user that has a ticket at random, and msg channel that they won.

You will most likely also want to control when people can/can not buy tickets. Do this with a variable to set the raffle command on/off, or set a timer to automatically set raffle off.


Link Copied to Clipboard