Author Topic: Script question ! (learning ...)  (Read 3612 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
Script question ! (learning ...)
« on: June 14, 2010, 03:58:50 pm »
First ! Hi  ;D
Im really sorry for asking help for scripting, without give to you some break !

I got a problem with this script ! (I tried to go the far that i can ,now i need help for the random!)
Code: [Select]
const
  1 = bossname; 
  2 = bossname;
  3 = bossname;
  4 = bossname;
  5 = bossname;

procedure OnMapChange(NewMap: String);
 begin
  random = (Random(1,5)
   then begin
WriteConsole(0,''random' has been summoned kill him for reward !',$EE81FAA1);
Command('/addbot2 random');
end;
  end;

^
l l
l l
l l
l l
Here i want that when the map change a bot is added (Random(1,5)
1 should = to a name of bot !
2 same etc ...


Thanks for helping !
 :P

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #1 on: June 14, 2010, 04:17:42 pm »
Numerical names for variables/constants/functions are forbidden.
Name your constants like 1b, 2b, 3b etc...
"random=Random(1,5)" is also completely wrong: you need to declare a var with some unique name and then assign to it a value returned by "Random(...)" function...
« Last Edit: June 14, 2010, 04:20:54 pm by VirtualTT »

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Script question ! (learning ...)
« Reply #2 on: June 14, 2010, 04:19:47 pm »
Code: [Select]
procedure OnMapChange(NewMap: String);
var name: string
begin
name := 'default boss name';
case random(1,5) of
1: name := 'boss 1';
2: name := 'boss 2';
3: name := 'boss 3';
4: name := 'boss 4';
5: name := 'boss 5';
end;
writeconsole(0,name+' has been selected to kill you',$ffaa4444);
command('/addbot2 '+name);
end;


Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #3 on: June 14, 2010, 04:23:25 pm »
Code: [Select]
name := 'default boss name';What should this mean ?!?

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #4 on: June 14, 2010, 04:31:52 pm »
a proper code:

Code: (Pascal) [Select]
const
  PlainTextColour=$EE81FAA1;

// function description goes here
procedure SummonRandomBotBoss();
var
  NewBossName:string;
begin
  case Random(1,6) of // note that Random(1, 6) can return 1-5, but not 6!
    1: NewBossName := 'boss 1';
    2: NewBossName := 'boss 2';
    3: NewBossName := 'boss 3';
    4: NewBossName := 'boss 4';
    5: NewBossName := 'boss 5';
  end;
  Command('/addbot2 '+NewBossName);
  Writeconsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour);
end;

// STD event description goes here
procedure OnMapChange(NewMap: String);
begin
  SummonRandomBotBoss();
end;
« Last Edit: June 14, 2010, 04:38:49 pm by VirtualTT »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #5 on: June 14, 2010, 04:39:04 pm »
HT and VirtualTT You are very nice guy i hope there is not just me who know that !  :D
But now i want that when the boss is killed that kick him !

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #6 on: June 14, 2010, 04:44:23 pm »
Just make NewBossName as a global variable and write some new handler to the OnPlayerKill event which will check the victim and kick the boss bot if it was him...

Code: (Pascal) [Select]
const
  PlainTextColour=$EE81FAA1;

var
  NewBossName:string;
 
// function description goes here
procedure SummonRandomBotBoss();
begin
  case Random(1,6) of // note that Random(1, 6) can return 1-5, but not 6!
    1: NewBossName:='boss 1';
    2: NewBossName:='boss 2';
    3: NewBossName:='boss 3';
    4: NewBossName:='boss 4';
    5: NewBossName:='boss 5';
  end;
  Command('/addbot2 '+NewBossName);
  WriteConsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour);
end;

// function description goes here
procedure CheckBotBoss(Victim:byte);
begin
// assume that bot name is the same as bot file name
  if (IdToName(Victim)=NewBossName) then begin
    Command('/kick '+NewBossName);
    WriteConsole(0, NewBossName+' has been defited!', PlainTextColour);
  end;
end;

// function description goes here
procedure InitScript();
begin
  NewBossName:=''; // never forget to initialize all your variables!!!
end;

// STD event description goes here
procedure ActivateServer();
begin
    InitScript();
end;

// STD event description goes here
procedure OnMapChange(NewMap: String);
begin
  SummonRandomBotBoss();
end;

// STD event description goes here
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  CheckBotBoss(Victim);
end;

I really have nothing to do right now... Another 2 hours of video encoding (((
« Last Edit: June 14, 2010, 05:05:56 pm by VirtualTT »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #7 on: June 14, 2010, 05:02:12 pm »
Code: [Select]
[*] boom -> [Error] (9:29): colon (':') expected
Code: [Select]
const 
 PlainTextColour=$EE81FAA1; 
 
var 
 NewBossName:string; 
   
// function description goes here 
procedureSummonRandomBotBoss(); 
begin 
 caseRandom(1,6) of// note that Random(1, 6) can return 1-5, but not 6! 
   1: NewBossName := 'ViRuS ZoMbIe'; 
   2: NewBossName := 'GlAdIaToR ZoMbIe'; 
   3: NewBossName := 'CoWbOy ZoMbIe'; 
   4: NewBossName := 'SpArTaAa ZoMbIe'; 
   5: NewBossName := 'WTF ZoMbIe'; 
 end; 
 Command('/addbot2 '+NewBossName); 
 Writeconsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour); 
end; 
 
// function description goes here 
procedureCheckBotBoss(Victim:byte); 
begin 
 
end; 
 
procedureInitScript(); 
begin 
 NewBossName:=''; 
end; 
 
// STD event description goes here 
procedureActivateServer(); 
begin 
    InitScript(); 
end; 
 
// STD event description goes here 
procedureOnMapChange(NewMap: String); 
begin 
 SummonRandomBotBoss(); 
end; 
 
// STD event description goes here 
procedureOnPlayerKill(Killer, Victim: byte; Weapon: string); 
begin 
 CheckBotBoss(Victim); 
end; 

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #8 on: June 14, 2010, 05:06:19 pm »
why half of the spaces gone?

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #9 on: June 14, 2010, 05:07:46 pm »
What ??????

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #10 on: June 14, 2010, 05:14:33 pm »
Just copy-paste my script correctly... it's working fine...

« Last Edit: June 14, 2010, 05:16:14 pm by VirtualTT »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #11 on: June 14, 2010, 05:24:17 pm »
D'ont work !
which version of server youre using ?

Offline Centurion

  • Flagrunner
  • ****
  • Posts: 699
Re: Script question ! (learning ...)
« Reply #12 on: June 14, 2010, 06:17:20 pm »
If I was you then I'd be hella pissed off.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #13 on: June 14, 2010, 07:04:00 pm »
VirtualTT post your script with code,/code
cause when i copy i got number next to each line

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script question ! (learning ...)
« Reply #14 on: June 14, 2010, 07:28:32 pm »
mich, click "view plain" then try to copy it from the new window. You can try "copy to clipboard" also, but it may not be supported by your browser.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #15 on: June 14, 2010, 07:44:55 pm »
Thanks DorkeyDear !  ;)
But now i have my shop script and for reward i want to give money !
i already have this part of script for OnPlayerKill
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);
      end else
      begin
        money[Killer] := money[Killer]+1;
        writeConsole(Killer, 'You just got $1 your money is now: $' + inttostr(money[Killer]), Color);
      end;
  end;

this is the name of boss!
Code: [Select]
   
    GlAdIaTor ZoMbIe
    SpArTaAa ZoMbIe
    ViRuS ZoMbIe
    WTF ZoMbIe
how can i put that when one of this boss is killed that give X money ?

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Script question ! (learning ...)
« Reply #16 on: June 15, 2010, 05:53:41 am »
1. Don't write any stuff in the standard events procedures - make a new procedure with some reasonable name and call it.
2. You are missing very basics... Lean pascal syntax first, read some existing scripts and only then write your own...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #17 on: June 15, 2010, 05:59:56 am »
Do you have a pascal tutorial ?

Offline Centurion

  • Flagrunner
  • ****
  • Posts: 699
Re: Script question ! (learning ...)
« Reply #18 on: June 15, 2010, 06:06:03 am »

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #19 on: June 15, 2010, 08:00:39 am »
Sorry !  :-\
But i found the error by myself !
I forgot that in this procedure there is no ID its Killer
Code: [Select]
OnPlayerKill(Killer, Victim: byte;Weapon: byte);And i delete ' at some place !
I fix it and now it work ! Thanks all, i hope i will learn faster !  ;)  ;D
« Last Edit: June 15, 2010, 09:29:29 am by mich1103 »

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Script question ! (learning ...)
« Reply #20 on: June 15, 2010, 09:30:31 am »
This code
Code: [Select]
writeConsole(ID,You killed a boss ! Your money is now : + inttostr(money[ID])', Color);is inside the OnPlayerKill event procedure thing, which does not define "ID" at all. You probably want to use Killer (which is the ID of the killer) in replacement of ID.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #21 on: June 15, 2010, 09:50:55 am »
Yeah thats right ! ;D
But i got an error here !  :-\
it say
Code: [Select]
shop -> [Error] (102:80): Unknown identifier 'ID'the script part !  :|
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);




  if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer,'You killed ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);
