Jump to content

Races list updater


lil Toady

Recommended Posts

Well, since nobody have done that before, me and [uVA]Scooby have written this, a script that will be getting missing maps from the server untill it gets all of them so you wont have any missing maps since now. :P

You don't have to do anything, it will start the process as soon as you connect your mtama to a server, but if you think that u still have some maps missing you can do !updateraces.

I think thats all, clicky

Enjoy :D

Link to comment

Things are looking good now, b4 we got this working i was getting around 10-15 missing maps on my server, and i know some are getting like 50-100 missing, this fixes the problem

dont waste ur time reading this... download it! - load it - and connect

job done.

unknown maps = 0

Link to comment
Good job guys, I needed this ;)

i think we all needed it if we had over 200 maps.

i know some people on the forums have said they have thousands of maps uploaded and around 800 missing.

u might want to run it a few times just to be sure its got them all.

i tried it on the tmm server, they had around 80 missing out of 350, took 3 times to get them all updated.

Link to comment

/*
RaceList Updater v1.1 by lil_Toady
Special thanks to [uVA]Scooby
Updated by Aeron

The script will be automaticly updating the races list untill it gets all the maps.
If you still think it is missing maps do: !updateraces     (admins level 2)

If you want to put it into your script here are the aliases you'd want to know:
mta.races.check       - Checks for missing maps, if so it starts the updater (not accurate)
mta.races.update      - Starts the updater
*/
on *:SIGNAL:mta.command:{
 if (!updaterace* iswm $3) {
   if ($mta.level($1,$2) > 1) {
     mta.text $1 Updating the race list.
     mta.races.update $1
   }
 }
}
on *:SIGNAL:mta.racelist:{
 mta.races.check $1
}
alias mta.races.check {
 var %a = $ini($mta.dir $+ $1.ini,Races,0),%b = $ini($mta.dir $+ $1.ini,Races,%a)
 if (%b > %a) mta.races.update $1
}
alias mta.races.update {
 mta.echo $1 * Racelist: Updating...
 !bset &b 1 109 0 $did(mta,$1 $+ 22) $mta.dex($did(mta,$1 $+ 12)) 124 $mta.dex(mta.races. $+ $rand(1000,9999)) 0
 !sockudp -k mta.races.sock. $+ $1 $did(mta,$1 $+ 10) $did(mta,$1 $+ 11) &b
 !.timermta.races.timer. $+ $1 1 10 !sockclose mta.races.sock. $+ $1
}
on *:udpread:mta.races.sock.*: {
 !sockread &a
 var %a = $right($sockname,-15),%b = $bvar(&a,3),%c = $bvar(&a,2)
 if (%c == 1) {
   mta.echo %a * Racelist: Updating failed. ( $+ $gettok(User:Incorrect password:Already connected:Timed-out:To much connections:Banned:Name in use:Invalid Version,$calc(%b + 1),58) $+ )
   if (%b == 5) mta.unban %a $ip
   elseif (%b == 1) mta.echo %a * Racelist: Updating stopped.
   else !.timermta.races.timer. $+ $1 1 15 mta.races.check %a
   !sockclose $sockname
 }
 elseif (%c == 2) {
   !bset &b 1 109 2
   !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
 }
 elseif (%c == 18) {
   if ($mta.server(%a).version == 2) {
     if (%b == 1) {
       %c = $calc($bvar(&a,5) * 256 + $bvar(&a,4))
       if (!$readini($+($mta.dir,%a,.ini),Races,%c)) {
         !did -i $+ %c mta %a $+ 16 $bvar(&a,6,50).text
         !writeini -n $+(",$mta.dir,%a,.ini") Races %c $bvar(&a,6,50).text
         !sockmark $sockname $calc($sock($sockname).mark + 1)
       }
     }
     elseif (%b == 2) {
       mta.echo %a * Racelist: Updated. ( $+ $sock($sockname).mark missing maps retrieved)
       !bset &b 1 109 1
       !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
       !sockclose $sockname
       !.timermta.races.timer. $+ %a off
       !.signal mta.racelist %a
     }
   }
 }
}
on *:SIGNAL:mta.disconnect:{
 if ($sock(mta.races.sock. $+ $1)) {
   !bset &b 1 109 1
   !sockudp -k mta.races.sock. $+ $1 $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
   !sockclose mta.races.sock. $+ $1
   !.timermta.races.timer. $+ $1 off
 }
}

'Unofficial v1.1' (100% UNTESTED)

- Fixed problems for use of multiple MTA:mA's

- Fixed problems with use for Server 10 or more

- Makes no use of a global variable

- Various optimilizations

- All operations/sources prefixed with 'mta.races.'

