Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: BRADEN on March 12, 2008, 01:30:01 pm

Title: Spawner v1.5.1
Post by: BRADEN on March 12, 2008, 01:30:01 pm
Script Name: Spawner v1.5.1

Script Description: This script gives players the ability to spawn weapons and bonuses. The following list (also available in game) shows you the commands and what they spawn.

Spawn Desert Eagles - /deagles
Spawn HK MP5 - /mp5
Spawn AK-74 - /ak74
Spawn Steyr AUG - /steyr
Spawn Spas-12 - /spas
Spawn Ruger 77 - /ruger
Spawn M79 - /m79
Spawn Barrett M82A1 - /barrett
Spawn FN Minimi - /minimi
Spawn XM214 Minigun - /minigun
Spawn USSOCOM - /socom
Spawn Combat Knife - /knife
Spawn Chainsaw - /saw
Spawn M72 LAW - /law
Spawn M2 Stationary Gun - /stat
Spawn Medikit bonus - /med
Spawn Grenades bonus - /nades
Spawn Flame God bonus - /flame
Spawn Bulletproof Vest bonus - /vest
Spawn Predator bonus - /pred
Spawn Berserker bonus - /berserk
Spawn Cluster Grenades bonus - /cluster

Original Author(s): Braden

Core Version: v2.6.3

Code:

Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
//Spawner v1.5.1 by Braden
        if Text = '/commands1' then begin
                WriteConsole(ID,'Spawn Desert Eagles - /deagles',$EE00FFFF);
                WriteConsole(ID,'Spawn HK MP5 - /mp5',$EE00FFFF);
                WriteConsole(ID,'Spawn AK-74 - /ak74',$EE00FFFF);
                WriteConsole(ID,'Spawn Steyr AUG - /steyr',$EE00FFFF);
                WriteConsole(ID,'Spawn Spas-12 - /spas',$EE00FFFF);
                WriteConsole(ID,'Spawn Ruger 77 - /ruger',$EE00FFFF);
                WriteConsole(ID,'Spawn M79 - /m79',$EE00FFFF);
                WriteConsole(ID,'Spawn Barrett M82A1 - /barrett',$EE00FFFF);
                WriteConsole(ID,'Spawn FN Minimi - /minimi',$EE00FFFF);
                WriteConsole(ID,'Spawn XM214 Minigun - /minigun',$EE00FFFF);
                WriteConsole(ID,'Spawn USSOCOM - /socom',$EE00FFFF);
                WriteConsole(ID,'Spawn Combat Knife - /knife',$EE00FFFF);
                WriteConsole(ID,'Spawn Chainsaw - /saw',$EE00FFFF);
                WriteConsole(ID,'Spawn M72 LAW - /law',$EE00FFFF);
                WriteConsole(ID,'Spawn M2 Stationary Gun - /stat',$EE00FFFF);
        end;
        if Text = '/commands2' then begin
                WriteConsole(ID,'Spawn Medikit bonus - /med',$EE00FFFF);
                WriteConsole(ID,'Spawn Grenades bonus - /nades',$EE00FFFF);
                WriteConsole(ID,'Spawn Flame God bonus - /flame',$EE00FFFF);
                WriteConsole(ID,'Spawn Bulletproof Vest bonus - /vest',$EE00FFFF);
                WriteConsole(ID,'Spawn Predator bonus - /pred',$EE00FFFF);
                WriteConsole(ID,'Spawn Berserker bonus - /berserk',$EE00FFFF);
                WriteConsole(ID,'Spawn Cluster Grenades bonus - /cluster',$EE00FFFF);
        end;
        if Text = '/deagles' then begin
                SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),1);
                WriteConsole(0,'A command has been entered',$EEFF0000);
                WriteConsole(ID,'You have been given the Desert Eagles',$EE00FFFF);
        end;
        if Text = '/mp5' then begin
                SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),2);
                WriteConsole(0,'A command has been entered',$EEFF0000);
                WriteConsole(ID,'You have been given the HK MP5',$EE00FFFF);

ETC.                    ETC.                    ETC.                    ETC.                    ETC.
Code: [Select]
procedure OnJoinGame(ID, Team: byte);
begin
WriteConsole(ID,'Spawner v1.5.1 by Braden',$EE0000FF);
WriteConsole(ID,'/commands1 for Commands List Part 1 (weapon spawns)',$EE00FFFF);
WriteConsole(ID,'/commands2 for Commands List Part 2 (bonus spawns)',$EE00FFFF);
end;