end;         
   


  if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer,'You killed CoWbOy ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);
end;         
 

    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer,'You killed WTF ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);
end;



      if (IdToName(victim) = 'GlAdIaToR ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer,'You killed GlAdIaToR ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);
end;
   

   if (IdToName(victim) = 'ViRuS ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer,'You killed ViRuS ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);
end;



      if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer,'You killed SpArTaAa ZoMbIe ! Your money is now :' + inttostr(money[ID]), Color);

end;
 end;
  end;

Offline Centurion

  • Flagrunner
  • ****
  • Posts: 699
Re: Script question ! (learning ...)
« Reply #22 on: June 15, 2010, 10:25:59 am »
It's basically what he said in his latest post. You gotta change the ID part to Killer.

If I'm not mistaking.  I have no idea about advanced scripting.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #23 on: June 15, 2010, 10:41:40 am »
This script pass !
But when a boss is killed that dont give the money !
and that dont say You killed ..... your money is now ...
This is the script part ...
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
  begin
    if Killer = Victim then
      begin
         writeConsole(Killer, 'you cant kill yourself for money !', Color);




  if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
   


  if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 

    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;



      if (IdToName(victim) = 'GlAdIaToR ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   

   if (IdToName(victim) = 'GlAdIaToR ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;



      if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);

end;
 end;
  end;

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #24 on: June 15, 2010, 04:09:51 pm »
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if Killer <> Victim then
begin
if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
   
if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 
    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'GlAdIaToR ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   
if (IdToName(victim) = 'GlAdIaToR ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
end else begin
writeConsole(Killer, 'you cant kill yourself for money !', Color);
end;
end;
try this, btw i can i ask pk? do you trying to copy some part of my script code? xD
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #25 on: June 15, 2010, 04:12:38 pm »
No XD  ;D
i send you this script for your server !
anyway i have my old server and i already have a script like that !
i just want to update it ! Your server is online ?

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #26 on: June 15, 2010, 04:18:41 pm »
dont write unnecessary posts :D just tell me that its working fine :)  (i mean OnPlayerKill above) xD
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #27 on: June 15, 2010, 04:24:29 pm »
Don't work more ...  :-\
Same error !
no money giving and no WriteConsole ...

From: June 15, 2010, 04:26:15 pm
but now when i kill ZoMbIe i got 1$
« Last Edit: June 15, 2010, 04:26:15 pm by mich1103 »

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #28 on: June 15, 2010, 04:32:48 pm »
maybe you have typed wrong nameps of bots? all works fine for me with that part of script... i checked write console like "TEST" when Zombie is killed and "you can't kill yourself for money" and all works... maybe you added or modified something? go to includes.txt, make "//" before script name, save file and turn on server, then go to includes.txt again, delete "//", save and write in console "/recompile name of script", you will see errors in servers console [ ARSSE or Soldat Admin]...
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #29 on: June 15, 2010, 04:44:26 pm »
I found the error !!!
the VirtualTT script make that my 2 other script dont work ... (idk why)

My script (1) This one dont work when i active the VirtualTT script ...
Code: [Select]
Procedure AppOnIdle(Ticks: Integer);
begin
if TimeLeft = 0 then begin
Command('/kick WTF ZoMbIe');
Command('/kick ViRuS ZoMbIe');
Command('/kick SpArTaAa ZoMbIe');
Command('/kick GlAdIaTor ZoMbIe');
Command('/kick CoWbOy ZoMbIe');
end;
end;
My script (2) This one dont work when i active the VirtualTT script ...
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if Killer <> Victim then
begin
if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
   
if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 
    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'GlAdIaTor ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   
if (IdToName(victim) = 'ViRuS ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
end else begin
writeConsole(Killer, 'you cant kill yourself for money !', Color);
end;
end;
VirtualTT script
Code: [Select]
const
  PlainTextColour=$EE81FAA1;

var
  NewBossName:string;
 
// function description goes here
procedure SummonRandomBotBoss();
begin
  case Random(1,6) of // note that Random(1, 6) can return 1-5, but not 6!
    1: NewBossName:='CoWbOy ZoMbIe';
    2: NewBossName:='GlAdIaTor ZoMbIe';
    3: NewBossName:='SpArTaAa ZoMbIe';
    4: NewBossName:='ViRuS ZoMbIe';
    5: NewBossName:='WTF ZoMbIe';
  end;
  Command('/addbot2 '+NewBossName);
  WriteConsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour);
end;

// function description goes here
procedure CheckBotBoss(Victim:byte);
begin
// assume that bot name is the same as bot file name
  if (IdToName(Victim)=NewBossName) then begin
    Command('/kick '+NewBossName);
    WriteConsole(0, NewBossName+' has been defited!', PlainTextColour);
  end;
end;

// function description goes here
procedure InitScript();
begin
  NewBossName:=''; // never forget to initialize all your variables!!!
end;

// STD event description goes here
procedure ActivateServer();
begin
    InitScript();
end;

// STD event description goes here
procedure OnMapChange(NewMap: String);
begin
  SummonRandomBotBoss();
end;

// STD event description goes here
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  CheckBotBoss(Victim);
end;
« Last Edit: June 15, 2010, 05:47:40 pm by mich1103 »

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #30 on: June 16, 2010, 07:53:45 am »
try to make kick in OnMapChange, paste Kick commands before adding new boss, i have that in my script and it works fine :)

