0 Members and 1 Guest are viewing this topic.
//Enemy count display script by Avarax.const DefaultColor = $CFFF00; DefaultX = 40; DefaultY = 380; type tPlayer = record X,Y: integer; Color: longint; Display,cd: boolean; end;var Active,Alive: array[1..2] of byte; player: array[1..32] of tPlayer;procedure OnJoinTeam(ID, Team: byte);begin WriteConsole(ID,'This server uses Ava''s enemy count display script.',DefaultColor); WriteConsole(ID,'To display commands, use /cmd.',DefaultColor);end;procedure ActivateServer();var i: byte;begin for i:=1 to 32 do begin player[i].color:=DefaultColor; player[i].X:=DefaultX; player[i].Y:=DefaultY; player[i].display:=true; player[i].cd:=true; end;end;procedure CountPlayers();var i: byte;begin Active[1]:=0; Alive[1]:=0; Active[2]:=0; Alive[2]:=0; for i:=1 to 32 do begin If GetPlayerStat(i,'Active') = true then case GetPlayerStat(i,'Team') of 1: begin Active[1]:=Active[1]+1; If GetPlayerStat(i,'Alive') = true then Alive[1]:=Alive[1]+1; end; 2: begin Active[2]:=Active[2]+1; If GetPlayerStat(i,'Alive') = true then Alive[2]:=Alive[2]+1; end; end; end;end;procedure DisplayPlayers();var i: byte;begin for i:=1 to 32 do If (GetPlayerStat(i,'Active') = true) and (player[i].display = true) then begin If player[i].cd then player[i].cd:=false else case GetPlayerStat(i,'Team') of 1: DrawText(i,'Bravo: ' + inttostr(Alive[2]) + '/' + inttostr(Active[2]),200,player[i].color,0.08,player[i].X,player[i].Y); 2: DrawText(i,'Alpha: ' + inttostr(Alive[1]) + '/' + inttostr(Active[1]),200,player[i].color,0.08,player[i].X,player[i].Y); end; end;end;function xsplit(const source: string; const delimiter: string):TStringArray;vari,x,d:integer;s:string;begind:=length(delimiter);x:=0;i:=1;SetArrayLength(Result,1);while(i<=length(source)) do begins:=Copy(source,i,d); if(s=delimiter) then begin inc(i,d); inc(x,1); SetArrayLength(result,x+1); end else begin result[x]:= result[x]+Copy(s,1,1); inc(i,1); end;end;end;procedure AppOnIdle(Ticks: integer);begin CountPlayers; DisplayPlayers;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;var temp: TStringArray; color: array[1..3] of integer;begin case lowercase(copy(text,1,4)) of '/cmd': begin WriteConsole(ID,'.------------Enemy count script commands------------.',player[ID].color); WriteConsole(ID,'| /cmd : Shows these commands |',player[ID].color); WriteConsole(ID,'| /posx # : Sets X position for msgs to # |',player[ID].color); WriteConsole(ID,'| /posy # : Sets Y position for msgs to # |',player[ID].color); WriteConsole(ID,'| /cl R G B: Sets red, green & blue values for msgs |',player[ID].color); WriteConsole(ID,'| /display : Dis/Enables msgs (default = on) |',player[ID].color); WriteConsole(ID,'''-----------------Script by Avarax------------------''',player[ID].color); end; '/dis': case player[ID].display of true: begin player[ID].display:=false; WriteConsole(ID,'Enemy count message is now disabled.',player[ID].color); end; false:begin player[ID].display:=true; WriteConsole(ID,'Enemy count message is now enabled.',player[ID].color); end; end; '/cl ': begin temp:=xsplit(text,' '); case GetArrayLength(temp) of 1: WriteConsole(ID,'Red, green & blue values missing (0-255)',player[ID].color); 2: WriteConsole(ID,'Green & blue values missing (0-255)',player[ID].color); 3: WriteConsole(ID,'Blue value missing (0-255)',player[ID].color); 4: begin try color[1]:=strtoint(temp[1]); If (color[1] < 0) or (color[1] > 255) then begin WriteConsole(ID,'Color values must be numbers between 0 and 255',$FF0000) exit; end else WriteConsole(ID,'New red value: ' + inttostr(color[1]),$FF0000); color[2]:=strtoint(temp[2]); If (color[2] < 0) or (color[2] > 255) then begin WriteConsole(ID,'Color values must be numbers between 0 and 255',$00FF00) exit; end else WriteConsole(ID,'New green value: ' + inttostr(color[2]),$00FF00); color[3]:=strtoint(temp[3]); If (color[3] < 0) or (color[3] > 255) then begin WriteConsole(ID,'Color values must be numbers between 0 and 255',$0000FF) exit; end else WriteConsole(ID,'New blue value: ' + inttostr(color[3]),$0000FF); player[ID].color:=RGB(color[1],color[2],color[3]); WriteConsole(ID,'YOUR NEW COLOR.',player[ID].color); except WriteConsole(ID,'Color values must be numbers between 0 and 255',player[ID].color); end; end; end; end; '/pos':begin temp:=xsplit(lowercase(text),' '); case temp[0] of '/posx':try player[ID].X:=strtoint(temp[1]); WriteConsole(ID,'New coordinates: ' + inttostr(player[ID].X) + '|' + inttostr(player[ID].Y),player[ID].color); except WriteConsole(ID,'Please use numbers as X/Y values',player[ID].color); end; '/posy':try player[ID].Y:=strtoint(temp[1]); WriteConsole(ID,'New coordinates: ' + inttostr(player[ID].X) + '|' + inttostr(player[ID].Y),player[ID].color); except WriteConsole(ID,'Please use numbers as X/Y values',player[ID].color); end; end; end; end; result:=false;end;procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);begin player[Killer].cd:=true; player[Victim].cd:=true;end;
i would get it but idk how to put it into my games =\
Nice job, the setting of the pos reminds me of my cs script, had something just like that Quote from: ZomgProniss on January 11, 2009, 06:23:46 pmi would get it but idk how to put it into my games =\its a server-side script