Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: mich1103 on March 21, 2010, 03:30:03 pm

Title: Can i do like ...
Post by: mich1103 on March 21, 2010, 03:30:03 pm
I've seen this topic : http://forums.soldat.pl/index.php?topic=32697.0
About looting ...
Can i do like :

Code: [Select]
procedure DropLoot(ID,Killer: byte);
var rand,drop: byte;
    loot: string;
begin
//WriteConsole(Killer,'You've just looted a item.',$ff5555ff);
    loot := '';
    drop := 0;
    rand := Random(0,100);
    case IGB[ID].bname of
      'Zombie': begin
        if rand >= 75 then begin
          if rand >= 85 then begin
            if rand >= 90 then begin
              drop := 16;
           
            end else drop := 17;
            end else drop := 18;
            end else drop := 19;
            end else drop := 20;
            end else drop := 21;
            end else drop := 22;
            end else drop := 23;
        end;
      end;
     
    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 > 0 then begin
        SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),drop);
      WriteConsole(Killer,'Looted -:- ' + loot ,$ff5555ff);
    end;
  end;
Title: Re: Can i do like ...
Post by: Gizd on March 22, 2010, 09:30:30 am
Say what changed because most of people won't even start to compare these scripts and it's you who should care about the answer.
Title: Re: Can i do like ...
Post by: mich1103 on March 22, 2010, 03:18:16 pm
The script i've put is not good i just want to make a script that when the bot named ''Zombie'' die there is 25% to drop one of this item :
      'Medical Kit'
      'Grenade Kit';
      'Flamer Kit';
      'Vest Kit';
      'Predator Kit';
      'Berserk Kit';
      'Cluster Kit';
and i want thats say like :
You've just looted a''THE LOOT HERE''!
Title: Re: Can i do like ...
Post by: Hacktank on March 22, 2010, 04:00:19 pm
Heres what i use:

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 begin
case getplayerstat(ID,'name') of
'Zombie': drop := choose([1,16,17]);
'Elite Zombie': drop := choose([18,19,22,5]);
                // just copypaste and edit whats in the choose to get different drops
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]);
end else 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;
Title: Re: Can i do like ...
Post by: mich1103 on March 22, 2010, 04:29:57 pm
i've used that and the script has passed but there is no drop !
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 begin
case getplayerstat(ID,'name') of
'Zombie': drop := choose([22,21,20,19,18,16,17])
                // just copypaste and edit whats in the choose to get different drops
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]);
end else 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;
Title: Re: Can i do like ...
Post by: Hacktank on March 22, 2010, 10:37:33 pm
How are you using it? Like:

Code: [Select]
onplayerkill(killer,victim: byte);
begin
droploot(victim,killer);
end;
?
Title: Re: Can i do like ...
Post by: mich1103 on March 23, 2010, 06:54:48 am
I don't use that !
Title: Re: Can i do like ...
Post by: Gizd on March 23, 2010, 08:29:22 am
/facepalm

It's a procedure dropping random item at player's location, you need to use it in a build-in event.
Title: Re: Can i do like ...
Post by: mich1103 on March 23, 2010, 02:55:42 pm
I don't understand
do you mean that there is a /faceplam commmand ?
and this command should drop a random item ?
Title: Re: Can i do like ...
Post by: Mercury92 on March 23, 2010, 04:57:33 pm
(http://cdn2.knowyourmeme.com/i/15945/original/Double_Facepalm_by_ScotlandForLife.jpg)
Title: Re: Can i do like ...
Post by: mich1103 on March 23, 2010, 05:00:35 pm
OMG !
Title: Re: Can i do like ...
Post by: Gizd on March 23, 2010, 11:36:57 pm
As you should notice the /facepalm is separated from the information below.

edit: /triplefacepalm btw
Title: Re: Can i do like ...
Post by: mich1103 on March 24, 2010, 05:36:45 am
WTF !!!
i don't understand the facepalm !
Title: Re: Can i do like ...
Post by: Stuffy on March 24, 2010, 06:30:04 am
Mich, what you've done in the script is only the procedure, but you need to call it somewhere. Just paste the code Hacktank wrote into your script.
Title: Re: Can i do like ...
Post by: mich1103 on March 24, 2010, 07:00:33 am
i don't have script !
i want to make one !
but the HT script is what i need to use ?
Title: Re: Can i do like ...
Post by: Stuffy on March 24, 2010, 07:20:59 am
Well just paste the code from your first post into a .pas file and add this:

Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
DropLoot(Victim, Killer);
end;
Title: Re: Can i do like ...
Post by: mich1103 on March 24, 2010, 03:09:37 pm
Like that ?
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
DropLoot(Victim, Killer);
end;

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 begin
case getplayerstat(ID,'name') of
'Zombie': drop := choose([22,21,20,19,18,16,17])
                // just copypaste and edit whats in the choose to get different drops
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]);
end else 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;
Title: Re: Can i do like ...
Post by: Gizd on March 24, 2010, 11:29:57 pm
Close, OnPlayerKill() has to be under DropLoot()
Title: Re: Can i do like ...
Post by: mich1103 on March 25, 2010, 05:29:31 am
The script has passed but after 2 min ive started teh server the server crash !!!
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 begin
case getplayerstat(ID,'name') of
'Zombie': drop := choose([22,21,20,19,18,16,17])
                // just copypaste and edit whats in the choose to get different drops
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]);
end else 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;

procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
DropLoot(Victim, Killer);
end;

Title: Re: Can i do like ...
Post by: Underworld on March 25, 2010, 09:36:37 am
I don't understand
do you mean that there is a /faceplam commmand ?
and this command should drop a random item ?
OMFG i never have lolled so hard in my life before never!
Title: Re: Can i do like ...
Post by: Stuffy on March 25, 2010, 09:41:58 am
Mich, post us the error the server outputs please.
Title: Re: Can i do like ...
Post by: mich1103 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 ?
Title: Re: Can i do like ...
Post by: Hacktank 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;
Title: Re: Can i do like ...
Post by: mich1103 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...
Title: Re: Can i do like ...
Post by: Hacktank 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;
Title: Re: Can i do like ...
Post by: mich1103 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 ???
Title: Re: Can i do like ...
Post by: Hacktank 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;
Title: Re: Can i do like ...
Post by: mich1103 on March 25, 2010, 08:23:43 pm
The script lagg too much XD
Title: Re: Can i do like ...
Post by: Hacktank 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;
Title: Re: Can i do like ...
Post by: mich1103 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 ???
Title: Re: Can i do like ...
Post by: Gizd 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.
Title: Re: Can i do like ...
Post by: mich1103 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...
Title: Re: Can i do like ...
Post by: y0uRd34th 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.
Title: Re: Can i do like ...
Post by: mich1103 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...
Title: Re: Can i do like ...
Post by: Stuffy 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!
Title: Re: Can i do like ...
Post by: mich1103 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 !!!
Title: Re: Can i do like ...
Post by: Stuffy 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;
Title: Re: Can i do like ...
Post by: mich1103 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)
Title: Re: Can i do like ...
Post by: Stuffy on March 26, 2010, 10:02:27 am
try my code again, modified it.
Title: Re: Can i do like ...
Post by: mich1103 on March 26, 2010, 10:11:01 am
The script dont work more ...
same error
Title: Re: Can i do like ...
Post by: Stuffy on March 26, 2010, 10:16:04 am
Hmm this works fine for me.

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))

for i := 1 to 32 do 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 else if not (Killed[ID]) and (Team <> 1) and (Team <> 5) then Command('/setteam1 ' + IntToStr(ID));

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;
Title: Re: Can i do like ...
Post by: mich1103 on March 26, 2010, 10:44:47 am
that work but i got another problem
when all player are on bravo team that dont do /nextmap
if i try to go on another team that do /nextmap
Title: Re: Can i do like ...
Post by: ShadowDancer on March 26, 2010, 10:58:55 am
PM me, i will answer your questions. If you can, send me full script file.
Title: Re: Can i do like ...
Post by: mich1103 on March 26, 2010, 11:07:22 am
i have like 10 script i dont make one with all ^^
Title: Re: Can i do like ...
Post by: frosty on April 02, 2010, 04:18:01 am
(http://cdn2.knowyourmeme.com/i/15945/original/Double_Facepalm_by_ScotlandForLife.jpg)

LMFAO!!!!!
Title: Re: Can i do like ...
Post by: Diretlani on April 09, 2010, 10:36:44 pm
(http://cdn2.knowyourmeme.com/i/15945/original/Double_Facepalm_by_ScotlandForLife.jpg)

LMFAO!!!!!

LOL. SPAM?