Code: [Select]
Procedure OnMapChange(NewMap: string);
begin
command('/kick boss name');
command('/addbot2 new boss');
WriteConsole(0, 'new boss spawned to kick your ass, go and defeat him' , RGB(0,255,255));
end;
btw, before you post, paste here Error text that appears in your console, it may help ;]
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #31 on: June 16, 2010, 10:59:46 am »
same error ! if i dont use the VirtualTT script the loot work and all work fine !
when i put the virtualTT script there is no loot and no message ! .... ???  ???
please help me  :( :-\

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #32 on: June 16, 2010, 11:05:07 am »
can you tell what errors you got? O.o btw, try to merge these two scripts and try to run server (GIVE ME THE ERRORS) don say "same error" because i dont know what error you got... xD
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #33 on: June 16, 2010, 11:16:38 am »
There is no console error !
the only error i got is when a boss is killed no money is given and no message is said. but when i dont put the virtualTT script all work !

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #34 on: June 16, 2010, 11:19:12 am »
can you attach both of scripts here?
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #35 on: June 16, 2010, 11:22:10 am »
Here it is !
VirtualTT script !
Code: [Select]
const
  PlainTextColour=$EE81FAA1;

var
  NewBossName:string;
 
// function description goes here
procedure SummonRandomBotBoss();
begin
  case Random(1,6) of // note that Random(1, 6) can return 1-5, but not 6!
    1: NewBossName:='CoWbOy ZoMbIe';
    2: NewBossName:='GlAdIaTor ZoMbIe';
    3: NewBossName:='SpArTaAa ZoMbIe';
    4: NewBossName:='ViRuS ZoMbIe';
    5: NewBossName:='WTF ZoMbIe';
  end;
  Command('/addbot2 '+NewBossName);
  WriteConsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour);
