Author Topic: Script help !!!  (Read 5445 times)

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Script help !!!
« on: April 22, 2010, 04:19:59 pm »
This idea look like the same as the ''knife mod by DC''
if a player say
!soldier (He will be able to take mp5,ak47,eagle,ussocom)
!sniper  (He will be able to take Barret,ruger,knife,law)
!medic (He will be able to take ruger,eagle,saw,knife)(people can be healed by him if people stay next to him)
!destroyer (He will be able to take m79,minigun,spas,law,ussocom)

The script should be did with SetWeaponActive

From: April 22, 2010, 04:27:38 pm
Can i do it like that ?

Code: [Select]
procedure OnJoinGame(ID, Team: byte);
begin
SetWeaponActive(ID,0,false);
SetWeaponActive(ID,1,false);
SetWeaponActive(ID,2,false);
SetWeaponActive(ID,3,false);
SetWeaponActive(ID,4,false);
SetWeaponActive(ID,5,false);
SetWeaponActive(ID,6,false);
SetWeaponActive(ID,7,false);
SetWeaponActive(ID,8,false);
SetWeaponActive(ID,9,false);
SetWeaponActive(ID,10,false);
SetWeaponActive(ID,14,false);
SetWeaponActive(ID,15,false);
SetWeaponActive(ID,16,false);


end;


procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if (Text='!soldier')
      then begin
        SetWeaponActive(ID,2,true);
SetWeaponActive(ID,3,true);
SetWeaponActive(ID,1,true);
SetWeaponActive(ID,0,true);
WriteConsole(ID, 'Youre now a Soldier !', $FF00FF00);
   

    if (Text='!sniper')
      then begin
    SetWeaponActive(ID,8,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,6,true);
SetWeaponActive(ID,14,true);
        WriteConsole(ID, 'Youre now a Sniper !', $FF00FF00);


    if (Text='!destroyer')
      then begin
  SetWeaponActive(ID,7,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,10,true);
SetWeaponActive(ID,0,true);
    SetWeaponActive(ID,8,true);
SetWeaponActive(ID,5,true);
        WriteConsole(ID, 'Youre now a Destroyer !', $FF00FF00);

    if (Text='!medic')
      then begin
  SetWeaponActive(ID,6,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,14,true);
SetWeaponActive(ID,5,true);
SetWeaponActive(ID,9,true);
        WriteConsole(ID, 'Youre now a Medic !', $FF00FF00);


if (Text='!credits')
      then begin
  WriteConsole(ID, 'Credits go to all people wgo helped me !', $FF00FF00);
 
if (Text='!classes')
      then begin
  WriteConsole(ID, '!soldier (Able you to take MP5,AK47,EAGLE and SOCOM)', $FF00FF00);
  WriteConsole(ID, '!destroyer (Able you to take M79,spas,minigun,law and SOCOM)', $FF00FF00);
  WriteConsole(ID, '!sniper (Able you to take Barret,ruger,law and knife) ', $FF00FF00);
  WriteConsole(ID, '!medic (Able you to take Ruger,eagle,saw and knife)', $FF00FF00);
  WriteConsole(ID, 'Medic can also heal you if you stay next to him !', $FF00FF00);
 
  if (Text='!help')
      then begin
  WriteConsole(ID, '!classes (For a list of classes)', $FF00FF00);
  WriteConsole(ID, '!credits (For credits)', $FF00FF00);
  WriteConsole(ID, '!rules (for a list of rule)', $FF00FF00);
  WriteConsole(ID, '!news (For a list of the lastest new)', $FF00FF00);
  WriteConsole(ID, '!info (To see the server descriptions)', $FF00FF00);
 
  if (Text='!news')
      then begin
  WriteConsole(ID, 'There is no new now', $FF00FF00);
 
  if (Text='!rules')
      then begin
     WriteConsole(ID, '#############################RULES##########################################', $FF00FF00);
         WriteConsole(ID, '#No spamming. If an admin sees you doing it you will be banned for an hour.#', $FF00FF00);
         WriteConsole(ID, '#No hacking. If an admin sees you doing it you will be banned forever.     #', $FF00FF00);
         WriteConsole(ID, '#No Pushing.                                                               #', $FF00FF00);
         WriteConsole(ID, '#No votekicking for no reasons .                                           #', $FF00FF00);         
         WriteConsole(ID, '#Do not ignore admins if they talk to you.                                 #', $FF00FF00);
         WriteConsole(ID, '#No poly bugging.                                                          #', $FF00FF00);
         WriteConsole(ID, '#Respect admins and their decisions.                                       #', $FF00FF00);
         WriteConsole(ID, '############################################################################', $FF00FF00);

