Author Topic: Can i do like ...  (Read 11888 times)

0 Members and 2 Guests are viewing this topic.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #20 on: March 25, 2010, 09:41:58 am »
Mich, post us the error the server outputs please.
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #21 on: March 25, 2010, 06:18:08 pm »
The error message :

Code: [Select]
[*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:27:52  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:27:56  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:00  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:00  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:05  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:05  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:05  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:05  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:05  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06  [*] [Error] wa -> (OnPlayerKill): Invalid parameter
10-03-25 06:28:06 [*] Too many script errors! Shutting down server -> "wa"
10-03-25 06:28:06 Shutting down server...
10-03-25 06:28:06 Shutting down FileServer...
10-03-25 06:28:06 Shutting down admin server...
10-03-25 06:28:06 Shutting down ScriptCore...

From: March 25, 2010, 07:04:27 pm
And Stuffy how you've know my name ?
« Last Edit: March 25, 2010, 07:04:27 pm by mich1103 »

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #22 on: March 25, 2010, 07:04:32 pm »
Even though the enesce.com/help clearly says
Quote
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);

It MUST be (on my test server anyway, it was causing the exact errors mich just mentioned):
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte; Weapon: String);


Also, this should work for doing a chance to do something, as it says you need in your sig:
Code: [Select]
procedure DropLoot(ID,Killer: byte);
var drop: byte; loot: string;
begin
drop := 255;
if getplayerstat(ID,'human')=false then case getplayerstat(ID,'name') of
'Zombie': drop := choose([1,16,17]);
'Elite Zombie': drop := choose([18,19,22,5]);
end;
if drop = 255 then drop := choose([1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22]);
case drop of
1: loot := 'Desert Eagle';
2: loot := 'HK MP5';
3: loot := 'AK 74';
4: loot := 'Steyr AUG';
5: loot := 'Spas 12';
6: loot := 'Ruger77';
7: loot := 'M79';
8: loot := 'Barrett M82A1';
9: loot := 'Minimi';
10: loot := 'Minigun';
11: loot := 'USSOCOM';
12: loot := 'Combat Knife';
13: loot := 'Chainsaw';
14: loot := 'LAW';
15: loot := 'Stationary Gun';
16: loot := 'Medical Kit';
17: loot := 'Grenade Kit';
18: loot := 'Flamer Kit';
19: loot := 'Vest Kit';
20: loot := 'Predator Kit';
21: loot := 'Berserk Kit';
22: loot := 'Cluster Kit';
end;
if (drop >= 1) AND (drop <= 22) then begin
spawnobject(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,drop);
writeconsole(Killer,'Looted -:- ' + loot ,$ff5555ff);
end;
end;

function Chance(Perc: single): boolean;
begin
result := (strtofloat(inttostr(random(0,101)))/100.0 < perc);
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if chance(0.5) then droploot(victim,killer); // 50% chance of dropping loot, 0.2 would be a 20% chance, ect
end;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #23 on: March 25, 2010, 07:08:18 pm »
Hmmm ...  :'(
Error :
 
Code: [Select]
10-03-25 20:05:48  [*] Compiling wa -> wa.pas...
10-03-25 20:05:48  [*] wa -> [Error] (7:20): Unknown identifier 'choose'
10-03-25 20:05:48  [*] Compilation Failed.
10-03-25 20:05:48 Shutting down server...
10-03-25 20:05:48 Shutting down admin server...
10-03-25 20:05:49 Shutting down ScriptCore...

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #24 on: March 25, 2010, 07:30:21 pm »
You need the choose from my previous post.

( with choose() )
Code: [Select]
function Choose(Input: array of variant): variant;
var i,len: integer;
begin
len := getarraylength(input);
i := random(0,len);
if i < 0 then i := 0;
if i > len-1 then i := len-1;
result := input[i];
end;

procedure DropLoot(ID,Killer: byte);
var drop: byte; loot: string;
begin
drop := 255;
if getplayerstat(ID,'human')=false then case getplayerstat(ID,'name') of
'Zombie': drop := choose([1,16,17]);
'Elite Zombie': drop := choose([18,19,22,5]);
end;
if drop = 255 then drop := choose([1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22]);
case drop of
1: loot := 'Desert Eagle';
2: loot := 'HK MP5';
3: loot := 'AK 74';
4: loot := 'Steyr AUG';
5: loot := 'Spas 12';
6: loot := 'Ruger77';
7: loot := 'M79';
8: loot := 'Barrett M82A1';
9: loot := 'Minimi';
10: loot := 'Minigun';
11: loot := 'USSOCOM';
12: loot := 'Combat Knife';
13: loot := 'Chainsaw';
14: loot := 'LAW';
15: loot := 'Stationary Gun';
16: loot := 'Medical Kit';
17: loot := 'Grenade Kit';
18: loot := 'Flamer Kit';
19: loot := 'Vest Kit';
20: loot := 'Predator Kit';
21: loot := 'Berserk Kit';
22: loot := 'Cluster Kit';
end;
if (drop >= 1) AND (drop <= 22) then begin
spawnobject(getplayerstat(ID,'x'),getplayerstat(ID,'y')-11,drop);
writeconsole(Killer,'Looted -:- ' + loot ,$ff5555ff);
end;
end;

