Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: mich1103 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 ?
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
-
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:
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
-
Omg, try doing it like this:
Haven't tested, I have no idea if it's going to work or not.
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;
-
1-10 Primarys; 11-14 Secondary -.-"
-
do i need to disable weapon on soldat.ini ?
-
defiantly not.
-
The script has passed but the SetActiveWeapon dont work more ...
-
I recoded my DisableAll procedure. Start with something like this:
Procedure DisableAll(ID: Byte);
var ALL: Byte;
begin
for ALL := 1 to 14 do
SetWeaponActive(ID,ALL,false);
end;
Then you go on ...
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 ...
-
Like that ?
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;
-
Watch your indentations. Those ain't nice (don't use tabs!).
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.
-
So ... i put that on OnJoinGame ?
Procedure OnJoinTeam(ID,Team:Byte);
begin
case Team of
begin
DisableAll(ID);
SetWeaponActive(ID,<WepID>, true);
end;
end;
end;
-
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:
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:
// 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;
-
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 ?
-
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:
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.
-
I got an error :
[Error] (63:1): Syntax error
// 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;
-
'!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 ?
-
I got it !!!
// 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;
-
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
-
Why not use Tabs? I always use them, and they're the best. lol ;D
{
I don't know..
My Scripts
Are always
Like this
Instead
Of
Tabbing :)
}
-
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 !
-
This should work.. Haven't tested it.
//Script help to Mich
//By Squiddy ~
//Thanks to HackTank for MaintainWeapons();
Const
Color = $FEDEBA; //Color to be used.
Var
Classe: Array[1..32] of String;
Procedure MaintainWeapons(ID, WepNum: Byte);
Var Wep: Byte;
Begin
Wep := GetPlayerStat(ID,'Primary');
if Wep <> WepNum Then ForceWeapon(ID,WepNum,GetPlayerStat(ID,'Secondary'),0);
end;
Procedure OnPlayerKill(Killer, Victim: Byte; Weapon: String);
Begin
if Classe[Killer] = 'Mechanic' Then Begin
GiveBonus(Killer,5);
end;
end;
Procedure OnPlayerRespawn(ID: Byte);
Begin
if Classe[ID] = 'Mechanic' Then MaintainWeapons(ID, 11);
if Classe[ID] = 'Assassins' Then MaintainWeapons(ID, 14);
end;
Procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
Begin
if Classe[ID] = 'Mechanic' Then MaintainWeapons(ID, 11);
if Classe[ID] = 'Assassins' Then MaintainWeapons(ID, 14);
end;
Procedure OnPlayerSpeak(ID: Byte; Text: String);
Begin
if LowerCase(Text) = '!mechanic' Then if Classe[ID] = 'None' Then Begin
Classe[ID] := 'Mechanic';
WriteConsole(ID,'You are now a mechanic!',Color);
end;
if LowerCase(Text) = '!assassins' Then if Classe[ID] = 'None' Then Begin
Classe[ID] := 'Assassins';
WriteConsole(ID,'You are now an Assassin!',Color);
end;
end;
Procedure AppOnIdle(Ticks: Integer);
Var S: Byte;
Begin
For S := 1 To 32 Do if GetPlayerStat(S,'Active') = True Then Begin
if Classe[S] = 'Mechanic' Then Begin
MaintainWeapons(S,11);
end;
if Classe[S] = 'Assassins' Then Begin
if Ticks Mod (60 * 15) = 0 Then Begin GiveBonus(S,1);
end if Ticks Mod 60 = 0 Then Begin MaintainWeapons(S,14);
end;
end;
end;
end;
Procedure OnJoinGame(ID, Team: Byte);
Begin
Classe[ID] := 'None';
end;
-
Your script work but ...
1-when i do !mechanic i cant change my classe for !assassins
2-when i do !assassins i cant change my classe for !mechanic
3-can you include the swompie script with yours to make a big one ?
4-i can be all the other classe at the same time i am a !assassins or a
!mechanic
-
Your script work but ...
1-when i do !mechanic i cant change my classe for !assassins
2-when i do !assassins i cant change my classe for !mechanic
Simply delete that "if Classe[ID] = 'None' Then ...' stuff on PlayerSpeak. I just thought that you could only change your class if you had none.
3-can you include the swompie script with yours to make a big one ?
Nope. I actually have a life, sorry :P
Try to do it yourself :)
4-i can be all the other classe at the same time i am a !assassins or a !mechanic
I didn't really get that. Either you are one, or another.
-
In regards to tabs: I find tabs are better since it gives the viewer the option of the indentation size, whether it is visually 2 spaces, or 4, its up to the user (or program used rather). That is why I switched to tabs instead of 2 spaces, as I have been doing before.
-
[...]
That is why I switched to tabs instead of 2 spaces, as I have been doing before.
My Scripts are always One-Space Based.
.Just
..Like
...This
..See
.What
I mean ?
-
Tabs ftw...
-
http://edn.embarcadero.com/article/10280#4.3
It's officially recommended to use two spaces. :D
If not for that, do it because it's easier to read (I don't think Pascal's verboseness works well with tabs, to be honest).
-
Tabs ftw...
Well, for your coding style yes (actually it's pretty weird, anyone says it ::))
http://edn.embarcadero.com/article/10280#4.3
It's officially recommended to use two spaces. :D
If not for that, do it because it's easier to read (I don't think Pascal's verboseness works well with tabs, to be honest).
<3