end;

// function description goes here
procedure CheckBotBoss(Victim:byte);
begin
// assume that bot name is the same as bot file name
  if (IdToName(Victim)=NewBossName) then begin
    Command('/kick '+NewBossName);
    WriteConsole(0, NewBossName+' has been defited!', PlainTextColour);
  end;
end;

// function description goes here
procedure InitScript();
begin
  NewBossName:=''; // never forget to initialize all your variables!!!
end;

// STD event description goes here
procedure ActivateServer();
begin
    InitScript();
end;

// STD event description goes here
procedure OnMapChange(NewMap: String);
begin
    command('/kick CoWbOy ZoMbIe');
    command('/kick GlAdIaTor ZoMbIe');
    command('/kick SpArTaAa ZoMbIe');
    command('/kick ViRuS ZoMbIe');
    command('/kick WTF ZoMbIe');
SummonRandomBotBoss();
end;

// STD event description goes here
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  CheckBotBoss(Victim);
end;


My shop script !
Code: [Select]
const
Color = $FF00FF00; //Color to be used.
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 75;
maxpsg = 10;
psgammo = 85; //took the liberty to invent it, since it was missing.

var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 

procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 25;
    psgcost         := 30;
    invcost         := 9;
    medcost         := 6;
    nadecost        := 6;
    flamecost       := 12;
    vestcost        := 7;
    serkcost        := 9;
    clustcost       := 8;
    powercost       := 18;
    eaglecost       := 9;
    mp5cost         := 9;
    ak47cost        := 10;
    augcost         := 10;
    spascost        := 10;
    rugecost        := 9;
    m79cost         := 12;
    barrcost        := 14;
    minimcost       := 11;
    minigcost       := 10;
    allcost         := 25;
  end;


procedure OnJoinGame(ID, Team: byte);

var
   asd : string;

  begin
if FileExists('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt') then begin 
asd := ReadFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt'); 
  money[ID] := StrToInt(Copy(asd,0,length(asd)-2)); 
 writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
 end else money[ID] := 0 
end; 






procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if Killer <> Victim then
begin
if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
   
if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 
    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'GlAdIaTor ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   
