MB|Lagzilla Posted September 23, 2007 Share Posted September 23, 2007 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 } Link to comment
SanZoR Posted September 23, 2007 Share Posted September 23, 2007 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
SDK Posted September 23, 2007 Share Posted September 23, 2007 $mta.dead returns "1" if a player is dead, else it returns nothing: on *:SIGNAL:mta.part: { if ($mta.dead($1,$2) != 1) set %cplayers $calc(%cplayers - 1) mta.end $1 $2 } Sanzor, if you can't script, then don't post ... Link to comment
lil Toady Posted September 23, 2007 Share Posted September 23, 2007 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
MB|Lagzilla Posted September 23, 2007 Author Share Posted September 23, 2007 Oooooo Thanks.. Link to comment
SDK Posted September 23, 2007 Share Posted September 23, 2007 or on *:SIGNAL:mta.part:{ if (!$mta.dead($1,$2)) %cplayers = $calc($server($1).players - $mta.dead($1)) mta.end $1 $2 } Does $mta.dead returns the number off all dead players? Edit: And I guess you mean $mta.server ... Link to comment
lil Toady Posted September 24, 2007 Share Posted September 24, 2007 $mta.server yeh, sorry and if you pull only the server id to $mta.dead it returns the number of dead players, if you pull server and player ids it returns whether the player is dead or not ($true/$false) Link to comment
MB|Lagzilla Posted September 24, 2007 Author Share Posted September 24, 2007 Thanks....tried all the code suggested still not much luck.....I just want to make a reliable wins system... Anything anyone could suggest? Link to comment
SanZoR Posted September 26, 2007 Share Posted September 26, 2007 Could you post your whole shit here, so we could fix it? Link to comment
Brophy Posted September 26, 2007 Share Posted September 26, 2007 Sanzor, if you can't script, then don't post ... Link to comment
MB|Lagzilla Posted September 27, 2007 Author Share Posted September 27, 2007 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
Recommended Posts