if (Text='!info')
       then begin
    WriteConsole(ID, 'This server is scripted!', $FF00FF00);
WriteConsole(ID, 'You can chose about 4 classe', $FF00FF00);
WriteConsole(ID, 'Type !classes to see these classes', $FF00FF00);
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
const
 
« Last Edit: April 22, 2010, 07:05:32 pm by mich1103 »

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Script help !!!
« Reply #1 on: April 23, 2010, 07:38:30 am »
ROFL!
The 'end;' keywords are at a TOTALY wrong position!!!
Also the code identation is not-nice...
You MUST learn 'for' loops, they're needed almost EVERYWHERE.
Here's an example, how to make your syntax better:

Code: [Select]
function OnPlayerCommand(ID: byte; text: string): boolean;
var
    i: integer; // define a counter-variable. Used for the FOR-loop
begin
    // This is a comment, it's skipped by the compiler...
    if GetPiece(text, ' ', 0) = '/nova' then begin
        // start looping at 2, repeat until reaches 15
        for i:=2 to 15 do begin
            WriteConsole(id, 'BOOOM: ' + inttostr(i), $0000FF00);
            // do some other stuff...
        end; // our FOR loop's end
        WriteConsole(id, 'Mhmmm, flesh!', $0000FF00); // this will be called only ONCE
    end; // end of the IF
end; // end of OnPlayerCommand
« Last Edit: April 23, 2010, 07:40:10 am by LORD KILLA »

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #2 on: April 23, 2010, 09:49:29 am »
Omg, try doing it like this:

Haven't tested, I have no idea if it's going to work or not.

Code: (pascal) [Select]
Procedure OnJoinGame(ID, Team: Byte);
 Var M: Byte;
  Begin
 For M := 0 To 16 Do SetWeaponActive(ID,M,False);
end;

Procedure OnPlayerSpeak(ID: Byte; Text: String);
 Var MM: Byte;
  Begin
   Text := LowerCase(Text);
    if Text = '!soldier' Then Begin
     For MM := 0 To 4 Do SetWeaponActive(ID,MM,True);
   end;
 
 if Text = '!sniper' Then Begin
  SetWeaponActive(ID,6,True);
   SetWeaponActive(ID,8,True);
  SetWeaponActive(ID,14,True);
 SetWeaponActive(ID,16,True);
end;

//Here you finish your Script, since you got the idea.
//I didn't use a loop for "!sniper" because the weapon's numbers are not connected.
//Ussocom, Eagles, MP5 and AK are 0,1,2,3,4, that's why the loop, instead of typing SetWeaponActive() four times.

end;
www.soldatx.com.br - The brazilian Soldat community.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script help !!!
« Reply #3 on: April 23, 2010, 10:06:50 am »
1-10 Primarys; 11-14 Secondary -.-"

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #4 on: April 23, 2010, 04:13:27 pm »
do i need to disable weapon on soldat.ini ?

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Script help !!!
« Reply #5 on: April 23, 2010, 04:14:53 pm »
defiantly not.
[saw]  on 1.5.1

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #6 on: April 24, 2010, 06:01:36 am »
The script has passed but the SetActiveWeapon dont work more ...

DarkCrusade

  • Guest
Re: Script help !!!
« Reply #7 on: April 24, 2010, 06:31:53 am »
I recoded my DisableAll procedure. Start with something like this:

Code: [Select]
Procedure DisableAll(ID: Byte);
var ALL: Byte; 
  begin
    for ALL := 1 to 14 do
  SetWeaponActive(ID,ALL,false);
  end;

Then you go on ...

Code: [Select]
Procedure OnJoinTeam(ID,Team:Byte);
  begin
    case Team of
      1: begin
        DisableAll(ID);
        SetWeaponActive(ID,<WepID>, true);
      end;
      2: ...
      3: ...
    end;
  end;

Just change what you need to change ...

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #8 on: April 24, 2010, 09:10:55 am »
Like that ?
Code: [Select]
Procedure OnJoinTeam(ID,Team:Byte);
  begin
    case Team of
      1: begin
        DisableAll(ID);
        SetWeaponActive(ID,<WepID>, true);
      end;
      2: ...
      3: ...
    end;
  end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if (Text='!soldier')
      then begin
        SetWeaponActive(ID,2,true);
SetWeaponActive(ID,3,true);
SetWeaponActive(ID,1,true);
SetWeaponActive(ID,0,true);
WriteConsole(ID, 'Youre now a Soldier !', $FF00FF00);
    end;

 

  if (Text='!sniper')
      then begin
    SetWeaponActive(ID,8,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,6,true);