Edited by Guest
Link to comment
/*
RaceList Updater v1.1 by lil_Toady
Special thanks to [uVA]Scooby
Updated by Aeron

The script will be automaticly updating the races list untill it gets all the maps.
If you still think it is missing maps do: !updateraces     (admins level 2)

If you want to put it into your script here are the aliases you'd want to know:
mta.races.check       - Checks for missing maps, if so it starts the updater (not accurate)
mta.races.update      - Starts the updater
*/
on *:SIGNAL:mta.command:{
 if (!updaterace* iswm $3) {
   if ($mta.level($1,$2) > 1) {
     mta.text $1 Updating the race list.
     mta.races.update $1
   }
 }
}
on *:SIGNAL:mta.racelist:{
 mta.races.check $1
}
alias mta.races.check {
 var %a = $ini($mta.dir $+ $1.ini,Races,0),%b = $ini($mta.dir $+ $1.ini,Races,%a)
 if (%b > %a) mta.races.update $1
}
alias mta.races.update {
 mta.echo $1 * Racelist: Updating...
 !bset &b 1 109 0 $did(mta,$1 $+ 22) $mta.dex($did(mta,$1 $+ 12)) 124 $mta.dex(mta.races. $+ $rand(1000,9999)) 0
 !sockudp -k mta.races.sock. $+ $1 $did(mta,$1 $+ 10) $did(mta,$1 $+ 11) &b
 !.timermta.races.timer. $+ $1 1 10 !sockclose mta.races.sock. $+ $1
}
on *:udpread:mta.races.sock.*: {
 !sockread &a
 var %a = $right($sockname,-15),%b = $bvar(&a,3),%c = $bvar(&a,2)
 if (%c == 1) {
   mta.echo %a * Racelist: Updating failed. ( $+ $gettok(User:Incorrect password:Already connected:Timed-out:To much connections:Banned:Name in use:Invalid Version,$calc(%b + 1),58) $+ )
   if (%b == 5) mta.unban %a $ip
   elseif (%b == 1) mta.echo %a * Racelist: Updating stopped.
   else !.timermta.races.timer. $+ $1 1 15 mta.races.check %a
   !sockclose $sockname
 }
 elseif (%c == 2) {
   !bset &b 1 109 2
   !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
 }
 elseif (%c == 18) {
   if ($mta.server(%a).version == 2) {
     if (%b == 1) {
       %c = $calc($bvar(&a,5) * 256 + $bvar(&a,4))
       if (!$readini($+($mta.dir,%a,.ini),Races,%c)) {
if (!$didreg(mta,%a $+ 16,$didreg(mta,%a $+ 16,$bvar(&a,6,50).text))) !did -a mta %a $+ 16 $bvar(&a,6,50).text
         !writeini -n $+(",$mta.dir,%a,.ini") Races %c $bvar(&a,6,50).text
         !sockmark $sockname $calc($sock($sockname).mark + 1)
       }
     }
     elseif (%b == 2) {
       mta.echo %a * Racelist: Updated. ( $+ $iif($sock($sockname).mark,$v1,No) missing maps retrieved)
       !bset &b 1 109 1
       !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
       !sockclose $sockname
       !.timermta.races.timer. $+ %a off
       !.signal mta.racelist %a
     }
   }
 }
}
on *:SIGNAL:mta.disconnect:{
 if ($sock(mta.races.sock. $+ $1)) {
   !bset &b 1 109 1
   !sockudp -k mta.races.sock. $+ $1 $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
   !sockclose mta.races.sock. $+ $1
   !.timermta.races.timer. $+ $1 off
 }
}

Fixed the text in mta chat box not returning the value of retrieved maps

Fixed the bug with race not being added to the races list in mtama dialog

*updated the link

Link to comment

so ... *trying not to sound ungratefull*

why didn't anyone make this a year ago ? (and when i asked about it got told it was really hard/impossible to fix the unknown map/will be fixed in next version - even when i specifically asked for a mirc workaround like this)

other than that - good job

Link to comment
so ... *trying not to sound ungratefull*

why didn't anyone make this a year ago ? (and when i asked about it got told it was really hard/impossible to fix the unknown map/will be fixed in next version - even when i specifically asked for a mirc workaround like this)

other than that - good job

I Asked the same and was told by a few that it wasnt possible.

I'd Never noticed any lost maps/Unknown's Until i wrote the PRS.

I put my ideas into play and knowing lil_toady had done a lot more socket work than me, i got him to write what i wanted, and this is what we came up with.

Even tho this doesnt work 100%, Its probably the best u can hope for.

If its still not retreiving all lost maps then its probably down to ur server or Ur connection to ur server.

Link to comment

well .. i kinda overlooked the mta.level wouldve been gus.level when i included it in my edited gus version

