0 Members and 2 Guests are viewing this topic.
if Text = '!help' then beginif (Text = '!help') then begin
if (Text = '!help') or (Text = '!Help') then begin
if LowerCase(Text) = '!help' then begin
type:Code: [Select]// Declare the typetype TPlayer = Record Task: byte; // I used task instead of Class because Class is a reserved word :/ end;// Now create an array, one index slot for each playervar Player: Array [1..32] of TPlayer;// Looks like that when you use it:procedure SetTask(ID, Task: byte);begin Player[ID].Task := Task;end;
// Declare the typetype TPlayer = Record Task: byte; // I used task instead of Class because Class is a reserved word :/ end;// Now create an array, one index slot for each playervar Player: Array [1..32] of TPlayer;// Looks like that when you use it:procedure SetTask(ID, Task: byte);begin Player[ID].Task := Task;end;
// Declare the typetype // Use the type keyword so the compiler knows we are defining a type TPlayer = Record // Tell the compiler the name of the type and what type the type will be (in this case, record) Task: byte; // Write a list of variables to go with that type Var2: string; end; // end type decleration// Now create an array, one index slot for each playervar Player: Array [1..32] of TPlayer;// Looks like that when you use it:procedure SetTask(ID, Task: byte);begin Player[ID].Task := Task;end;
TypedVar.SubVar
Type TPlayer = record Level: Byte; LoggedIn: boolean; Account: string; Skills: string; Power: Byte; EXP: integer; end;var Player: Array [1..32] of TPlayer
Player[12].LevelPlayer[3].LoggedInPlayer[7].Skills
procedure AppOnIdle(Ticks: Integer); if (TPlayer.Klasse = Berserker) then begin var Timer: Integer; Timer = 10; if Timer > 0 then Timer := Timer -1 if Timer = 0 then begin ForceWeapon(Player, 14, 255, 0); Timer := 10; end; end;
type TPlayer = Record Klasse: byte; end;// Here I create an array for every player.var Player: Array [1..32] of TPlayer;// This saves the players class in the variable Klasseprocedure SetKlasse(ID, Klasse: byte);begin Player[ID].Klasse := Klasse; end;
10-04-10 13:32:39 [*] Compiling Knife Server -> KnifeServer.pas...10-04-10 13:32:39 [*] Knife Server -> [Error] (23:29): Type mismatch10-04-10 13:32:39 [*] Compilation Failed.10-04-10 13:32:39 Shutting down server...
10-04-10 16:21:12 [*] Compiling Knife Server -> KnifeServer.pas...10-04-10 16:21:12 [*] Knife Server -> [Error] (23:11): Type mismatch10-04-10 16:21:12 [*] Compilation Failed.10-04-10 16:21:12 Shutting down server...
What mean that ?if Timer > 0 then Timer := Timer -1
procedure SetKlasse(ID, Klasse: String);begin Player[ID].Klasse := Klasse; end;
procedure SetKlasse(ID: byte; Klasse: string);
//Helping DarkCrusade..//By Squiddy ~//Note I didn't add any stuff in the OnPlayerSpeak Procedure, because I'm only helping you in the Berserker stuff. You can handle the commands and rules stuff ;]Const //Setting some Global Constants.. Color = $FEDEBA; //Color to be used. This is my private color. Change it if you want :P Var //Setting some Global Variants.. Klasse: Array[1..32] of String; //With this, you don't need the Type Record stuff. Usage: "Klasse[ID]" Procedure OnPlayerSpeak(ID: Byte; Text: String); Begin //Starts the Procedure.. Text := LowerCase(Text); //With this, you don't need to add "if Lowercase(Text) = '!berserker'". "Text := LowerCase(Text);" works for every text typed inside the OnPlayerSpeak Procedure. if Text = '!berserker' Then Begin //If player types !Berserker.. WriteConsole(ID,'You are now a freaking berserker!',Color); //Then show this message to him. Klasse[ID] := 'Berserker'; //Set his class to berserker.. end; //Ending the text function..end; //Ending the procedure.Procedure AppOnIdle(Ticks: Integer); Var DC: Byte; //DC is a player's ID. Since AppOnIdle doesn't hold any ID, we have to create one. I used DC because of "DarkCrusade". It's a teaching proccess, it's very helpfull to use the student's initials. It helps student to assimilate stuff. Begin For DC := 1 To 32 Do if GetPlayerStat(DC,'Alive') = True Then Begin //"1 To 32" is to determine that DC is a player's ID. GetPlayerStat() stuff is to see if player is alive. if Klasse[DC] = 'Berserker' Then Begin //Checks if his class is berserker.. if Ticks Mod 60 * 10 = 0 Then //Every 10 seconds... ForceWeapon(DC,14,255,0); //The player receives a knife. end; //Ending the Klasse Function.. end; //Ending the DC function..end; //Ending the Procedure.
Sure I remember you, Squiddy, great time back then Thanks a lot for your help, now my script works perfectly and I even understood all the new stuff!
Function OnPlayerDamage(Victim, Shooter: Byte; Damage: Integer): Integer; Var DC: Integer; //DC is the ammount of damage that will be increased.. Begin //Starts.. if Klasse[Shooter] = 'Berserker' Then Begin //Checks is player's class is Berserker.. DC := Random(10,150); //Sets an value to DC to be added to the damage. It can be from 10 to 149. Result := Damage + DC; //Adds DC to Damage.. end else Result := Damage; //Ending the Klasse Function. If Shooter's class isn't Berserker, the damage dealt will be the same.end; //Ending the Function.
Procedure AppOnIdle(Ticks: Integer); Var DC: Byte; //DC is a player's ID. Since AppOnIdle doesn't hold any ID, we have to create one. I used DC because of "DarkCrusade". It's a teaching proccess, it's very helpfull to use the student's initials. It helps student to assimilate stuff. Begin For DC := 1 To 32 Do if GetPlayerStat(DC,'Alive') = True Then Begin //"1 To 32" is to determine that DC is a player's ID. GetPlayerStat() stuff is to see if player is alive. if Klasse[DC] = 'Berserker' Then Begin //Checks if his class is berserker.. if Ticks Mod (60 * 10) = 0 Then //Every 10 seconds... ForceWeapon(DC,14,255,0); //The player receives a knife. end; //Ending the Klasse Function.. end; //Ending the DC function..end; //Ending the Procedure.
Function OnPlayerDamage(); Begin //Starts.. if Klasse[Shooter] = 'Berserker' Then Begin //Checks is Shooter's class is Berserker WriteConsole(Shooter,'You are a Berserker',$FFFFFF); //Send this message if Klasse[Shooter] is Berserker. end else WriteConsole(Shooter,'You are so not a Berserker',$FFFFFF); //If Klasse[Shooter] isnt Berserker, send this.end; //Ending the Function..