Server Talk > Scripting Releases
cube v1.6.1 - CTF/INF Ultimate Balancer
freestyler:
Sure, but is there any reliable way of detecting round end? I found no scripting event for this. Is checking if everyone's dead the only way?
Mittsu:
i have no idea about coding, but maybe this script will help? It prevents from scoring with flag caps after the round is already won by killing the other team:
--- Code: ---var
Double, Alone, Messages: boolean;
PlayerPnts, TeamPnts: byte;
Color: longint;
function AlivePlayers(Team: shortint): byte;
var
i: byte;
begin
for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) and (GetPlayerStat(i,'Alive') = true) and ((Team = -1) or (GetPlayerStat(i,'Team') = Team)) then Result := Result + 1;
end;
procedure ActivateServer();
begin
try
if ReadINI('scripts/' + ScriptName + '/settings.ini','General','Message','true') = 'true' then Messages := true else Messages := false;
Color := StrtoInt(ReadINI('scripts/' + ScriptName + '/settings.ini','General','MsgColor','$FFFFFFFF'));
PlayerPnts := StrtoInt(ReadINI('scripts/' + ScriptName + '/settings.ini','General','PlayerPnts','5'));
TeamPnts := StrtoInt(ReadINI('scripts/' + ScriptName + '/settings.ini','General','TeamPnts','1'));
if ReadINI('scripts/' + ScriptName + '/settings.ini','General','DoubleCap','false') = 'true' then Double := true else Double := false;
if ReadINI('scripts/' + ScriptName + '/settings.ini','General','AloneCap','false') = 'true' then Alone := true else Alone := false;
except
WriteLn('Error while loading settings.');
end;
end;
procedure OnFlagScore(ID, TeamFlag: byte);
var
i: byte;
begin
if iif(TeamFlag = 1,AlphaPlayers,BravoPlayers) = 0 then begin
if Alone = false then begin
SetTeamScore(iif(TeamFlag = 1,2,1),iif(TeamFlag = 1,BravoScore,AlphaScore) - 1);
if Messages then WriteConsole(ID,'Capturing while alone has no effect.',Color);
end else begin
SetTeamScore(iif(TeamFlag = 1,2,1),iif(TeamFlag = 1,BravoScore,AlphaScore) - 1 + TeamPnts);
end;
end else if AlivePlayers(TeamFlag) = 0 then begin
if Double = false then begin
SetTeamScore(iif(TeamFlag = 1,2,1),iif(TeamFlag = 1,BravoScore,AlphaScore) - 1);
if Messages then WriteConsole(ID,'Double capturing has no effect.',Color);
end else begin
SetTeamScore(iif(TeamFlag = 1,2,1),iif(TeamFlag = 1,BravoScore,AlphaScore) - 1 + TeamPnts);
end;
end else begin
SetTeamScore(iif(TeamFlag = 1,2,1),iif(TeamFlag = 1,BravoScore,AlphaScore) - 1 + TeamPnts);
end;
end;
--- End code ---
rOy:
Hey,
freestyler's script again uploaded! (cube v1.6.1)
The link has long since disappeared!
But here you have the file pin!
Navigation
[0] Message Index
[*] Previous page
Go to full version