Paste Your small code(s) here, ex. small aliases, identifiers
by Cristian » Fri Oct 17, 2008 6:35 pm
This script will split
$1- into two diffrent teams
%terrorist and
%counter-terroristfx.
- Code: Select all
/mixplayers nickname1 nickname2 nickname3 nickname4
I hope you can use it.
- Code: Select all
alias mixplayers {
var %players = $1-
var %x = $numtok($1-,32)
var %ct
var %t
var %used
while ($numtok(%ct %t,32) < %x) {
var %r = $r(1,%x)
if (!$istok(%used,%r,32)) {
var %player = $gettok($1-,%r,32)
if (2 // %r) { var %ct = $addtok(%ct,%player,32) }
else { var %t = $addtok(%t,%player,32) }
var %used = $addtok(%used,%r,32)
}
}
set %terrorist %t
set %counter-terrorist %ct
}
-
Cristian
- proof of advance

-
- Posts: 282
- Joined: Sun Nov 04, 2007 3:02 pm
- Location: Denmark
- Authnick: Sumsar
-
by Cristian » Sat Oct 18, 2008 5:14 pm
Just another example to split multiple tokens into 2 variables.
- Code: Select all
alias mixplayers {
var %players = $1-
var %totalPlayers = $numtok($1-,32)
var %team.1
var %team.2
var %totalTeams = $var(%team.*,0)
var %used
while ($numtok(%team.1 %team.2,32) < %totalPlayers) {
var %r = $r(1,%totalPlayers)
var %r2 = $r(1,%totalTeams)
if (!$istok(%used,%r,32)) {
var %player = $gettok($1-,%r,32)
if ($numtok($eval($var(%team.*,%r2),2),32) < $calc(%totalPlayers /2)) {
set $var(%team.*,%r2) $eval($var(%team.*,%r2),2) %player
var %used = $addtok(%used,%r,32)
}
}
}
set %terrorist %team.1
set %counter-terrorist %team.2
}
-
Cristian
- proof of advance

-
- Posts: 282
- Joined: Sun Nov 04, 2007 3:02 pm
- Location: Denmark
- Authnick: Sumsar
-
Return to Mirc Scripting Snippets
Who is online
Users browsing this forum: No registered users and 0 guests