Title: Re: Gimme v1
Post by: larxiz on March 12, 2008, 03:15:40 pm
Nice Work!. Really Fantastic And a very nice and well made program.
Keep it up!
Title: Re: Gimme v1
Post by: Boblekonvolutt on March 12, 2008, 05:18:55 pm
Well, that will always spawn the object at player 1, not at the user... You might also wanna look into this (http://www.taoyue.com/tutorials/pascal/pas3cb.html).
Title: Re: Gimme v1
Post by: SyavX on March 13, 2008, 04:00:53 am
omg, what a poor programming style...
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
var x, y: single;
begin
  GetPlayerXY(ID, x, y);
  if GetPiece(Text, ' ', 0) = '/gimme' then
    case GetPiece(Text, ' ', 1) of
        'deagles': SpawnObject(x, y, 1);
        'mp5': SpawnObject(x, y, 2);
        'ak': SpawnObject(x, y, 3);
        'steyr': SpawnObject(x, y, 4);
        'spas': SpawnObject(x, y, 5);
        'ruger': SpawnObject(x, y, 6);
        'm79': SpawnObject(x, y, 7);
        'barrett': SpawnObject(x, y, 8);
        'minimi': SpawnObject(x, y, 9);
        'minigun': SpawnObject(x, y, 10);
        'socom': SpawnObject(x, y, 11);
        'knife': SpawnObject(x, y, 12);
        'chainsaw': SpawnObject(x, y, 13);
        'law': SpawnObject(x, y, 14);
        'stat': SpawnObject(x, y, 15);
        'med': SpawnObject(x, y, 16);
        'nades': SpawnObject(x, y, 17);
        'flamer': SpawnObject(x, y, 18);
        'vest': SpawnObject(x, y, 19);
        'pred': SpawnObject(x, y, 20);
        'berserker': SpawnObject(x, y, 21);
        'clusters': SpawnObject(x, y, 22);
    end;
  //NOTE: This function will be called when [_ANY_] player types a / command.
  Result := false; //Return true if you want disable the command typed.
end;
or even
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
var x, y: single; weap: byte;
begin
  GetPlayerXY(ID, x, y);
  if GetPiece(Text, ' ', 0) = '/gimme' then
    begin
      case GetPiece(Text, ' ', 1) of
        'deagles': weap := 1;
        'mp5': weap := 2;
        'ak': weap := 3;
        'steyr': weap := 4;
        'spas': weap := 5;
        'ruger': weap := 6;
        'm79': weap := 7;
        'barrett': weap := 8;
        'minimi': weap := 9;
        'minigun': weap := 10;
        'socom': weap := 11;
        'knife': weap := 12;
        'chainsaw': weap := 13;
        'law': weap := 14;
        'stat': weap := 15;
        'med': weap := 16;
        'nades': weap := 17;
        'flamer': weap := 18;
        'vest': weap := 19;
        'pred': weap := 20;
        'berserker': weap := 21;
        'clusters': weap := 22
        else weap := 0;
      end;
    if weap > 0 then SpawnObject(x, y, weap);
  end;

  //NOTE: This function will be called when [_ANY_] player types a / command.
  Result := false; //Return true if you want disable the command typed.
end;
Title: Re: Gimme v1
Post by: Kagesha on March 13, 2008, 04:40:53 am
Does it have to be gimme? Can it be /g for short? Makes it much more easier
Title: Re: Gimme v1
Post by: rumpel on March 13, 2008, 07:01:25 am
just change /gimme to /g? ;P
Title: Re: Gimme v1
Post by: ghg on March 13, 2008, 12:37:24 pm
No it can't. Soldat/the server won't parse any commands shorter than three characters (excluding the forward-slash).
Title: Re: Gimme v1
Post by: sai`ke on March 13, 2008, 02:38:41 pm
They would be longer than 3 letters. I mean "/g short" is 8 characters for instance. So yes, it would be possible.
Title: Re: Gimme v1
Post by: ghg on March 13, 2008, 02:55:44 pm
Good point.

In which case, changing the ak to ak47 and removing the g altogether and just having the weapon names as the command would be faster.
Title: Re: Gimme v1
Post by: sai`ke on March 13, 2008, 03:43:59 pm
Yea, that's right. Or use numbers :P
Title: Re: Gimme v1
Post by: BRADEN on March 14, 2008, 10:29:54 am
I'm new at this stuff, btw it's gimme not g so that to prevent abuse.

Quote
Nice Work!. Really Fantastic And a very nice and well made program.
Keep it up!

That's my friend being sarcastic.

Quote
Well, that will always spawn the object at player 1, not at the user... You might also wanna look into this.

How do I make it spawn at the user?
Title: Re: Gimme v1.1
Post by: Eclipse on March 14, 2008, 04:32:54 pm
/give would be better. Gimme sounds like a 5 Year old word.
Title: Re: Gimme v1.1
Post by: Laser Guy on March 14, 2008, 04:39:13 pm
What bout "/giv"
Title: Re: Gimme v1.1
Post by: rumpel on March 14, 2008, 05:22:03 pm
hi

works very well now.. gj

but can you make a command with you can spawn all weapons and powerups?
Title: Re: Gimme v1.1
Post by: Boblekonvolutt on March 14, 2008, 06:32:20 pm
Change
Quote
Well, that will always spawn the object at player 1, not at the user... You might also wanna look into this.

How do I make it spawn at the user?
OnPlayerCommand comes with ID (the user) and Text (the command), just put ID instead of 1 and it will put it at the right place.

but can you make a command with you can spawn all weapons and powerups?
You can't spawn everything, so no.
Title: Re: Gimme v1.1
Post by: DorkeyDear on March 14, 2008, 06:44:27 pm
but can you make a command with you can spawn all weapons and powerups?
You can't spawn everything, so no.
You goda loop through all possibilities, then spawn each one. Should be a really quick process
Code: [Select]
var
  i: byte;
begin
//...
if Text = '/gimme all' then begin
  for i := 1 to 22 do SpawnObject(GetPlayerStat(Id, 'X'), GetPlayerStat(Id, 'Y'), i);
end;
end;
Title: Re: Gimme v1.1
Post by: Boblekonvolutt on March 15, 2008, 12:37:25 am
Oh, might have misunderstood the question a bit eh. I thought he meant bows and stuff too.
Title: Re: Gimme v1.1
Post by: rumpel on March 15, 2008, 05:30:08 am
but can you make a command with you can spawn all weapons and powerups?
You can't spawn everything, so no.
You goda loop through all possibilities, then spawn each one. Should be a really quick process
Code: [Select]
var
  i: byte;
begin
//...
if Text = '/gimme all' then begin
  for i := 1 to 22 do SpawnObject(GetPlayerStat(Id, 'X'), GetPlayerStat(Id, 'Y'), i);
end;
end;

works thank you


btw bow dont work hm?
Title: Re: Spawn Mod v1.4
Post by: A Zombie on March 16, 2008, 04:19:02 am
Good Script, keep up the good work ;D
Title: Re: Spawn Mod v1.4
Post by: rumpel on March 16, 2008, 05:31:58 am
amazing... and now you should add function that it spawns to all
but okay... you said i only have to replace ID with 0?
wont work to me... but
for i := 1 to 32 do SpawnObject(GetPlayerStat(i,'x'),GetPlayerStat(i,'y'),5); works :D

but i dont like that it shows all players who join teh game and those console show things
Title: Re: Spawn Mod v1.4
Post by: BRADEN on March 16, 2008, 07:26:06 am
Did you want a spawn weapon to all players or a spawn all weapons to a player?
Title: Re: Spawn Mod v1.4
Post by: rumpel on March 16, 2008, 07:45:53 am
a spawn weapons to all players... already got a nice spawn all weapons to a player ;)
Title: Re: Spawn Mod v1.4
Post by: BRADEN on March 16, 2008, 08:04:59 am
Changing ID to 0 DOES work...
Title: Re: Spawn Mod v1.4
Post by: shantec on March 17, 2008, 08:51:54 am
i think " /get " would be best
it has 3 letters and its a word :p
Title: Re: Spawn Mod v1.4
Post by: BRADEN on March 17, 2008, 11:12:01 am
Did you realise that I removed the word completely in version 1.4?
Title: Re: Spawner v1.5
Post by: rumpel on March 19, 2008, 06:14:44 am
would be cool if you adds an changelog so we know what youve changed o.รด
Title: Re: Spawner v1.5
Post by: BRADEN on March 19, 2008, 11:43:20 am
Too late :( Forgot now...
Title: Re: Spawner v1.5
Post by: NeoniK on April 14, 2008, 08:27:44 am
how to make predatour or berserker without voice ? :D and how to make just one spawn of med or nades ?  ??? ???
Title: Re: Spawner v1.5
Post by: BRADEN on April 16, 2008, 11:41:07 am
I don't know...