My first post on this forum. I really learned a lot but i'm stuck with this one....
I am a beginner in scripting and so far it has been a strugle to get things going but it is working.
I'm experimenting with sockets because i can see the potential..
I got this script running on our clan channel. I don't understand all of it but most of the time it works
on 1:text:!ip*:#:{
set %codquery.source $chan
codquery 213.189.10.42 28960 }
on 1:text:* ip *:#:{
set %codquery.source $chan
codquery 213.189.10.42 28960 }
alias codquery {
if ($sock(codquery)) {
sockclose codquery
}
sockudp -k codquery $1 $2 $str($chr(255),4) $+ getstatus
}
on *:udpread:codquery:{
sockread &cod
var %cod.return = $bvar(&cod,1,$bvar(&cod,0)).text
var %x = 1
while (%x <= $numtok(%cod.return,92)) {
var %cod.current = $gettok(%cod.return,%x,92)
if (mapname isin %cod.current) {
var %cod.map $gettok(%cod.return,$calc(%x + 1),92)
}
if (sv_hostname isin %cod.current) {
var %cod.name $gettok(%cod.return,$calc(%x + 1),92)
}
if (sv_maxclients isin %cod.current) {
var %cod.maxplayers = $gettok(%cod.return,$calc(%x + 1),92)
}
inc %x
}
msg %codquery.source Servernaam: %cod.name
msg %codquery.source IP adres: 213.189.10.42:28960 Players: $int($calc($numtok(%cod.return,34) / 2)) $+ / $+ %cod.maxplayers Current map: %cod.map
unset %codquery.source
if ($sock(codquery)) {
sockclose codquery
}
}
It works allmost perfect but there is 1 problem...
When there are 11 players or more on the server i get an error line 18
var %cod.return = $bvar(&cod,1,$bvar(&cod,0)).text
mIRC echo's "* String too long: $bvar (line 18, codquery.mrc)"
What can i do about this?