Un script de pickup pour jeux en ligne (Cs...), 5 contre 5.
Il gère tous les évènements qui interfèrent dans le pickup: part, quit, kick, changement de nick (malgrés un petit bug là dessus que je n'ai pas corrigé il faut que je cherche; il faut que la fenêtre active lors d'un !add sois celle du salon en question)...
Utilisation des variables et des hashs tables.
Source / Exemple :
on *:join:%chan:{
if (%pickok == on) {
notice $nick Un pickup est en cours sur %chan pour y participer tappez !add
}
}
on *:text:pass*:?:{
if ($nick isop %chan) {
set %pass $$2
msg $nick Ok, pass du serveur enregistré: %pass
}
else {
msg $nick Erreur ! Vous n'êtes pas opérateur de %chan
}
}
on *:text:!pickup*:#:{
if ($nick isop $chan) {
set %chan $chan
set %map $$2
set %serveur $3
set %stopic $chan($chan).topic
set %pickok on
topic $chan Pickup Lancé - Team A: En attente de joueurs tappez !add - Team B: En attente de joueurs tappez !add - Serveur: %serveur - Map: %map
notice $nick Définissez le mot de pass sur le serveur puis tappez /msg $me pass LeMotDePass
msg %chan Pickup lancé en attente de joueurs tappez !add pour y participer
}
}
on *:text:!stop:#:{
if ($nick isop $chan) {
msg $chan Pickup annulé.
topic $chan %stopic
hfree -sw *team*
set %pickok off
unset %team*
unset %pass
unset %serveur
}
}
alias stop {
hfree -sw *team*
set %pickok off
unset %team*
unset %pass
unset %serveur
}
on *:text:!add:#:{
if (%pickok == on) {
if (($hget(teama,0).item < 5) && ($hfind(teama,$nick,0) == 0)) {
hadd -m teama $nick
mode $chan +v $nick
msg $chan $nick ajouté à la team A
var %a = $hget(teama,0).item, %i = 1
while (%i <= %a) {
set %teama %teama $hget(teama,%i).item
inc %i
}
topic %chan Pickup Lancé - Team A: %teama - Team B: %teamb - Serveur: %serveur - Map: %map
}
else {
if (($hget(teama,0).item < 5) && ($hfind(teama,$nick,0) == 0) && ($hfind(teamb,$nick,0) == 0)) {
hadd -m teamb $nick
mode $chan +v $nick
msg $chan $nick ajouté à la team B
var %a = $hget(teamb,0).item, %i = 1
while (%i <= %a) {
set %teamb %teamb $hget(teamb,%i).item
inc %i
}
topic %chan Pickup Lancé - Team A: %teama - Team B: %teamb - Serveur: %serveur - Map: %map
}
else {
if (($hget(teama,0).item == 5) && ($hget(teamb,0).item == 5)) {
msg $chan Pickup complet sur %serveur les participants vont recevoir le mot de pass en privé.
topic %chan %stopic
send.pass
stop
}
}
}
}
else {
msg $chan Désolé pas de pickup en cours.
}
}
on *:text:!remove:#:{
if ($hfind(teama,$nick,0) != 0) {
hdel -s teama $nick
msg $chan $nick à été retiré du pickup.
mode $chan -v $nick
set %teama $replace(%teama, $nick, $chr(0))
}
elseif ($hfind(teamb,$nick,0) != 0) {
hdel -s teamb $nick
msg $chan $nick à été retiré du pickup.
mode $chan -v $nick
set %teamb $replace(%teamb, $nick, $chr(0))
}
else {
msg $chan $nick vous n'êtes pas dans le pickup en cours.
}
}
on *:part:%chan:{
if ($hfind(teama,$nick,0) != 0) {
hdel -s teama $nick
set %teama $replace(%teama, $nick, $chr(0))
msg $chan $nick à été retiré du pickup.
}
elseif ($hfind(teamb,$nick,0) != 0) {
hdel -s teamb $nick
set %teamb $replace(%teamb, $nick, $chr(0))
msg $chan $nick à été retiré du pickup.
}
}
on *:quit:%chan:{
if ($hfind(teama,$nick,0) != 0) {
hdel -s teama $nick
set %teama $replace(%teama, $nick, $chr(0))
msg $chan $nick à été retiré du pickup.
}
elseif ($hfind(teamb,$nick,0) != 0) {
hdel -s teamb $nick
set %teamb $replace(%teamb, $nick, $chr(0))
msg $chan $nick à été retiré du pickup.
}
}
on *:kick:%chan:{
if ($hfind(teama,$knick,0) != 0) {
hdel -s teama $nick
set %teama $replace(%teama, $nick, $chr(0))
msg $chan $knick à été retiré du pickup.
}
elseif ($hfind(teamb,$knick,0) != 0) {
hdel -s teamb $nick
set %teamb $replace(%teamb, $nick, $chr(0))
msg $chan $knick à été retiré du pickup.
}
}
on *:NICK:{
if ($active != Status Window) {
if ($hfind(teama,$nick,0) != 0) {
hdel -s teama $nick
hadd -m teama $newnick
set %teama $replace(%teama, $nick, $chr(0))
set %teama %teama $newnick
msg %chan Pseudo de $nick changé en $newnick dans le pickup.
}
elseif ($hfind(teamb,$nick,0) != 0) {
hdel -s teamb $nick
hadd -m teamb $newnick
set %teamb $replace(%teamb, $nick, $chr(0))
set %teamb %teamb $newnick
msg %chan Pseudo de $nick changé en $newnick dans le pickup.
}
}
else {
msg %chan /!\Attention/!\ veuillez modfifier la fenêtre en cours qui est: $active
}
}
alias send.pass {
var %a = $hget(teama,0).item, %i = 1
while (%i <= %a) {
msg $hget(teama,%i).item Le pickup va commencer, ip: %serveur Pass: %pass Gogogo !
inc %i
}
var %a = $hget(teamb,0).item, %i = 1
while (%i <= %a) {
msg $hget(teamb,%i).item Le pickup va commencer, ip: %serveur Pass: %pass Gogogo !
inc %i
}
}
Conclusion :
Pour l'utiliser:
!pickup map serveur puis /msg NomDuBot pass LeMotDePassDuServeur
!add pour s'ajouter à une équipe
!stop pour arrêter le pickup
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.