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

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Can i do like ...
« 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;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Can i do like ...
« Reply #1 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.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #2 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''!

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #3 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;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #4 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;

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Can i do like ...
« Reply #5 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;
?


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #6 on: March 23, 2010, 06:54:48 am »
I don't use that !

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Can i do like ...
« Reply #7 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.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #8 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 ?

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Can i do like ...
« Reply #9 on: March 23, 2010, 04:57:33 pm »
[saw]  on 1.5.1

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #10 on: March 23, 2010, 05:00:35 pm »
OMG !

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Can i do like ...
« Reply #11 on: March 23, 2010, 11:36:57 pm »
As you should notice the /facepalm is separated from the information below.

edit: /triplefacepalm btw

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #12 on: March 24, 2010, 05:36:45 am »
WTF !!!
i don't understand the facepalm !

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #13 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.
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #14 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 ?

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #15 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;
« Last Edit: March 24, 2010, 07:25:42 am by Stuffy »
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #16 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;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Can i do like ...
« Reply #17 on: March 24, 2010, 11:29:57 pm »
Close, OnPlayerKill() has to be under DropLoot()

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #18 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;


Offline Underworld

  • Camper
  • ***
  • Posts: 338
  • Mapper
Re: Can i do like ...
« Reply #19 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!
I don't understand
do you mean that there is a /faceplam commmand ?
and this command should drop a random item ?

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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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: 557
  • 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

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Can i do like ...
« Reply #40 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;
The truth is out there? Does anyone know the URL?
The URL is here

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #41 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

Offline ShadowDancer

  • Major(1)
  • Posts: 22
Re: Can i do like ...
« Reply #42 on: March 26, 2010, 10:58:55 am »
PM me, i will answer your questions. If you can, send me full script file.
Sorry, I'm not native English speaker...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Can i do like ...
« Reply #43 on: March 26, 2010, 11:07:22 am »
i have like 10 script i dont make one with all ^^

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Can i do like ...
« Reply #44 on: April 02, 2010, 04:18:01 am »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Diretlani

  • Major(1)
  • Posts: 16