SetWeaponActive(ID,14,true);
        WriteConsole(ID, 'Youre now a Sniper !', $FF00FF00);
end;




    if (Text='!destroyer')
      then begin
  SetWeaponActive(ID,7,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,10,true);
SetWeaponActive(ID,0,true);
        SetWeaponActive(ID,8,true);
SetWeaponActive(ID,5,true);
        WriteConsole(ID, 'Youre now a Destroyer !', $FF00FF00);
end;

   

 if (Text='!medic')
      then begin
  SetWeaponActive(ID,6,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,14,true);
SetWeaponActive(ID,5,true);
SetWeaponActive(ID,9,true);
        WriteConsole(ID, 'Youre now a Medic !', $FF00FF00);
4nd;




if (Text='!credits')
      then begin
  WriteConsole(ID, '#################CREDITS##################', $FF00FF00);
          WriteConsole(ID, '#Credits go to Squiddy, Dark Crusade,    #', $FF00FF00);
          WriteConsole(ID, '#LORD KILLA and swompie                  #', $FF00FF00);
  WriteConsole(ID, '##########################################', $FF00FF00);
end;




if (Text='!classes')
 then begin
  WriteConsole(ID, '########################CLASSES###############################', $FF00FF00);
  WriteConsole(ID, '#!destroyer (Able you to take M79,spas,minigun,law and SOCOM)#', $FF00FF00);
  WriteConsole(ID, '#!sniper (Able you to take Barret,ruger,law and knife)       #', $FF00FF00);
  WriteConsole(ID, '#!medic (Able you to take Ruger,eagle,saw and knife)         #', $FF00FF00);
  WriteConsole(ID, '#Medic can also heal you if you stay next to him !           #', $FF00FF00);
          WriteConsole(ID, '##############################################################', $FF00FF00);
end;

if (Text='!help')
      then begin
  WriteConsole(ID, '################COMMANDS################', $FF00FF00);
          WriteConsole(ID, '#!classes (For a list of classes)      #', $FF00FF00);
  WriteConsole(ID, '#!credits (For credits)                #', $FF00FF00);
  WriteConsole(ID, '#!rules (for a list of rule)           #', $FF00FF00);
  WriteConsole(ID, '#!news (For a list of the lastest new) #', $FF00FF00);
  WriteConsole(ID, '#!info (To see the server descriptions)#', $FF00FF00);
          WriteConsole(ID, '########################################', $FF00FF00);
  end;

 if (Text='!news')
      then begin
  WriteConsole(ID, 'There is no new now', $FF00FF00);
  end;


 if (Text='!rules')
      then begin
  WriteConsole(ID, '#############################RULES##########################################', $FF00FF00);
         WriteConsole(ID, '#No spamming. If an admin sees you doing it you will be banned for an hour.#', $FF00FF00);
         WriteConsole(ID, '#No hacking. If an admin sees you doing it you will be banned forever.     #', $FF00FF00);
         WriteConsole(ID, '#No Pushing.                                                               #', $FF00FF00);
         WriteConsole(ID, '#No votekicking for no reasons .                                           #', $FF00FF00);         
         WriteConsole(ID, '#Do not ignore admins if they talk to you.                                 #', $FF00FF00);
         WriteConsole(ID, '#No poly bugging.                                                          #', $FF00FF00);
         WriteConsole(ID, '#Respect admins and their decisions.                                       #', $FF00FF00);
         WriteConsole(ID, '############################################################################', $FF00FF00);
     end;


if (Text='!info')
       then begin
        WriteConsole(ID, '###############INFO#################', $FF00FF00);
        WriteConsole(ID, '#This server is scripted!          #', $FF00FF00);
WriteConsole(ID, '#You can chose about 4 classe      #', $FF00FF00);
WriteConsole(ID, '#Type !classes to see these classes#', $FF00FF00);
        WriteConsole(ID, '####################################', $FF00FF00);

end;
end;
 

Procedure DisableAll(ID: Byte);
var ALL: Byte; 
  begin
    for ALL := 1 to 14 do
  SetWeaponActive(ID,ALL,false);
  end;
« Last Edit: April 24, 2010, 09:27:26 am by mich1103 »

DarkCrusade

  • Guest
Re: Script help !!!
« Reply #9 on: April 24, 2010, 09:32:59 am »
Watch your indentations. Those ain't nice (don't use tabs!).

