Author Topic: ID Kills  (Read 1464 times)

0 Members and 1 Guest are viewing this topic.

Offline 1221995

  • Soldier
  • **
  • Posts: 206
ID Kills
« on: September 09, 2007, 08:27:23 am »
Alright. Im Making a script. I want to be able to write "kill 3" and number 3 dies or "kill 1" number 1 dies, etc. (1-999 able to kill). How do I make it so you can kill any number (what function would i use to pull this off)?

Thanks
1221995

P.S.
Respond ASAP ;D

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: ID Kills
« Reply #1 on: September 09, 2007, 08:38:54 am »
Using OnPlayerSpeak, and having DoDamage(##,4000) or Command('/kill ' + InttoStr(##))
Remember you have to have StrtoInt to change the part of the string to an integer..
To get part of a string, theres 2 ways..
Copy and GetPiece
Copy juts gets part of a string starting at the 2nd argument and ending at the 3rd argument, so Copy('this is a test',6,9) = 'is a'
GetPiece is kind of like Split, except you don't have to store it into a variable and get part of it.. 2nd argument is the separator, and 3rd is the array # thingy (i don't know what to call it), example: GetPiece('this is a test',' ',2) = 'a'

Offline 1221995

  • Soldier
  • **
  • Posts: 206
Re: ID Kills
« Reply #2 on: September 09, 2007, 08:42:16 am »
Hi DorkeyDear. I Just Found out on Enesce.com/help, but thanks for responding :) ;D .  I found that i could do it differently. Take a look.
Code: [Select]
var

procedure DoDamage(ID: Byte; Damage: Integer)
begin
If Text'/kill (ID)' then begin
DoDamage((ID), 16000);
end;
end;

You know what that means? I CANM CHOOSE HOW MUCH DAMAGE IT DOES WHILE PLAYING!!! ILL post how in a minute...
« Last Edit: September 09, 2007, 08:43:49 am by 1221995 »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: ID Kills
« Reply #3 on: September 09, 2007, 09:17:58 am »
Uh no, that code does not work. I really wish you would stop writing random code on the forum that you clearly haven't even tested, its extremely moronic.

Offline 1221995

  • Soldier
  • **
  • Posts: 206
Re: ID Kills
« Reply #4 on: September 09, 2007, 10:06:02 am »
Actually, it did work, but it WASNT because of the script...  [retard] :-X

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: ID Kills
« Reply #5 on: September 09, 2007, 05:13:48 pm »
How about my dodamage controller script (I make a lot of scripts to control all of these wonderful functions EnEsCe has supplied to us)

Code: [Select]
function OnCommand(ID:Byte;Text:string):boolean;
var
  DPlr: Byte;
  DmgI: integer;
begin
//-----DoDamage-----
  if GetPiece(LowerCase(Text), ' ', 0) = '/dodamage' then begin
    DPlr:=strtoint(GetPiece(Text, ' ', 1));
    DmgI:=strtoint(GetPiece(Text, ' ', 2));
    if GetPlayerStat(DPlr,'Active') = true then begin
      DoDamage(DPlr,DmgI);
    end;
    if GetPlayerStat(DPlr,'Active') = false then begin
      SayToPlayer(ID,'Player number to damage is inactive.');
    end;
    if (DmgI = 150) then begin
      SayToPlayer(ID,'Perfect Kill!');
    end;
  end;
end;

Example:
'/dodamage 1 150' kills player one (150 gets "perfect kill")

(the "//-----DoDamage-----" line is the title of the script)

Date Posted: September 09, 2007, 06:04:43 PM
......
Code: [Select]
procedure DoDamage(ID: Byte; Damage: Integer)
begin
If Text'/kill (ID)' then begin
DoDamage((ID), 16000);
end;
end;
......

the correct way to do this would be:

Code: [Select]
function OnCommand(ID:Byte;Text:string):boolean;
begin
  Result:=false;
  if GetPiece(LowerCase(Text), ' ', 0) = '/kill' then begin
    DoDamage(GetPiece((Text), ' ', 1),4000);
  end;
end;

but what you are trying to do is already possible if you are an admin

(/kill *) (* = player number)
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline 1221995

  • Soldier
  • **
  • Posts: 206
Re: ID Kills
« Reply #6 on: October 14, 2007, 02:29:29 pm »
ok thx

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: ID Kills
« Reply #7 on: October 14, 2007, 04:16:24 pm »
'/dodamage 1 150' kills player one (150 gets "perfect kill")
unless he has a vest on; if i remember correctly, the damage acts like a bullet, and effects ~half and half onto vest and person's health (not sure exactly how much goes to what and when, but wahtever)

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: ID Kills
« Reply #8 on: October 15, 2007, 12:55:24 pm »
oh, never thought of that...

I've simplified the "correct way" script I made...

Code: [Select]
function OnCommand(ID:Byte;Text:string):boolean;
begin
  Result:=false;
  if GetPiece(LowerCase(Text), ' ', 0) = '/kill' then DoDamage(GetPiece((Text), ' ', 1),4000);
end;

a small change, made code cleaner and smaller and took out a begin and end;
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."