function Chance(Perc: single): boolean;
begin
result := (strtofloat(inttostr(random(0,101)))/100.0 < perc);
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if chance(0.5) then droploot(victim,killer); // 50% chance of dropping loot, 0.2 would be a 20% chance, ect
end;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #25 on: March 25, 2010, 07:50:42 pm »
Thanks man that's work !!! ;D
But i have another problem ... :-\
i have a simple script that when a player want to join bravo team that put it on the alpha team   

Code: [Select]
const
   ZombieTeam = 2; // Team of zombies
 
procedure OnJoinTeam(ID, Team: byte);
begin
 
  if Team = ZombieTeam then
    Command('/setteam' + iif(ZombieTeam = 2, '1', '2') + ' ' + inttostr(ID));
 
 end;

But i want when a alpha player die that put it into bravo team!
i can ???

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #26 on: March 25, 2010, 08:11:08 pm »
Untested but it should work:

Code: [Select]
type plr = record
targetteam: byte;
end;

var
players: array[1..32] of plr;

procedure ConstrainTeam(ID, CurTeam: Byte);
begin
if curteam <> players[ID].targetteam then command('/setteam'+inttostr(players[ID].targetteam)+' '+inttostr(id));
end;

procedure OnJoinGame(ID, Team: Byte);
begin
players[ID].targetteam := iif(getplayerstat(ID,'human'),1,2);
end;

procedure OnJoinTeam(ID, Team: Byte);
begin
constrainteam(ID,team);
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if players[victim].targetteam = 1 then players[victim].targetteam := 2 else players[victim].targetteam := 1;
constrainteam(victim,getplayerstat(victim,'team'));
end;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #27 on: March 25, 2010, 08:23:43 pm »
The script lagg too much XD

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #28 on: March 25, 2010, 08:55:09 pm »
I am at a total loss to what could be causing that...

With this trimmed code below i confirm that targteam and team are the same yet it finds them to be different and runs command(setteam) again causing an infinite loop... Someone else here, please tell me what in gods name is wrong.

Code: [Select]
type plr = record
targetteam: byte;
end;

var
players: array[1..32] of plr;

procedure OnJoinGame(ID, Team: Byte);
begin
players[ID].targetteam := iif(getplayerstat(ID,'human'),1,2);
end;

procedure OnJoinTeam(ID, Team: Byte);
begin
if team <> 5 then if team <> players[ID].targetteam then command('/setteam'+inttostr(players[ID].targetteam)+' '+inttostr(id));
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if killer <> victim then begin
if players[victim].targetteam = 1 then players[victim].targetteam := 2 else players[victim].targetteam := 1;
command('/setteam'+inttostr(players[victim].targetteam)+' '+inttostr(victim));
end;
end;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #29 on: March 25, 2010, 09:01:49 pm »
thats dont work because when i kill a zombie the zombie join alpha XD
i just want when a bravo player kill a alpha player that put the alpha player who got killed in the bravo team !!!


From: March 25, 2010, 09:04:55 pm
And can you put that all player and bot cant go on charlie and delta team ???
« Last Edit: March 25, 2010, 09:04:55 pm by mich1103 »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Can i do like ...
« Reply #30 on: March 25, 2010, 11:37:34 pm »
And Stuffy how you've know my name ?
Because it's your nick and nick is something we can see?

Code: [Select]
var
  Died: array[1..32] of boolean;

procedure OnJoinGame(ID, Team: byte);
begin
  Dead[ID]:= false;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  if Dead[ID] and (Team <> 2) and (Team <> 5) then Command('/setteam2 ' + IntToStr(ID));
end;

procedure OnPlayerRespawn(ID: byte);
begin
  if Dead[ID] then Command('/setteam2 ' + IntToStr(ID));
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  Dead[Victim]:= true;
end;
Simple and sexy.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #31 on: March 26, 2010, 05:04:15 am »
Error ... 10-03-26 06:03:39 