Code: [Select]
Procedure DisableAll(ID: Byte);
var ALL: Byte; 
  begin
    for ALL := 1 to 14 do
  SetWeaponActive(ID,ALL,false);
  end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if (Text='!soldier')
      then begin
        SetWeaponActive(ID,2,true);
SetWeaponActive(ID,3,true);
SetWeaponActive(ID,1,true);
SetWeaponActive(ID,0,true);
WriteConsole(ID, 'Youre now a Soldier !', $FF00FF00);
    end;

 

  if (Text='!sniper')
      then begin
    SetWeaponActive(ID,8,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,6,true);
SetWeaponActive(ID,14,true);
        WriteConsole(ID, 'Youre now a Sniper !', $FF00FF00);
end;




    if (Text='!destroyer')
      then begin
  SetWeaponActive(ID,7,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,10,true);
SetWeaponActive(ID,0,true);
    SetWeaponActive(ID,8,true);
SetWeaponActive(ID,5,true);
        WriteConsole(ID, 'Youre now a Destroyer !', $FF00FF00);
end;

   

 if (Text='!medic')
      then begin
  SetWeaponActive(ID,6,true);
SetWeaponActive(ID,16,true);
SetWeaponActive(ID,14,true);
SetWeaponActive(ID,5,true);
SetWeaponActive(ID,9,true);
        WriteConsole(ID, 'Youre now a Medic !', $FF00FF00);
end;




if (Text='!credits')
      then begin
  WriteConsole(ID, 'Credits go to all people who helped me !', $FF00FF00);
end;




if (Text='!classes')
 then begin
  WriteConsole(ID, '!soldier (MP5,AK47,EAGLE and SOCOM)', $FF00FF00);
  WriteConsole(ID, '!destroyer (M79,spas,minigun,law and SOCOM)', $FF00FF00);
  WriteConsole(ID, '!sniper (Barret,ruger,law and knife) ', $FF00FF00);
  WriteConsole(ID, '!medic (Ruger,eagle,saw and knife)', $FF00FF00);
  WriteConsole(ID, 'Medic can also heal you if you stay next to him !', $FF00FF00);
       end;

if (Text='!help')
      then begin
  WriteConsole(ID, '!classes (For a list of classes)', $FF00FF00);
  WriteConsole(ID, '!credits (For credits)', $FF00FF00);
  WriteConsole(ID, '!rules (for a list of rule)', $FF00FF00);
  WriteConsole(ID, '!news (For a list of the lastest new)', $FF00FF00);
  WriteConsole(ID, '!info (To see the server descriptions)', $FF00FF00);
  end;

 if (Text='!news')
      then begin
  WriteConsole(ID, 'There is nothing new!', $FF00FF00);
  end;


 if (Text='!rules')
      then begin
  WriteConsole(ID, '#############################RULES##########################################', $FF00FF00);
         WriteConsole(ID, '#No spamming. If an admin sees you doing it you will be banned for an hour.#', $FF00FF00);
         WriteConsole(ID, '#No hacking. If an admin sees you doing it you will be banned forever.     #', $FF00FF00);
         WriteConsole(ID, '#No Pushing.                                                               #', $FF00FF00);
         WriteConsole(ID, '#No votekicking for no reasons .                                           #', $FF00FF00);         
         WriteConsole(ID, '#Do not ignore admins if they talk to you.                                 #', $FF00FF00);
         WriteConsole(ID, '#No poly bugging.                                                          #', $FF00FF00);
         WriteConsole(ID, '#Respect admins and their decisions.                                       #', $FF00FF00);
         WriteConsole(ID, '############################################################################', $FF00FF00);
     end;


if (Text='!info')
       then begin
        WriteConsole(ID, 'This server is scripted!', $FF00FF00);
WriteConsole(ID, 'You can chose out of 4 classes', $FF00FF00);
WriteConsole(ID, 'Type !classes to see all classes', $FF00FF00);

end;
end;

Should be correct ... really, watch your indentations or I'll be very upset :-\

And to finally come to your question: I wrote "2: ..." and "3: ..." to make you see that you can summarize all your "if (Text='...')" to "case Text of". Look at it carefully, it's important.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #10 on: April 24, 2010, 10:06:29 am »
So ... i put that on OnJoinGame ?
Code: [Select]
Procedure OnJoinTeam(ID,Team:Byte);
  begin
    case Team of
    begin
        DisableAll(ID);
        SetWeaponActive(ID,<WepID>, true);
      end;
    end;
  end;

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script help !!!
« Reply #11 on: April 24, 2010, 10:25:04 am »
I've made a little script for you since you really don't seem to understand it ;|
Read what I write here and now, it is very important that you understand it.

