Jump to content

[SA] How to see who is the last man standing in DM Map?


Ywa

Recommended Posts

Posted

Hello everyone,

I have a problem. I have "wins" script. This works OK. But on a deathmatch/destruction derby map (Without CP's) I don't know how to catch the winner. And give him points. Any idea's here? :o

Thanks in advance!

Ywa

  • 2 weeks later...
Posted

yeah, you could count the numbers of players at the start of the DM map

and every time one player dies, you put of one of the number.

when the number is one, you've got the player

i don't know scripting, so i don't know if this is possible :)

Posted

The problem is, you don't know which map is a DM map. You would have to make a list of all DM maps. Or at least check if someone respawns before the map ends.

Posted

yeah, but Ywa has a DM Server so he need it for that ;).

I'm trying to make him a script but it doesn't work, anyone knows the solution?

on *:SIGNAL:mta.endrace: {
 var %a = 0
 while (%a < $mta.server($1).cmax) {
   if ($mta.nick($1,%a) != -1) {
     if ($calc($mta.dead($1) + $mta.frozen($1) + 1) == $mta.server($1).players) {
       if ($mta.dead($1,%a) != 1 && $mta.dead($1,%a) != 2 && $mta.dead($1,%a) == $null) {
         mta.text $1 $mta.nick($1,%a) won!
       }
     }
   }
   !inc %a 
 }
}

Posted

I dont get it... Could someone explain it further? Thank you :), I have put it in the script at the bottom with all the other on signal commands... I already changed end race in death but it still doesnt work.. Does anyone know why?

Posted (edited)

I made this one, it is almost workin.. It gives you a win point, and freezes the winning player so he wont get a death point. But its not working on everybody.. What did I do wrong?

Edited by Guest
Posted

I think I commented out the mta.endrace event triggering on DM-maps, i'm sure you can find it yourself in mta.mrc.

Edit I did: search for ''/* Unable to detect" and remove the comment-markings and it *MIGHT* work.

Posted

at the start of it you get the number of players ingame. keep doing a check every 1 second to see how many people are dead using while(). When only 1 person is alive, reward him/her.

Posted
dm maps usually dont have a respawn.

Are you shure?

if you want a propor dm map, last man standing, you can set the respawn the none in map editor. some dm maps use wave as a respawn method though, but thats more for fun servers, not real record my stats dm server.

Posted

can sum1 test this for me?[syntax=mIRC]on *:SIGNAL:mta.startrace: {

set %cplayers $mta.server($1).players

}

on *:SIGNAL:mta.death: {

set %cplayers $calc(%cplayers - 1)

if (%cplayers == 1) {

var %a = 0

while (%a < $mta.server($1).cmax) {

if ($mta.dead($1,%a) == $null) {

mta.text $1 $mta.nick($1,%a) won!

mta.freeze $1 %a

}

}

}

}[/lua]

Posted
can sum1 test this for me?[syntax=mIRC]on *:SIGNAL:mta.startrace: {

set %cplayers $mta.server($1).players

}

on *:SIGNAL:mta.death: {

set %cplayers $calc(%cplayers - 1)

if (%cplayers == 1) {

var %a = 0

while (%a < $mta.server($1).cmax) {

if ($mta.dead($1,%a) == $null) {

mta.text $1 $mta.nick($1,%a) won!

mta.freeze $1 %a

}

}

}

}[/lua]

well i have no race server so i cant test it, but i see that you forgot an 'inc %a' in the loop and i suppose that $mta.dead returns $true or $false, also you could stop the loop after it found the winner with !halt ;)

[syntax=mIRC]on *:SIGNAL:mta.startrace: {

set %cplayers $mta.server($1).players

}

on *:SIGNAL:mta.death: {

set %cplayers $calc(%cplayers - 1)

if (%cplayers == 1) {

var %a = 0

while (%a < $mta.server($1).cmax) {

if (!$mta.dead($1,%a)) {

mta.text $1 $mta.nick($1,%a) won!

mta.freeze $1 %a

!halt

}

!inc %a

}

}

}[/lua]

Posted

Ive got a deathmatch server, but lil's script isnt workin on my server :S... I had this script:

  var %a = 0 
 while (%a < $mta.server($1).cmax) { 
   if ($mta.nick($1,%a) != -1) { 
     if ($calc($mta.dead($1) + $mta.frozen($1) + 1) == $mta.server($1).players) { 
       if ($mta.dead($1,%a) != 1 && $mta.dead($1,%a) != 2 && $mta.dead($1,%a) == $null) { 
         mta.freeze $1 %a
         mta.text $1 $mta.nick($1,%a) won this map and will recieve 1 point! 
         !writeini -n " $+ $scriptdir $+ stats.ini" WINS $mta.nick($1,%a) $gus.add($gus.wins($1,%a),1)
       } 
     } 
   } 
   !inc %a 
 } 

And it almost works.. But it isnt freezing everybody.. only 50% of the players or something. And some people never get freezed... Sometimes the scripts freezes someone before the last man died... Anyone?[/code]

Posted

[syntax=mIRC]on *:SIGNAL:mta.startrace: {

set %cplayers $mta.server($1).players

}

on *:SIGNAL:mta.death: {

set %cplayers $calc(%cplayers - 1)

if (%cplayers == 1) {

var %a = 0

while (%a < $mta.server($1).cmax) {

if ($mta.dead($1,%a)) {

mta.text $1 $mta.nick($1,%a) won!

mta.freeze $1 %a

!halt

}

!inc %a

}

}

}[/lua]

if this isn't working, nothing works!

  • Recently Browsing   0 members

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