Code: [Select]
[*] Zombie infections -> [Error] (7:3): Unknown identifier 'Dead'
10-03-26 06:03:39  [*] Compilation Failed.
10-03-26 06:03:39 Shutting down server...
10-03-26 06:03:39 Shutting down admin server...
10-03-26 06:03:39 Shutting down ScriptCore...

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Can i do like ...
« Reply #32 on: March 26, 2010, 07:48:37 am »
Gizd, I lol'd when I've read the error mich posted, epicfail :D

mich, try to look at the code and learn the error messages.
In this case it's missing the variable "Dead".
Search for var in the code, and look if it is declared, if not create it.
In this case Gizd named it "Died" instead of "Dead", that's why it's not working.
Replace "Died" with "Dead" and it works.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #33 on: March 26, 2010, 08:04:28 am »
hmmmm very strange error...
ive change dead to died and when i got killed by a zombie or a kill myself that say soldatserver.exe has stop to work and no error is say on the log...

From: March 26, 2010, 08:19:18 am
Swompie i just want a script that you have in your server
when a alpha player get killed by a zombie(bravo team)that put the alpha player who got killed in the bravo team and he will not be able to go on alpha before the next game. I will do the other part of the script like when is no more player on alpha team then nextmap...
« Last Edit: March 26, 2010, 08:19:18 am by mich1103 »

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #34 on: March 26, 2010, 09:24:22 am »
hmm try this:

Code: [Select]
var
Killed : array[1..32] of boolean;
Total, TotalB : integer;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: String);

begin

if GetPlayerStat(Victim,'Team') = 1 and GetPlayerStat(Victim,'Human') then begin
Killed[Victim] := true;
WriteConsole(0, 'Player ' + IdToName(Victim) + 'has been killed by an zombie and is now infected.', $123456);
Command('/setteam2' + IntToStr(Victim));
TotalB := TotalB +1;

end;
end;

procedure OnJoinTeam(ID, Team: byte);

var
i : integer;

begin

if (Killed[ID]) and (Team <> 5) then begin
Command('/setteam2' + IntToStr(ID));
WriteConsole(ID, 'You are infected!', $123456);
end;

if Total = TotalB then begin
WriteConsole(0, 'Everyone has been infected!!!', $123456);
for i := 1 to 32 do
Killed[i] := false;
for i := 1 to 32 do
Command('/setteam1' + IntToStr(i))
Command('/nextmap');

end;
end;

procedure OnJoinGame(ID, Team: byte);

begin

if GetPlayerStat(ID,'Human') then
Total := Total +1;

end;

Not tested!
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #35 on: March 26, 2010, 09:38:47 am »
Ok i found 2 bug
1-when i go on charlie that put me on alpha and that say soldatserver.exe has stop to work...
2-when i got killed by a zombie that dont put me on the bravo team !!!

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #36 on: March 26, 2010, 09:44:54 am »
Modified, try this:

Code: [Select]
var
Killed : array[1..32] of boolean;
Total, TotalB : integer;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: String);

begin

if GetPlayerStat(Victim,'Team') = 1 and GetPlayerStat(Victim,'Human') then begin
Killed[Victim] := true;
WriteConsole(0, 'Player ' + IdToName(Victim) + 'has been killed by an zombie and is now infected.', $123456);
Command('/setteam2 ' + IntToStr(Victim));
TotalB := TotalB +1;

end;
end;

procedure OnMapChange(NewMap: String);

var
i : integer;

begin
TotalB := 0;

if GetPlayerStat(i,'Human') then
Command('/setteam1 ' + IntToStr(i))

end;

procedure OnJoinTeam(ID, Team: byte);

var
i : integer;

begin

if (Killed[ID]) and (Team <> 5) and (Team <> 2) then begin
Command('/setteam2 ' + IntToStr(ID));
WriteConsole(ID, 'You are infected!', $123456);
end;

if Total = TotalB then begin
WriteConsole(0, 'Everyone has been infected!!!', $123456);
for i := 1 to 32 do
Killed[i] := false;
Command('/nextmap');

end;
end;

procedure OnJoinGame(ID, Team: byte);

begin

if GetPlayerStat(ID,'Human') then
Total := Total +1;

end;
« Last Edit: March 26, 2010, 10:02:01 am by Stuffy »
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #37 on: March 26, 2010, 10:00:31 am »
when i join the game i can go on all team
when i got infected i can go on all team and when i join another team that say
All player are infected ...
and the game end(/nextmap)

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #38 on: March 26, 2010, 10:02:27 am »
try my code again, modified it.
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #39 on: March 26, 2010, 10:11:01 am »
The script dont work more ...
same error