Jump to content

Help with the mta.dead true/false function..


MB|Lagzilla

Recommended Posts

If I want to check if someone's alive the code would be:

($mta.dead($1,$2) == $false) 

Or is this wrong?

This is how I'm using it:

on *:SIGNAL:mta.part: { 
  if ($mta.dead($1,$2) == $false) set %cplayers $calc(%cplayers - 1) 
  mta.end $1 $2 
} 

This one is right:

on *:SIGNAL:mta.part: { 
  if ($mta.nick($1,$2) == ($mta.dead($1,$2))  set %cplayers $calc(%cplayers - 1) 
  mta.end $1 $2 

But if someone leaves server, it shouldnt be dead-alive dependant?

So, it should be like this:

on *:SIGNAL:mta.part: { 
  set %cplayers $calc(%cplayers - 1) 
  mta.end $1 $2 

Link to comment
This one is right:

on *:SIGNAL:mta.part: { 
  if ($mta.nick($1,$2) == ($mta.dead($1,$2))  set %cplayers $calc(%cplayers - 1) 
  mta.end $1 $2 

It is so wrong.....

1. bracket mismatch

2. you compare a boolean value with a string? smart.. NOT

3. It does need a dead check cause it means much whether a dead player left or an alive one.

4. '!dec %cplayers' would do instead of that 'set %cplayers $calc(%cplayers - 1)'

5. that %cplayers is not anyhow reliable, i'd do $calc($server($1).players - $mta.dead($1)) This will return the real number of alive players.

so huh.

on *:SIGNAL:mta.part:{ 
  if (!$mta.dead($1,$2)) !dec %cplayers 
  mta.end $1 $2 
} 

or

on *:SIGNAL:mta.part:{ 
  if (!$mta.dead($1,$2)) %cplayers = $calc($server($1).players - $mta.dead($1)) 
  mta.end $1 $2 
} 

Link to comment

Ok this is what I got:

;--------------------- 
;-PLAYERCOUNT ALIAS'S- 
;--------------------- 
  
alias gus.doa !return $iif($readini(gus.doa.ini,DOA,DOA $+ $1),$v1,0) 
alias gus.end { 
  if ($gus.doa($1) == 1) { 
    var %a = 0 
    while (%a < $mta.server($1).cmax) { 
      if (!$mta.dead($1,%a)) { 
        mta.text $1 The Winner is: $mta.nick($1,%a) 
        !writeini -n gus.stats.ini WINS $gus.nick($1,%a) $calc($gus.wins($1,%a) + 1) 
        !halt 
      } 
      !inc %a 
    } 
  } 
} 
  
on *:SIGNAL:mta.part: { 
  if (!$mta.dead($1,$2)) !writeini -n gus.doa.ini DOA DOA $+ 1 $calc($gus.doa($1) - 1) 
  gus.end $1 $2 
} 
  
on *:SIGNAL:mta.startrace: { 
  !writeini -n gus.doa.ini DOA DOA $+ $1 $mta.server($1).players 
} 
  
on *:SIGNAL:mta.death: { 
  !writeini -n gus.doa.ini DOA DOA $+ 1 $calc($gus.doa($1) - 1) 
  gus.end $1 $2 
} 

May or may not be error's, I'm learning..

Link to comment
  • Recently Browsing   0 members

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