You can enable or disable weapons with the procedure SetWeapons(ID: byte; WeaponSet: string);

I think you know what ID is there for. Now for the parameter WeaponSet.

It tells the script which weapons a player should be able to use and which not.
It needs to contain exact 14 chars. If it doesn't the script gives the player the default weapon set declared at the start of the script (DefaultWeapons).

A 1 means he can use the weapon.
A 0 means he can't use the weapon.

For example the first number is for the Desert Eagles, set it to 1 and the player can't use them, but when you set it to 0 he can use them.

Here are some examples:
Code: [Select]
11111111110000 This would enable all primarys and disable all secondaries.
10001000001111 This would enable the weapons Desert Eagles, Spas and all secondaries.

If you didn't understand something or want something added ask!

Here is the script:
Code: [Select]
// script by swompie for mich

const
   DefaultWeapons = '01001000101111'; // The weapons a player gains when he joins by default (no class)
   // Colors
   cNews    = $E88E88; // Used for !news and the welcome message
   cClasses = $FFFF00; // Used for !classes and the message when someone changes class
   cRules   = $00FF00; // Used for !rules
   cHelp    = $A77AFF; // Used for !help, !info and !credits

var
   Weapons: Array [1..32] of string;

procedure SetWeapons(ID: byte; WeaponSet: string);
var i: byte;
begin

  if Length(WeaponSet) <> 14 then
    Weapons[ID] := DefaultWeapons
  else
    Weapons[ID] := WeaponSet;

  for i := 1 to 14 do
    SetWeaponActive(ID, i, iif(Weapons[ID][i] = '1', true, false));

end;

procedure OnJoinTeam(ID, Team: byte);
begin
  SetWeapons(ID, Weapons[ID]);
end;

procedure OnJoinGame(ID, Team: byte);
begin
  WriteConsole(ID, 'This server has classes, type !classes to get a overview', cNews);
  DrawText(ID, 'This server has classes,' + #13#10 +
               'type !classes to get a overview', 300, cNews, 0.1, 60, 140);
  SetWeapons(ID, DefaultWeapons);
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
  case LowerCase(Text) of
    '!soldier': begin
      SetWeapons(ID, '11100000001000');
      WriteConsole(ID, 'You are now a soldier!', cClasses);
    end;
    '!sniper': begin
      SetWeapons(ID, '00000101000011');
      WriteConsole(ID, 'You are now a sniper!', cClasses);
    end;
    '!destroyer': begin
      SetWeapons(ID, '00001001000011');
      WriteConsole(ID, 'You are now a destroyer!', cClasses);
    end;
    '!medic': begin
      SetWeapons(ID, '00001100100011');
      WriteConsole(ID, 'You are now a medic!', cClasses);
    end;
    '!classes': begin
      WriteConsole(ID, 'Classes:', cClasses - (cClasses div 9000));
      WriteConsole(ID, 'Soldier (Desert Eagles, HK MP5, Ak74, Socom)', cClasses);
      WriteConsole(ID, 'Sniper (Ruger, Barret, Knife, LAW)', cClasses);
      WriteConsole(ID, 'Destroyer (Spas, M79, Barret, Minigun, Socom, LAW)', cClasses);
      WriteConsole(ID, 'Medic (Spas, Ruger, Minimi, Knife, LAW)', cClasses);
      WriteConsole(ID, ' ------------------------------------------------', cClasses - (cClasses div 9000));
      WriteConsole(ID, '  Type !<classname> to change your class', cClasses);
      WriteConsole(ID, '  !soldier e.g. will change your class to soldier', cClasses);
    end;
    '!news': begin
      WriteConsole(ID, 'There are no news!', cNews);
    end;
    '!rules': begin
      WriteConsole(ID, 'Server rules:', cRules - (cRules div 9000));
      WriteConsole(ID, 'No spamming. Leads to a one hour ban if ignored.', cRules);
      WriteConsole(ID, 'No hacking. Leads to a permament ban if ignored.', cRules);
      WriteConsole(ID, 'No pushing.', cRules);
      WriteConsole(ID, 'No votekicking without a good reason.', cRules);
      WriteConsole(ID, 'No poly bugging.', cRules);
      WriteConsole(ID, 'Do NOT ignore admins if they talk to you!', cRules);
      WriteConsole(ID, 'Respect admins and their decisions!', cRules);
    end;
    '!help', '!commands': begin
      WriteConsole(ID, 'Commands:', cHelp - (cHelp div 9000));
      WriteConsole(ID, '!classes   Displays list of classes and their weapons', cHelp);
      WriteConsole(ID, '!rules     Displays server rules', cHelp);
      WriteConsole(ID, '!news      Displays news', cHelp);
      WriteConsole(ID, '!info      Displays info about the server', cHelp);
      WriteConsole(ID, '!credits   Displays the credits ', cHelp);
    end;
    '!info': begin
      WriteConsole(ID, 'Server info:', cHelp - (cHelp div 9000));
      WriteConsole(ID, 'This server is scripted, you can choose out of 4 Classes', cHelp);
      WriteConsole(ID, 'Each class has it''s own weapons', cHelp);

    end;
    '!credits': begin
      WriteConsole(ID, 'Credits:', cHelp - (cHelp div 9000));
      WriteConsole(ID, 'Server hosted by mich.', cHelp);
      WriteConsole(ID, 'Script by Swompie for mich.', cHelp);
      WriteConsole(ID, 'Also thanks to Squiddy, Dark Crusade and Lord Killa aka A piece of code for help!', cHelp);
    end;
  end;