but ive still done somthing wrong i guess .. it times out just under 10 secs after connecting to the socket

i thought it might be the fact i have 5443 maps

so i moved 1/2 .. and then 1/2 more .. and again

till i had about 700 maps .. and it still timed out

any thoughts ?

Link to comment
well .. i kinda overlooked the mta.level wouldve been gus.level when i included it in my edited gus version

but ive still done somthing wrong i guess .. it times out just under 10 secs after connecting to the socket

i thought it might be the fact i have 5443 maps

so i moved 1/2 .. and then 1/2 more .. and again

till i had about 700 maps .. and it still timed out

any thoughts ?

Well i didnt even add it to my script, i left it as a seperate file.

maybe u broke it?

i know i tried it on my server once and had some connection problems, it turned out, it wouldnt work because i had more than 2 other admins connected.

any errors or is it just timing out?

Link to comment

Omg, that doesnt works in MTA:SA racing mod, and do you mean this:

/*
RaceList Updater v1.1 by lil_Toady
Special thanks to [uVA]Scooby and Aeron (bastid)
Updated by Aeron

The script will be automaticly updating the races list untill it gets all the maps.
If you still think it is missing maps do: !updateraces     (admins level 2)

If you want to put it into your script here are the aliases you'd want to know:
mta.races.check       - Checks for missing maps, if so it starts the updater (not accurate)
mta.races.update      - Starts the updater
*/
on *:SIGNAL:mta.command:{
 if (!updaterace* iswm $3) {
   if ($mta.level($1,$2) > 1) {
     mta.text $1 Updating the race list.
     mta.races.update $1
   }
 }
}
on *:SIGNAL:mta.racelist:{
 mta.races.check $1
}
alias mta.races.check {
 var %a = $ini($mta.dir $+ $1.ini,Races,$ini($mta.dir $+ $1.ini,Races,0))
 if (%a > $ini($mta.dir $+ $1.ini,Races,0)) mta.races.update $1
}
alias mta.races.update {
 mta.echo $1 * Racelist: Updating...
 !bset &b 1 109 0 $did(mta,$1 $+ 22) $mta.dex($did(mta,$1 $+ 12)) 124 $mta.dex(mta.races. $+ $rand(1000,9999)) 0
 !sockudp -k mta.races.sock. $+ $1 $did(mta,$1 $+ 10) $did(mta,$1 $+ 11) &b
 !.timermta.races.timer. $+ $1 1 10 !sockclose mta.races.sock. $+ $1
}
on *:udpread:mta.races.sock.*: {
 !sockread &a
 var %a = $right($sockname,-15),%b = $bvar(&a,3),%c = $bvar(&a,2)
 if (%c == 1) {
   mta.echo %a * Racelist: Updating failed. ( $+ $gettok(User:Incorrect password:Races updater already connected:Timed-out:To much connections:Banned:Name in use:Invalid Version,$calc(%b + 1),58) $+ )
   if (%b == 5) mta.unban %a $ip
   elseif (%b == 1) mta.echo %a * Racelist: Updating stopped.
   else !.timermta.races.timer. $+ $1 1 15 mta.races.check %a
   !sockclose $sockname
 }
 elseif (%c == 2) {
   !bset &b 1 109 2
   !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
 }
 elseif (%c == 18) {
   if ($mta.server(%a).version == 2) {
     if (%b == 1) {
       %c = $calc($bvar(&a,5) * 256 + $bvar(&a,4))
       if (!$readini($+($mta.dir,%a,.ini),Races,%c)) {
         if (!$didreg(mta,%a $+ 16,$didreg(mta,%a $+ 16,$bvar(&a,6,50).text))) !did -a mta %a $+ 16 $bvar(&a,6,50).text
         !writeini -n $+(",$mta.dir,%a,.ini") Races %c $bvar(&a,6,50).text
         !sockmark $sockname $calc($sock($sockname).mark + 1)
       }
     }
     elseif (%b == 2) {
       mta.echo %a * Racelist: Updated. ( $+ $iif($sock($sockname).mark,$v1,No) missing maps retrieved)
       !bset &b 1 109 1
       !sockudp -k $sockname $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
       !sockclose $sockname
       !.timermta.races.timer. $+ %a off
       !.signal mta.racelist %a
     }
   }
 }
}
on *:SIGNAL:mta.disconnect:{
 if ($sock(mta.races.sock. $+ $1)) {
   !bset &b 1 109 1
   !sockudp -k mta.races.sock. $+ $1 $did(mta,%a $+ 10) $did(mta,%a $+ 11) &b
   !sockclose mta.races.sock. $+ $1
   !.timermta.races.timer. $+ $1 off
 }
}

???

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...