if (IdToName(victim) = 'ViRuS ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
end else begin
writeConsole(Killer, 'you cant kill yourself for money !', Color);
end;
end;



procedure OnFlagScore(ID, TeamFlag: byte);
      begin
        money[ID] := money[ID]+10;
        writeConsole(ID, 'You just got 10$ for scoring ! your money is now :' + inttostr(money[ID]), Color);
      end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/inv  $9(Give you the invisibility)     #', Color);
        writeConsole(ID, '#/med $6 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $6 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $12 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $7 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $9 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $8 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $18 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $9 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $10 (Give you a Ak 47)            #', Color);
        writeConsole(ID, '#/aug $10 (Give you a Steyr AUG)         #', Color);
        writeConsole(ID, '#/spas $10 (Give you a spas 12)          #', Color);
        writeConsole(ID, '#/ruger $9 (Give you a Ruger)            #', Color);
        writeConsole(ID, '#/m79 $12 (Give you a m79)               #', Color);
        writeConsole(ID, '#/barr $14 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $11 (Give you a FN minimi)       #', Color);
        writeConsole(ID, '#/minig $10 (Give you a Minigun)         #', Color);
        writeConsole(ID, '#/guns 25(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $30, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;


  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $12, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $14, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $11, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Grenades for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $18, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $12, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt',IntToStr(money[ID])); 
end;

Procedure AllDraw();
var
  i:Byte;
begin
  for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Human') = true) then
    DrawText(i,'Money: $' + inttostr(Money[i]),65,Color,0.08,15,320);
end;



Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
AllDraw();     
if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);     
end;
Break;
    end;
   end;
  end;
 end;
end;




procedure OnPlayerSpeak(ID:Byte;Text:String);
begin
if (Text='!money')
      then begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



if(Text='!shop')
      then begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/inv  $9(Give you the invisibility)     #', Color);
        writeConsole(ID, '#/med $6 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $6 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $12 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $7 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $9 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $8 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $18 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $9 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $10 (Give you a Ak 47)            #', Color);
        writeConsole(ID, '#/aug $10 (Give you a Steyr AUG)         #', Color);
        writeConsole(ID, '#/spas $10 (Give you a spas 12)          #', Color);
        writeConsole(ID, '#/ruger $9 (Give you a Ruger)            #', Color);
        writeConsole(ID, '#/m79 $12 (Give you a m79)               #', Color);
        writeConsole(ID, '#/barr $14 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $11 (Give you a FN minimi)       #', Color);
        writeConsole(ID, '#/minig $10 (Give you a Minigun)         #', Color);
        writeConsole(ID, '#/guns 25(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;
  end;


Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Script question ! (learning ...)
« Reply #36 on: June 16, 2010, 11:24:38 am »
try adding result:=damage; in the end of onplayerdamage........

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #37 on: June 16, 2010, 01:22:41 pm »
I really need help !
my server cant work if i dont have this ...

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #38 on: June 16, 2010, 01:27:29 pm »
easy mich ^^ i made it, all works fine for me, i changed (IdToName(Victim)='Zombie') to GetPlayerStat(Victim,'Name')='Zombie' and that works, here we go (btw you have merged that two scripts here so turn off Virtual's script because its included in your shop)
Code: [Select]
const
Color = $FF00FF00; //Color to be used.
PlainTextColour=$EE81FAA1;
psgpowa = 1;
psgtype = 14;
psgrang = 666;
psgspee = 75;
maxpsg = 10;
psgammo = 85; //took the liberty to invent it, since it was missing.


var
  pname: string;
  money: array[1..32] of integer;
  statcost:integer;
  giveid:integer;
  psgcost:integer;
  give,ammount,player:string;
  sgx,sgy:array[1..maxpsg] of single;
  sga,sgo,sgt:array[1..maxpsg] of byte;
  sgd:array[1..maxpsg] of boolean;
  NewBossName:string;
invcost,medcost,nadecost,flamecost,vestcost,serkcost,clustcost,powercost,eaglecost: integer;
  mp5cost,ak47cost,augcost,spascost,rugecost,m79cost,barrcost,minimcost,minigcost, allcost: integer;
 
procedure SummonRandomBotBoss();
begin
  case Random(1,6) of // note that Random(1, 6) can return 1-5, but not 6!
    1: NewBossName:='Zombie';
    2: NewBossName:='Zombie';
    3: NewBossName:='Zombie';
    4: NewBossName:='Zombie';
    5: NewBossName:='Zombie';
  end;
  Command('/addbot2 '+NewBossName);
  WriteConsole(0, NewBossName+' has been summoned! Kill him for reward!', PlainTextColour);
end;

procedure InitScript();
begin
  NewBossName:=''; // never forget to initialize all your variables!!!
end;



procedure placesentry(x,y:single;ID,team:byte);
var n,f:byte;
begin
if getplayerstat(ID,'Ground')=true then begin
f:=maxpsg;
for n:=1 to maxpsg do begin
if sgd[n]=true then f:=f-1;
end;
if f=0 then DrawText(ID,'Maximum of '+inttostr(maxpsg)+' sentry guns on map reached.',250,RGB(0,255,0),0.10,150,400) else begin
for n:=1 to maxpsg do begin
if sgd[n]=false then break;
end;
sgx[n]:=x; sgy[n]:=y; sgo[n]:=ID; sgt[n]:=team; sga[n]:=psgammo; sgd[n]:=true;
DrawText(ID,'Sentry gun placed!',250,RGB(0,255,0),0.1,75,350);
end;
end else DrawText(ID,'You are in mid-air!',250,RGB(0,255,0),0.10,220,400);
end;
 
 
 
procedure ActivateServer();
  begin
    statcost        := 25;
    psgcost         := 30;
    invcost         := 9;
    medcost         := 6;
    nadecost        := 6;
    flamecost       := 12;
    vestcost        := 7;
    serkcost        := 9;
    clustcost       := 8;
    powercost       := 18;
    eaglecost       := 9;
    mp5cost         := 9;
    ak47cost        := 10;
    augcost         := 10;
    spascost        := 10;
    rugecost        := 9;
    m79cost         := 12;
    barrcost        := 14;
    minimcost       := 11;
    minigcost       := 10;
    allcost         := 25;
InitScript();
  end;


procedure OnJoinGame(ID, Team: byte);

var
   asd : string;

  begin
if FileExists('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt') then begin 
asd := ReadFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt'); 
  money[ID] := StrToInt(Copy(asd,0,length(asd)-2)); 
 writeConsole(ID, 'Your Money is: $' + inttostr(money[ID]),Color);
    writeConsole(ID, 'Do /shop to see the shop, do /money to see your money !' + inttostr(money[ID]), Color);
 end else money[ID] := 0 
end; 

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

if Killer <> Victim then
begin
if (getplayerstat(victim,'name')='ZoMbIe')
then begin
money[Killer] := money[Killer]+1;

writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
Command('/kick Zombie');
end;         
   
if (getplayerstat(victim,'name')='CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 
    if (getplayerstat(victim,'name')='WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (getplayerstat(victim,'name')='GlAdIaTor ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   
if (getplayerstat(victim,'name')='ViRuS ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (getplayerstat(victim,'name')='SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
end else begin
writeConsole(Killer, 'you cant kill yourself for money !', Color);
end;
end;



procedure OnFlagScore(ID, TeamFlag: byte);
      begin
        money[ID] := money[ID]+10;
        writeConsole(ID, 'You just got 10$ for scoring ! your money is now :' + inttostr(money[ID]), Color);
      end;




function OnPlayerCommand(ID: Byte; Text: string): boolean;
  begin



  give := GetPiece(LowerCase(Text), ' ', 0);
  ammount := GetPiece(LowerCase(Text), ' ', 1);
  player := GetPiece(Text, ' ', 2);
  if give = '/give' then
    begin
      if money[ID] > strtoint(ammount) then
        begin
          giveid := NameToID(player);

          if giveid > 0 then
            begin
              money[ID] := money[ID] - strtoint(ammount);
              money[giveid] := money[giveid] + strtoint(ammount);
              writeconsole(ID, 'You gave $' + ammount + ' to: ' + IDToName(giveid) + ', Your money is now: $' + inttostr(money[ID]) , Color);
              writeconsole(giveid, 'You recived $' + ammount + ' from: ' + IDToName(ID) + ', Your money is now: $' + inttostr(money[giveid]), Color);
            end else
              begin
                writeconsole(ID, 'That person does not exist.', Color);
              end;

        end else
        begin
          writeconsole(ID, 'You don''t have enough money', Color);
        end;

    end;







    if regExpMatch('^/(money|moneys)$', Text) then
      begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



    if regExpMatch('^/(commands|shop|spawn|help)$', Text) then
      begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/inv  $9(Give you the invisibility)     #', Color);
        writeConsole(ID, '#/med $6 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $6 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $12 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $7 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $9 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $8 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $18 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $9 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $10 (Give you a Ak 47)            #', Color);
        writeConsole(ID, '#/aug $10 (Give you a Steyr AUG)         #', Color);
        writeConsole(ID, '#/spas $10 (Give you a spas 12)          #', Color);
        writeConsole(ID, '#/ruger $9 (Give you a Ruger)            #', Color);
        writeConsole(ID, '#/m79 $12 (Give you a m79)               #', Color);
        writeConsole(ID, '#/barr $14 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $11 (Give you a FN minimi)       #', Color);
        writeConsole(ID, '#/minig $10 (Give you a Minigun)         #', Color);
        writeConsole(ID, '#/guns 25(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;





if regExpMatch('^/(stationary|stat|turrent)$', Text) then
  begin
      if money[ID] >= statcost then
        begin
          money[ID] := money[ID] - statcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,15);
          writeconsole(ID, 'You bought a Stat Gun for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
      end;
  end;
  result := false;






if regExpMatch('^/(psg)$', Text) then begin
      if money[ID] >= psgcost then begin
          money[ID] := money[ID] - psgcost;
         placesentry(getplayerstat(ID,'x'),getplayerstat(ID,'y'),ID,getplayerstat(ID,'team'));
          writeconsole(ID, 'You bought a Sentry Gun for $30, you have $' + inttostr(money[ID]), Color);
        end else begin writeconsole(ID, 'You do not have enough money', Color);
    end;
end;


  if regExpMatch('^/(desert eagles|eagle|deagles|deserteagles)$', Text) then
    begin
      if money[ID] >= eaglecost then
        begin
          money[ID] := money[ID] - eaglecost;
          forceWeapon(ID,1,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought deagles for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(hkmp5|mp5|hk)$', Text) then
    begin
      if money[ID] >= mp5cost then
        begin
          money[ID] := money[ID] - mp5cost;
          forceWeapon(ID,2,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a HK MP5 for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ak47)$', Text) then
    begin
      if money[ID] >= ak47cost then
        begin
          money[ID] := money[ID] - ak47cost;
          forceWeapon(ID,3,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a AK47 for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(steyr|aug)$', Text) then
    begin
      if money[ID] >= augcost then
        begin
          money[ID] := money[ID] - augcost;
          forceWeapon(ID,4,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Steyr Aug for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(spas 12|spas|spas12)$', Text) then
    begin
      if money[ID] >= spascost then
        begin
          money[ID] := money[ID] - spascost;
          forceWeapon(ID,5,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a SPAS12 for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(ruger|ruge|ruger77)$', Text) then
    begin
      if money[ID] >= rugecost then
        begin
          money[ID] := money[ID] - rugecost;
          forceWeapon(ID,6,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Ruger for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(m79)$', Text) then
    begin
      if money[ID] >= m79cost then
        begin
          money[ID] := money[ID] - m79cost;
          forceWeapon(ID,7,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a M79 for $12, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(barreta|barr|barrett m82a1|barret|barret m)$', Text) then
    begin
      if money[ID] >= barrcost then
        begin
          money[ID] := money[ID] - barrcost;
          forceWeapon(ID,8,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Barreta for $14, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(fn minimi|minim|fn)$', Text) then
    begin
      if money[ID] >= minimcost then
        begin
          money[ID] := money[ID] - minimcost;
          forceWeapon(ID,9,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a FN Minimi for $11, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(minigun|minig)$', Text) then
    begin
      if money[ID] >= minigcost then
        begin
          money[ID] := money[ID] - minigcost;
          forceWeapon(ID,10,GetPlayerStat(ID,'Primary'),0);
          writeconsole(ID, 'You bought a Minigun for $10, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(medic|med|health|med pack)$', Text) then
    begin
      if money[ID] >= medcost then
        begin
          money[ID] := money[ID] - medcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          writeconsole(ID, 'You bought a Medkit for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(grenade|nade)$', Text) then
    begin
      if money[ID] >= nadecost then
        begin
          money[ID] := money[ID] - nadecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,17);
          writeconsole(ID, 'You bought some Grenades for $6, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(cluster|clust|clustergrandes|clusternades|clustnades)$', Text) then
    begin
      if money[ID] >= clustcost then
        begin
          money[ID] := money[ID] - clustcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought some Cluster Greanades for $8, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(armor|vest|bulletproofvest)$', Text) then
    begin
      if money[ID] >= vestcost then
        begin
          money[ID] := money[ID] - vestcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,19);
          writeconsole(ID, 'You bought a Bullet Proof Vest for $7, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;


  if regExpMatch('^/(boxes|power|box)$', Text) then
    begin
      if money[ID] >= powercost then
        begin
          money[ID] := money[ID] - powercost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,16);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,17);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,18);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,19);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,20);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,21);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,22);
          writeconsole(ID, 'You bought all Powerups for $18, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;

    end;

  if regExpMatch('^/(preditor|inv|invisible)$', Text) then
    begin
      if money[ID] >= invcost then
        begin
          money[ID] := money[ID] - invcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,20);
          writeconsole(ID, 'You bought a Preditor Box for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(flame god|flame|flamegodmode|flame god mode)$', Text) then
    begin
      if money[ID] >= flamecost then
        begin
          money[ID] := money[ID] - flamecost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,18);
          writeconsole(ID, 'You bought a Flame God Box for $12, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;

  if regExpMatch('^/(berseker|serk)$', Text) then
    begin
      if money[ID] >= serkcost then
        begin
          money[ID] := money[ID] - serkcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,21);
          writeconsole(ID, 'You bought a Berseker Box for $9, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color); end;
    end;



if regExpMatch('^/(gunz|guns|weapons|weaps|weps)$', Text) then
    begin
      if money[ID] >= allcost then
        begin
          money[ID] := money[ID] - allcost;
          SpawnObject(GetPlayerStat(ID,'x')+20,GetPlayerStat(ID,'y')-20,1);
          SpawnObject(GetPlayerStat(ID,'x')+30,GetPlayerStat(ID,'y')-20,2);
          SpawnObject(GetPlayerStat(ID,'x')+40,GetPlayerStat(ID,'y')-20,3);
          SpawnObject(GetPlayerStat(ID,'x')+50,GetPlayerStat(ID,'y')-20,4);
          SpawnObject(GetPlayerStat(ID,'x')+60,GetPlayerStat(ID,'y')-20,5);
          SpawnObject(GetPlayerStat(ID,'x')+70,GetPlayerStat(ID,'y')-20,6);
          SpawnObject(GetPlayerStat(ID,'x')+80,GetPlayerStat(ID,'y')-20,7);
          SpawnObject(GetPlayerStat(ID,'x')-20,GetPlayerStat(ID,'y')-20,8);
          SpawnObject(GetPlayerStat(ID,'x')-30,GetPlayerStat(ID,'y')-20,9);
          SpawnObject(GetPlayerStat(ID,'x')-40,GetPlayerStat(ID,'y')-20,10);
          SpawnObject(GetPlayerStat(ID,'x')-50,GetPlayerStat(ID,'y')-20,11);
          SpawnObject(GetPlayerStat(ID,'x')-60,GetPlayerStat(ID,'y')-20,12);
          SpawnObject(GetPlayerStat(ID,'x')-70,GetPlayerStat(ID,'y')-20,13);
          SpawnObject(GetPlayerStat(ID,'x')-80,GetPlayerStat(ID,'y')-20,14);
          writeconsole(ID, 'You bought all Weapon for $25, you have $' + inttostr(money[ID]), Color);

        end else begin writeconsole(ID, 'You do not have enough money', Color);
   end;

end;
end;

procedure OnMapChange(newmap:string);
var n:byte;
begin
for n:=1 to maxpsg do begin sgd[n]:=false; end;
command('/kick Zombie');
    command('/kick Zombie');
    command('/kick Zombie');
    command('/kick Zombie');
    command('/kick Zombie');
SummonRandomBotBoss();
end;

procedure OnLeaveGame(ID,team:byte;kicked:boolean);
var n:byte;
begin
for n:=1 to maxpsg do
begin if sgo[n]=ID then sgd[n]:= false;
end;
WriteFile('scripts/shop/'+ GetPlayerStat(ID,'name') + '.txt',IntToStr(money[ID])); 
end;

Procedure AllDraw();
var
  i:Byte;
begin
  for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Human') = true) then
    DrawText(i,'Money: $' + inttostr(Money[i]),65,Color,0.08,15,320);
end;



Procedure AppOnIdle(Ticks: Integer);
 Var N, K: Byte;
  X, Y, Dista: Single;
   Begin
    For N := 1 To maxpsg Do Begin
AllDraw();     
if sgd[n] = True Then Begin
      CreateBullet(sgx[n],sgy[n],0,0,0,5,sgo[n]);
       For K := 1 To 32 Do Begin
        GetPlayerXy(K,X,Y);
         if GetPlayerStat(K,'Team') <> sgt[n] Then if GetPlayerStat(K,'Alive') = True Then if RayCast(sgx[n],sgy[n],x,y,dista,psgrang) = True Then if dista <= psgrang Then Begin
          x := ((x-sgx[n]) / dista)*psgspee;
         y := ((y-sgy[n]) / dista)*psgspee;
          CreateBullet(sgx[n],sgy[n],x,y,psgpowa,psgtype,sgo[n]); sga[n]:=sga[n]-1;
         if sga[n] = 0 Then Begin
      sgd[n] := false;
      Writeconsole(sgo[n],'One of your sentry guns ran out of ammo.',$0000FF00);     
end;
Break;
    end;
   end;
  end;
 end;
end;




procedure OnPlayerSpeak(ID:Byte;Text:String);
begin
if (Text='!money')
      then begin
        writeConsole(ID, 'Your money is: $' + inttostr(money[ID]), Color);
     end;



if(Text='!shop')
      then begin
        writeConsole(ID, '#############SHOP#########################', Color);
        writeConsole(ID, '#commands:                               #', Color);
        writeConsole(ID, '#/stat $25 (spawn a turret)              #', Color);
        writeConsole(ID, '#/psg $30 (Spawn a sentry gun)           #', Color);
        writeConsole(ID, '#/inv  $9(Give you the invisibility)     #', Color);
        writeConsole(ID, '#/med $6 (Give you a medic kit)          #', Color);
        writeConsole(ID, '#/nade $6 (Give to you some nade)        #', Color);
        writeConsole(ID, '#/flame $12 (Give you a flamer)          #', Color);
        writeConsole(ID, '#/vest $7 (Give you a Bullet proof)      #', Color);
        writeConsole(ID, '#/serk $9 (Give you the RAGE !!!)        #', Color);
        writeConsole(ID, '#/clust $8 (Give you some cluster)       #', Color);
        writeConsole(ID, '#/power $18 (Spawn all bonus above you)  #', Color);
        writeConsole(ID, '#/eagle $7 (Give you a Desert Eagle)     #', Color);
        writeConsole(ID, '#/mp5 $9 (Give you a Hk mp5)             #', Color);
        writeConsole(ID, '#/ak47 $10 (Give you a Ak 47)            #', Color);
        writeConsole(ID, '#/aug $10 (Give you a Steyr AUG)         #', Color);
        writeConsole(ID, '#/spas $10 (Give you a spas 12)          #', Color);
        writeConsole(ID, '#/ruger $9 (Give you a Ruger)            #', Color);
        writeConsole(ID, '#/m79 $12 (Give you a m79)               #', Color);
        writeConsole(ID, '#/barr $14 (Give you a Barret)           #', Color);
        writeConsole(ID, '#/minim $11 (Give you a FN minimi)       #', Color);
        writeConsole(ID, '#/minig $10 (Give you a Minigun)         #', Color);
        writeConsole(ID, '#/guns 25(Spawn all gun above you)       #', Color);
        writeConsole(ID, '#############END##########################', Color);
      end;
  end;
« Last Edit: June 16, 2010, 01:29:05 pm by kosik231 »
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #39 on: June 16, 2010, 01:35:03 pm »
I made the same thing !
i've just made it  ;D
i include the virtualTT script in my script and i put
Code: [Select]
CheckBotBoss(Victim);after all of that !
Code: [Select]
procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
if Killer <> Victim then
begin
if (IdToName(victim) = 'ZoMbIe')
then begin
money[Killer] := money[Killer]+1;
writeConsole(Killer, 'You just got 1$ for killing a ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
   
if (IdToName(victim) = 'CoWbOy ZoMbIe')
then begin
money[Killer] := money[Killer]+10;
writeConsole(Killer, 'You just got 10$ for killing CoWbOy ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;         
 
    if (IdToName(victim) = 'WTF ZoMbIe')
then begin
money[Killer] := money[Killer]+30;
writeConsole(Killer, 'You just got 30$ for killing WTF ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'GlAdIaTor ZoMbIe')
then begin
money[Killer] := money[Killer]+15;
writeConsole(Killer, 'You just got 15$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;
   
if (IdToName(victim) = 'ViRuS ZoMbIe')
then begin
money[Killer] := money[Killer]+25;
writeConsole(Killer, 'You just got 25$ for killing GlAdIaToR ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

    if (IdToName(victim) = 'SpArTaAa ZoMbIe')
then begin
money[Killer] := money[Killer]+20;
writeConsole(Killer, 'You just got 20$ for killing SpArTaAa ZoMbIe ! your money is now :' + inttostr(money[Killer]), Color);
end;

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #40 on: June 16, 2010, 01:46:39 pm »
when i made CheckBotBoss(Victim); after kills it wasnt work, thats kick bot when hes death so you dont get any money or kill points, btw i forgon to add Command('/kick bossname'); after kills so you can make it ^^, go and test it :D
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #41 on: June 16, 2010, 01:49:33 pm »
My script work !  ;D
Why should he dont work ?  :-\

And do this part is right ?
Code: [Select]
writeConsole(0,+(IdToName(ID)' has scored for Alpha team !' , Color);
« Last Edit: June 16, 2010, 01:51:06 pm by mich1103 »

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script question ! (learning ...)
« Reply #42 on: June 16, 2010, 02:15:07 pm »
God, test it yourself.

If it returns an error, find it, instead of running to the scripters in the forums.

Nothing against help, but you are now asking us if "WriteConsole(0,+IDToName(ID)' has scored',Color)" would work.

You'll find some syntax errors there. Find them and solve them.
www.soldatx.com.br - The brazilian Soldat community.

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: Script question ! (learning ...)
« Reply #43 on: June 16, 2010, 02:34:35 pm »
squiddy good idea xD ill be quiet now, this mistake is funny ^^
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script question ! (learning ...)
« Reply #44 on: June 16, 2010, 02:54:29 pm »
You know what ? i learn alot each day !
Each time i ask a question !
and that someone answer , i become more intelligent
Like yesterday i learn wath is a constant and a variable !
today i learn how to combine script and how to declare a a procedure after another to make another script working !
Anyway ... I dont wanna learn by tutorial or other stuff !(Im really tired to learn with that ! )So ... like wath you said i'll try by myself first !
but if the script dont work more i'll ask on forum !