end;

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #12 on: April 24, 2010, 01:49:07 pm »
Thanks man !
Can you tell me how to modify these code ?
like 00010001101
and... do you have an idea for the name of the server ?
« Last Edit: April 24, 2010, 01:58:43 pm by mich1103 »

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Script help !!!
« Reply #13 on: April 24, 2010, 02:04:44 pm »
Quote
You can enable or disable weapons with the procedure SetWeapons(ID: byte; WeaponSet: string);

I think you know what ID is there for. Now for the parameter WeaponSet.

It tells the script which weapons a player should be able to use and which not.
It needs to contain exact 14 chars.

For example the first number is for the Desert Eagles, set it to 1 and the player can't use them, but when you set it to 0 he can use them.

Here are some examples:
Code: [Select]
11111111110000 This would enable all primarys and disable all secondaries.
10001000001111 This would enable the weapons Desert Eagles, Spas and all secondaries.
This should be enough >;

No idea how you could call it.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #14 on: April 24, 2010, 07:08:05 pm »
I got an error :
Code: [Select]
[Error] (63:1): Syntax error
Code: [Select]
// script by swompie for mich

const
   DefaultWeapons = '10000000000011'; // The weapons a player gains when he joins by default (no class)
   // Colors
   cNews    = $FF00FF00; // Used for !news and the welcome message
   cClasses = $FF00FF00; // Used for !classes and the message when someone changes class
   cRules   = $FF00FF00; // Used for !rules
   cHelp    = $FF00FF00; // Used for !help, !info and !credits

var
   Weapons: Array [1..32] of string;

procedure SetWeapons(ID: byte; WeaponSet: string);
var i: byte;
begin

  if Length(WeaponSet) <> 14 then
    Weapons[ID] := DefaultWeapons
  else
    Weapons[ID] := WeaponSet;

  for i := 1 to 14 do
    SetWeaponActive(ID, i, iif(Weapons[ID][i] = '1', true, false));

end;

procedure OnJoinTeam(ID, Team: byte);
begin
  SetWeapons(ID, Weapons[ID]);
end;

procedure OnJoinGame(ID, Team: byte);
begin
  WriteConsole(ID, 'This server has classes, type !classes to get a overview', cNews);
DrawText(ID, 'This server has classes,' + #13#10 +
               'type !classes to get a overview', 300, cNews, 0.1, 60, 140);
  SetWeapons(ID, DefaultWeapons);
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
  case LowerCase(Text) of
    '!soldier': begin
      SetWeapons(ID, '11100000001000');
      WriteConsole(ID, 'You are now a soldier!', cClasses);
    end;
    '!sniper': begin
      SetWeapons(ID, '00000101000011');
      WriteConsole(ID, 'You are now a sniper!', cClasses);
    end;
    '!destroyer': begin
      SetWeapons(ID, '00001001000011');
      WriteConsole(ID, 'You are now a destroyer!', cClasses);
    end;
    '!medic': begin
      SetWeapons(ID, '00000100100011');
      WriteConsole(ID, 'You are now a medic!', cClasses);
    end;


if (Text='!credits')
      then begin
  WriteConsole(ID, '#################CREDITS##################', $FF00FF00);
          WriteConsole(ID, '#Credits go to Swompie, Dark Crusade,    #', $FF00FF00);
          WriteConsole(ID, '#LORD KILLA and squiddy                  #', $FF00FF00);
  WriteConsole(ID, '##########################################', $FF00FF00);
end;




