Official Soldat Forums
Server Talk => Scripting Releases => Topic started 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:
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.
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;
-
Nice Work!. Really Fantastic And a very nice and well made program.
Keep it up!
-
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).
-
omg, what a poor programming style...
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 evenfunction 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;
-
Does it have to be gimme? Can it be /g for short? Makes it much more easier
-
just change /gimme to /g? ;P
-
No it can't. Soldat/the server won't parse any commands shorter than three characters (excluding the forward-slash).
-
They would be longer than 3 letters. I mean "/g short" is 8 characters for instance. So yes, it would be possible.
-
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.
-
Yea, that's right. Or use numbers :P
-
I'm new at this stuff, btw it's gimme not g so that to prevent abuse.
Nice Work!. Really Fantastic And a very nice and well made program.
Keep it up!
That's my friend being sarcastic.
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?
-
/give would be better. Gimme sounds like a 5 Year old word.
-
What bout "/giv"
-
hi
works very well now.. gj
but can you make a command with you can spawn all weapons and powerups?
-
Change
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.
-
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
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;
-
Oh, might have misunderstood the question a bit eh. I thought he meant bows and stuff too.
-
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
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?
-
Good Script, keep up the good work ;D
-
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
-
Did you want a spawn weapon to all players or a spawn all weapons to a player?
-
a spawn weapons to all players... already got a nice spawn all weapons to a player ;)
-
Changing ID to 0 DOES work...
-
i think " /get " would be best
it has 3 letters and its a word :p
-
Did you realise that I removed the word completely in version 1.4?
-
would be cool if you adds an changelog so we know what youve changed o.รด
-
Too late :( Forgot now...
-
how to make predatour or berserker without voice ? :D and how to make just one spawn of med or nades ? ??? ???
-
I don't know...