Author Topic: Spawner v1.5.1  (Read 7351 times)

0 Members and 1 Guest are viewing this topic.

Offline BRADEN

  • Camper
  • ***
  • Posts: 319
Spawner v1.5.1
« 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;

« Last Edit: June 07, 2008, 05:35:26 pm by BRADEN »

Death is the solution to all problems. No man; no problem.
-Joseph Stalin

Offline larxiz

  • Major(1)
  • Posts: 1
Re: Gimme v1
« Reply #1 on: March 12, 2008, 03:15:40 pm »
Nice Work!. Really Fantastic And a very nice and well made program.
Keep it up!

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Gimme v1
« Reply #2 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.

Offline SyavX

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 338
Re: Gimme v1
« Reply #3 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;

Offline Kagesha

  • Flagrunner
  • ****
  • Posts: 702
  • cunts
Re: Gimme v1
« Reply #4 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

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Gimme v1
« Reply #5 on: March 13, 2008, 07:01:25 am »
just change /gimme to /g? ;P
banned.

Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Gimme v1
« Reply #6 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).
-=Gradius wuz you=-

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Gimme v1
« Reply #7 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.
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline ghg

  • Camper
  • ***
  • Posts: 411
  • Village Idiot
Re: Gimme v1
« Reply #8 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.
-=Gradius wuz you=-

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Gimme v1
« Reply #9 on: March 13, 2008, 03:43:59 pm »
Yea, that's right. Or use numbers :P
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline BRADEN

  • Camper
  • ***
  • Posts: 319
Re: Gimme v1
« Reply #10 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?
« Last Edit: March 14, 2008, 10:34:45 am by BRADEN »

Death is the solution to all problems. No man; no problem.
-Joseph Stalin

Offline Eclipse

  • Soldier
  • **
  • Posts: 210
  • :D
Re: Gimme v1.1
« Reply #11 on: March 14, 2008, 04:32:54 pm »
/give would be better. Gimme sounds like a 5 Year old word.
All teh Piezors Shall beh Minezors!

Offline Laser Guy

  • Veteran
  • *****
  • Posts: 1679
Re: Gimme v1.1
« Reply #12 on: March 14, 2008, 04:39:13 pm »
What bout "/giv"
Text goes here...

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Gimme v1.1
« Reply #13 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?
banned.

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Gimme v1.1
« Reply #14 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.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Gimme v1.1
« Reply #15 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;

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Gimme v1.1
« Reply #16 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.

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Gimme v1.1
« Reply #17 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?
« Last Edit: March 15, 2008, 08:04:14 am by rumpel »
banned.

Offline A Zombie

  • Major(1)
  • Posts: 25
  • BRAINS!!!
Re: Spawn Mod v1.4
« Reply #18 on: March 16, 2008, 04:19:02 am »
Good Script, keep up the good work ;D

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Spawn Mod v1.4
« Reply #19 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
« Last Edit: March 16, 2008, 05:52:10 am by rumpel »
banned.