if (Text='!classes')
 then begin
  WriteConsole(ID, '########################CLASSES###############################', $FF00FF00);
  WriteConsole(ID, '#!destroyer (Able you to take M79,spas,minigun,law and SOCOM)#', $FF00FF00);
  WriteConsole(ID, '#!sniper (Able you to take Barret,ruger,law and knife)       #', $FF00FF00);
  WriteConsole(ID, '#!medic (Able you to take Ruger,eagle,saw and knife)         #', $FF00FF00);
  WriteConsole(ID, '#Medic can also heal you if you stay next to him !           #', $FF00FF00);
          WriteConsole(ID, '##############################################################', $FF00FF00);
end;


if (Text='!help')
      then begin
  WriteConsole(ID, '################COMMANDS################', $FF00FF00);
          WriteConsole(ID, '#!classes (For a list of classes)      #', $FF00FF00);
  WriteConsole(ID, '#!credits (For credits)                #', $FF00FF00);
  WriteConsole(ID, '#!rules (for a list of rule)           #', $FF00FF00);
  WriteConsole(ID, '#!news (For a list of the lastest new) #', $FF00FF00);
  WriteConsole(ID, '#!info (To see the server descriptions)#', $FF00FF00);
          WriteConsole(ID, '########################################', $FF00FF00);
  end;


 if (Text='!news')
      then begin
WriteConsole(ID, '#################NEW##################', $FF00FF00);
        WriteConsole(ID, '#There is no new now !               #', $FF00FF00);
WriteConsole(ID, '######################################', $FF00FF00);
  end;


 
if (Text='!rules')
      then begin
  WriteConsole(ID, '#############################RULES##########################################', $FF00FF00);
         WriteConsole(ID, '#No spamming. If an admin sees you doing it you will be banned for an hour.#', $FF00FF00);
         WriteConsole(ID, '#No hacking. If an admin sees you doing it you will be banned forever.     #', $FF00FF00);
         WriteConsole(ID, '#No Pushing.                                                               #', $FF00FF00);
         WriteConsole(ID, '#No votekicking for no reasons .                                           #', $FF00FF00);         
         WriteConsole(ID, '#Do not ignore admins if they talk to you.                                 #', $FF00FF00);
         WriteConsole(ID, '#No poly bugging.                                                          #', $FF00FF00);
         WriteConsole(ID, '#Respect admins and their decisions.                                       #', $FF00FF00);
         WriteConsole(ID, '############################################################################', $FF00FF00);
     end;


if (Text='!info')
       then begin
        WriteConsole(ID, '###############INFO#################', $FF00FF00);
        WriteConsole(ID, '#This server is scripted!          #', $FF00FF00);
WriteConsole(ID, '#You can chose about 4 classe      #', $FF00FF00);
WriteConsole(ID, '#Type !classes to see these classes#', $FF00FF00);
        WriteConsole(ID, '####################################', $FF00FF00);
   end;
  end;
 end;

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #15 on: April 24, 2010, 07:41:29 pm »
'!credits': begin
not
if (Text='!credits')

I didn't see anything wrong with

"if Text = '!credits' Then Begin"..

Mich, are you sure you sent us the full Script ?
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #16 on: April 25, 2010, 06:06:30 am »
I got it !!!

Code: [Select]
// script by swompie for mich

const
   DefaultWeapons = '00000000001111'; // The weapons a player gains when he joins by default (no class)
   // Colors
   cNews    = $E88E88; // Used for !news and the welcome message
   cClasses = $FFFF00; // Used for !classes and the message when someone changes class
   cRules   = $00FF00; // Used for !rules
   cHelp    = $A77AFF; // Used for !help, !info and !credits

var
   Weapons: Array [1..32] of string;

procedure SetWeapons(ID: byte; WeaponSet: string);
var i: byte;
begin

  if Length(WeaponSet) <> 14 then
    Weapons[ID] := DefaultWeapons
  else
    Weapons[ID] := WeaponSet;

  for i := 1 to 14 do
    SetWeaponActive(ID, i, iif(Weapons[ID][i] = '1', true, false));

end;

procedure OnJoinTeam(ID, Team: byte);
begin
  SetWeapons(ID, Weapons[ID]);
end;

