Well, I'm new with these scripts, to the language and everything, so I need some help.
Here is my code:
type
TPlayer = record
nick: string;
kills: integer;
deaths: integer;
end;
var
P: array of TPlayer;
PT: array of TPlayer;
sending: boolean;
procedure ActivateServer();
begin
sending := false;
end;
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
var
k_nick, v_nick: string;
i, c: integer;
player: array of TPlayer;
k, v: boolean;
begin
k_nick := IDToName(Killer);
v_nick := IDToName(Victim);
//Search name on arrays and update kills and deaths
player := P;
if sending = true then begin
player := PT;
end;
c := Length(player) - 1;
k := false;
v := false;
for i := 0 to c do
begin
if player.nick = k_nick then begin
player.kills := player.kills + 1;
k := true;
end;
if player.nick = v_nick then begin
player.deaths := player.deaths + 1;
v := true;
end;
if k = true and v = true
then i := c + 1;
end;
if k = false then begin
SetLength(player, c + 2);
player[c + 1].kills := 1;
player[c + 1].deaths := 0;
player[c + 1].nick := k_nick;
end;
if v = false then begin
SetLength(player, c + 2);
player[c + 1].kills := 0;
player[c + 1].deaths := 1;
player[c + 1].nick := v_nick;
end;
end;
function Send();
var
i, c: integer;
result: string;
error: boolean;
begin
sending := true;
//Send data
c := Length(P) - 1;
error := false;
for i := 0 to c do
begin
result := GetURL([...]);
if result <> "SUCCESS" then
begin
error := true;
i := c + 1;
end
else
begin
P.kills := 0;
P.deaths := 0;
end;
end;
if error == false then begin
SetLength(P, 0);
P := Copy(PT, 0, Length(PT));
SetLength(PT, 0);
end;
sending := false;
end;
procedure AppOnIdle(Ticks: integer);
begin
if Ticks mod (3600*5) = 0 then begin
Send();
end;
end;
I get a type mismatch error when i try to run it. Is there a way to know on what line the error is?
My only guess is that I messed up things assignig player = P, which are arrays, but i want to make sure with your help.
I'm sorry for posting the whole code, but i really don't know where the error is.