procedure OnJoinGame(ID, Team: byte);
begin
  WriteConsole(ID, 'This server has classes, type !classes to get a overview', cNews);
  DrawText(ID, 'This server has classes,' + #13#10 +
               'type !classes to get a overview', 300, cNews, 0.1, 60, 140);
  SetWeapons(ID, DefaultWeapons);
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
  case LowerCase(Text) of
    '!soldier': begin
      SetWeapons(ID, '11110000001000');
      WriteConsole(ID, 'You are now a soldier!', cClasses);
    end;
    '!sniper': begin
      SetWeapons(ID, '00000101000011');
      WriteConsole(ID, 'You are now a sniper!', cClasses);
    end;
    '!destroyer': begin
      SetWeapons(ID, '00001010001001');
      WriteConsole(ID, 'You are now a destroyer!', cClasses);
    end;
    '!medic': begin
      SetWeapons(ID, '10000100100011');
      WriteConsole(ID, 'You are now a medic!', cClasses);
    end;
    '!classes': begin
      WriteConsole(ID, 'Classes:', cClasses - (cClasses div 9000));
      WriteConsole(ID, 'Soldier (Desert Eagles, HK MP5, Ak74, AUG,Socom)', cClasses);
      WriteConsole(ID, 'Sniper (Ruger, Barret, Knife, LAW)', cClasses);
      WriteConsole(ID, 'Destroyer (Spas, M79, Minigun, Socom, LAW)', cClasses);
      WriteConsole(ID, 'Medic (Eagle, Ruger, Minimi, Knife, LAW)', cClasses);
      WriteConsole(ID, ' ------------------------------------------------', cClasses - (cClasses div 9000));
      WriteConsole(ID, '  Type !<classname> to change your class', cClasses);
      WriteConsole(ID, '  !soldier will change your class to soldier', cClasses);
    end;
    '!news': begin
      WriteConsole(ID, 'There are no news!', cNews);
    end;
    '!rules': begin
      WriteConsole(ID, 'Server rules:', cRules - (cRules div 9000));
      WriteConsole(ID, 'No spamming. Leads to a one hour ban if ignored.', cRules);
      WriteConsole(ID, 'No hacking. Leads to a permament ban if ignored.', cRules);
      WriteConsole(ID, 'No pushing.', cRules);
      WriteConsole(ID, 'No votekicking without a good reason.', cRules);
      WriteConsole(ID, 'No poly bugging.', cRules);
      WriteConsole(ID, 'Do NOT ignore admins if they talk to you!', cRules);
      WriteConsole(ID, 'Respect admins and their decisions!', cRules);
    end;
    '!help', '!commands': begin
      WriteConsole(ID, 'Commands:', cHelp - (cHelp div 9000));
      WriteConsole(ID, '!classes   Displays list of classes and their weapons', cHelp);
      WriteConsole(ID, '!rules     Displays server rules', cHelp);
      WriteConsole(ID, '!news      Displays news', cHelp);
      WriteConsole(ID, '!info      Displays info about the server', cHelp);
      WriteConsole(ID, '!credits   Displays the credits ', cHelp);
    end;
    '!info': begin
      WriteConsole(ID, 'Server info:', cHelp - (cHelp div 9000));
      WriteConsole(ID, 'This server is scripted, you can choose out of 4 Classes', cHelp);
      WriteConsole(ID, 'Each class has it''s own weapons', cHelp);

    end;
    '!credits': begin
      WriteConsole(ID, 'Credits:', cHelp - (cHelp div 9000));
      WriteConsole(ID, 'Server hosted by mich.', cHelp);
      WriteConsole(ID, 'Script by Swompie for mich.', cHelp);
      WriteConsole(ID, 'Also thanks to Squiddy, Dark Crusade and Lord Killa aka A piece of code for help!', cHelp);
    end;
  end;
end;
« Last Edit: April 25, 2010, 06:23:29 am by mich1103 »

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Script help !!!
« Reply #17 on: April 25, 2010, 07:10:26 am »
Watch your indentations. Those ain't nice (don't use tabs!).
Should be correct ... really, watch your indentations or I'll be very upset :-\

Why not use Tabs? I always use them, and they're the best. lol  ;D

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Script help !!!
« Reply #18 on: April 25, 2010, 09:41:14 am »
Why not use Tabs? I always use them, and they're the best. lol  ;D

Code: (pascal) [Select]
{
 I don't know..
  My Scripts
   Are always
    Like this
   Instead
  Of
 Tabbing :)
}
« Last Edit: April 25, 2010, 09:44:08 am by squiddy »
www.soldatx.com.br - The brazilian Soldat community.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Script help !!!
« Reply #19 on: April 25, 2010, 09:53:38 am »
I want to do new classe
but...i dont know how i can procede !

!mechanic
i want that at each kill he gain cluster !
and ForceWeapon (Flamer all time)

!assassins
Predator mode all time
only knife !