Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: Kavukamari on October 23, 2007, 11:20:46 pm

Title: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on October 23, 2007, 11:20:46 pm
After much thought, Re-Scripting, and debugging I have decided to release my "OnCommand" script with a more catchy (sorry fistbox, mine is a "box" too) name

Script Name: CommandCrate
Script Description: Contains my /create, /spawn, /force, /damage, /move, /active*, /kills*, and /mega scripts&commands (* = new command) I'm hoping these will be added to servers soon, as the commands are fun (if you are an admin ;) )
Original Author(s): Me!!! help from Toumaz in debugging, Re-Scripted by me (the file(s) used to be bigger, now all commands are in one script and is as compact as I can make it)
Core Version: 2.6.3 ??
Code:
Quote from: "Readme.txt'
Commands are as follows:

/create
params:
[pnum] (player number to create bullet at)
[xoff] (x axis offset -# = left, +# = right)
[yoff] (y axis offset -# = up, +# = down)
[xvel] (x velocity -# = left, +# = right)
[yvel] (y velocity -# = up, +# = down)
[hitm] (hit multiplier)
[type] (bullet type)
[owns] (owner of bullet)

command syntax example:
/create 1 0 0 3 -5 100 4 1 (creates a m79 nade at player 1's location with no offsets, going up and right (player 1 ownes bullet))

/spawn
params:
[wnum] (object number to spawn)
[pnum] (player number to spawn object at)
[xoff] (x offset)
[yoff] (y offset)

command syntax example:
/spawn 5 1 0 0 (spawns spas 12 @ player 1's location(no offsets))

/force
params:
[pnum] (player number who's weaps to force)
[prim] (primary weapon)
[secd] (secondary weapon)
[ammo] (Ammo to give, 0 is default)

command syntax example:
/force 1 10 5 0 (forces player1 to have minigun as primary and spas 12 as secondary with default ammo)

/dodamage
params:
[pnum] (player to damage)
[dmgi] (damage integer)

command syntax example:
/dodamage 1 150 ("Perfect kill"'s player 1 (perfect kill is 150 damage, that's the minimal damage to kill a player in DoDamage))

/move
params:
[pnum] (player to move)
[tnum] (player to move to)
[xoff] (x offset)
[yoff] (y offset)

command syntax example:
/move 1 2 0 0 (moves player 1 to player 2 (no offsets)

/kills
params:
[pnum] (player who's kills to set)
[kills] (new kills amount)

command syntax example:
/kills 1 5 (set's player 1's kills to 5)

/active (might change to /toggle)
params:
[pnum] (player whos weap to toggle)
[wnum] (weapon to toggle)
[optn] (true for on or false for off)

command syntax example:
/active 1 5 false (sets player 1's spas to off in weap menu)

/mega
params:
[script] (script to use on all players)
[script params] (script's params)

command syntax examples:
/mega move 1 0 0 (moves all players to player 1 (no offsets))
/mega spawn 5 0 0 (spawns spas 12 at all players feet (no offsets))
/mega active 1 false (turns deagles off for all players)

full list:
/create (params)
/spawn (params)
/force (params)
/dodamage (params)
/move (params)
/kills (params)
/active (params)
/mega (params)

(attached)

Title: Re: CommandBox
Post by: 1221995 on October 24, 2007, 06:13:17 am
Hey, kavakumari? the commands are a little bit hard to understand, but i think i get them ;)
This looks very fun, i think i mite try it sometime on my server (its not very popular tho, but i can try)
i think i mite try to change it some commands work for all players, ya know???

EDIT: it looks REALLY FUN now that i look at it lol

Suggestions:
you could make every player be able to do, like i mentioned, ;)
you could make a /commands so that people could see the commands
you could add a /wepnums so thatyou could see what the numbers are
you could add a  /playernums so that you could see what the player numbers are
ill add more, but i cant right now, cause i got somone on my lap... litterally... no.. really... he's on my lap rite now... it makes it hard to type LOLZ

RE EDIT: im adding more now
Title: Re: CommandBox
Post by: Toumaz on October 24, 2007, 07:45:28 am
(sorry fistbox, mine is a "box" too)
Original name and concept, eh >:|

Wish I could say good job, but considering how messy and bloated the code is, I think you still have a few ways to go before that's justified.

Few thoughts:

Title: Re: CommandBox
Post by: Kavukamari on October 24, 2007, 12:51:05 pm
Quote from: suggestion 1 (1221995)
Suggestions:
you could make every player be able to do, like i mentioned, ;)
if you must... (OnCommand changes to OnPlayerCommand)

Quote from: suggestion 2 (1221995)
you could make a /commands so that people could see the commands
I'll work on it (prolly a /help [script] comand in-game too)

Quote from: suggestion 3&4 (1221995)
you could add a /wepnums so thatyou could see what the numbers are
you could add a /playernums so that you could see what the player numbers are
/weapnums: I'll get right on it (day after tomorro, I lost two days worth of computer time posting this script, I have to live off school comps for 2 days)
/playernums: when commanding (/) press F1 (score menu) and it shows player nums

Quote from: Angry Toumaz
Quote from: Kavukamari
(sorry fistbox, mine is a "box" too)
Original name and concept, eh >:|
I'll change the name to CommandCrate, ok? better? (not much change)

Quote from: Toumaz
Few thoughts:

Use proper and more efficient variable declarations instead of loads of global variants

suggestions? should I array my temps instead?

Quote
You'd preferably want exception handling to tell the player he's messing stuff up
I thought I covered everything :/

Quote
Read up on the case statement and use that instead of the myriads of if's
I'll search...

Quote
Your code indentation is fugly, to say the least
O.o what's wrong T_T I add more double spaces after new begins

Quote
Loops whose only intention is to handle players are better off with the iteration variable as a byte, seeing as it's a bit more memory efficient
will change

Quote
There's no point in storing wether or not a player is active in an array, seeing as you could simply do GetPlayerStat(ID,'active') directly
arraying it lessens code size (even by a little) I like it this way...

I'll fix problems when I'm on the comp again
Title: Re: CommandBox
Post by: 1221995 on October 24, 2007, 02:27:45 pm
Suggestions cont.:
--how about a name like Com-Play, Complay or command play(those prolly stink, im just making random suggestions lol :P ) ? Maybe somthing like Free-command. you could also do something that sounds cool  like F15 or XQ9. lol
--im not sure wether u hav it already, but if not, how about a /tele (and, optionaly, a /mapcoords). /mapcoords would put u in spec mode, but tell u wat the coords are whereever ur mouse is (im like 90 percent sure thats impossible, but o well, just a suggestion) :P
--this would be cheap if it could be used by anyone, but only used by admins, it could be cool. Im thinking a /spawnset that would let u choose were u wanna respawn every time. typeing /spawnset current or someting would make u respawn in the place u just wer. This would just be fun to hav.
-- lastly, (sorry toumaz, its just such a cool concept) a /godmode on/off command.
Ill add even more later.


EDIT:  thought of some...
-- a /jam command that jams a certain player numbers gun. /unjam could also be used the same way. (by jam, i mean the reload bar stays in the same place and if is reloded, wont shoot.
-- a /jamwep command that jams a certain GUN of all players. lets say 2 people have m79s.
/jamwep 7 makes both of their guns jam. that way u can temp deactivate guns while people still hav them. /unjam could also be used the same way.
-- also, u could try to make commands a lil simpler ;)
Title: Re: CommandBox
Post by: Kavukamari on October 24, 2007, 03:09:19 pm
Quote from: suggestions (1221995)
Suggestions cont.:
--how about a name like Com-Play, Complay or command play(those prolly stink, im just making random suggestions lol :P ) ? Maybe somthing like Free-command. you could also do something that sounds cool  like F15 or XQ9. lol
--im not sure wether u hav it already, but if not, how about a /tele (and, optionaly, a /mapcoords). /mapcoords would put u in spec mode, but tell u wat the coords are whereever ur mouse is (im like 90 percent sure thats impossible, but o well, just a suggestion) :P
--this would be cheap if it could be used by anyone, but only used by admins, it could be cool. Im thinking a /spawnset that would let u choose were u wanna respawn every time. typeing /spawnset current or someting would make u respawn in the place u just wer. This would just be fun to hav.
-- lastly, (sorry toumaz, its just such a cool concept) a /godmode on/off command.
-- a /jam command that jams a certain player numbers gun. /unjam could also be used the same way. (by jam, i mean the reload bar stays in the same place and if is reloded, wont shoot.
-- a /jamwep command that jams a certain GUN of all players. lets say 2 people have m79s.
/jamwep 7 makes both of their guns jam. that way u can temp deactivate guns while people still hav them. /unjam could also be used the same way.
-- also, u could try to make commands a lil simpler ;)

Name: will change to CommandCrate or Free-Sol or something. just be glad I didn't stick with "God-minBox" :X (that was original name)
/tele: I will add a /pos command and a /tele 1/2/3 or something (/tele 1 save, /tele 1 load)
/spawnset: I think I will add this, and maybe make seperate arrays of spawn points for each player
/god: I will add this, but I will have a diff way then fistbox (OnPlayerDamage Result:=0) (hey toumaz, does result in onplayerdamage change damage done?)
/jam: I don't think this is possible, unless you use a forceweapon loop in apponidle
Title: Re: CommandBox
Post by: 1221995 on October 24, 2007, 03:21:57 pm
ok. ill think up somemore soon ;)
Title: Re: CommandBox
Post by: Diss on October 24, 2007, 05:10:56 pm
Soldat must hate me as it won't work :(
It says the script loaded but I tried them all and nothing happened :S
Title: Re: CommandBox
Post by: DorkeyDear on October 24, 2007, 05:15:21 pm
Soldat must hate me as it won't work :(
It says the script loaded but I tried them all and nothing happened :S
make sure ur admin ^^
Title: Re: CommandBox
Post by: Kavukamari on October 24, 2007, 05:26:34 pm
ToDoList:

  • wait for Toumaz to reply :P[/s]
  • Maybe more stuff
Title: Re: CommandBox
Post by: 1221995 on October 24, 2007, 08:35:56 pm
sounds good for now :)
Title: Re: CommandBox
Post by: Toumaz on October 25, 2007, 12:32:36 am
/god: I will add this, but I will have a diff way then fistbox (OnPlayerDamage Result:=0) (hey toumaz, does result in onplayerdamage change damage done?)
First off, that's how it's done in Fistbox as well; seeing as there's no other way to properly do it.
And yes, it does. You need to use a rather high negative value in order to make the player completely invulnerable against explosions (-9999 should be well sufficient).
Title: Re: CommandBox
Post by: Kavukamari on October 25, 2007, 12:47:06 pm
so you are letting me use /god mode? thanks! are you happy I'm changing the script name?

(I know why the health dissapears now, you use negative number :P)

how might I make my variables more efficiant? (and should I round /pos, I think I should)

(suggestion time :P)
for Fistbox, you should "install" a dummy bot! (copy an existing bot and set everything to 0 (except name, that should be "Dummy" and filename "Dummy")) and allow ppl to add maybe only 8 or so (2 on each team) (for testing weapon mod damage (for the people serious about it:P))
Title: Re: CommandBox
Post by: Diss on October 25, 2007, 02:13:07 pm
Soldat must hate me as it won't work :(
It says the script loaded but I tried them all and nothing happened :S
make sure ur admin ^^

I was admin, and to make sure I did a few commands that admins can do.
Title: Re: CommandBox
Post by: Kavukamari on October 25, 2007, 03:02:20 pm
did you use chat key to use commands? if so, don't, use / instead.

Date Posted: October 25, 2007, 03:59:40 pm
oh and did you include all of the parameters in your command? (/spawn 1 1 0 0 spawns deagles at player 1 (no offsets) and /create 1 0 0 0 0 100 4 1 makes m79 nade at player 1 (no velocity or offsets))
Title: Re: CommandBox
Post by: Quantifier on October 25, 2007, 03:41:21 pm
Loops whose only intention is to handle players are better off with the iteration variable as a byte, seeing as it's a bit more memory efficient

I wouldn't be so sure about it. You _could_ gain 3 bytes, but they most probably end up unused anyway, to keep memory aligned to full words.
Title: Re: CommandBox
Post by: Diss on October 26, 2007, 02:16:06 pm
If you reread what I posted, you will see that I said "I did a few commands that admins can do."
Which implies I used '/' and not the chat button.

Had no idea if that second part was too me, but yes I tried various combinations of the numbers and nothing work.
E.g- /spawn 1 1 0 0, /spawn1100, /spawn 1100
Nothing worked for me.
Title: Re: CommandBox
Post by: Kavukamari on October 26, 2007, 03:34:55 pm
hmmm... not sure wtf is wrong then...

I',m working on /help now, will do /pos later, and /tele tomorro maybe

Date Posted: October 26, 2007, 04:13:21 pm
Loops whose only intention is to handle players are better off with the iteration variable as a byte, seeing as it's a bit more memory efficient

I wouldn't be so sure about it. You _could_ gain 3 bytes, but they most probably end up unused anyway, to keep memory aligned to full words.
??? :/
Title: Re: CommandBox
Post by: Diss on October 28, 2007, 10:33:49 am
Ahhhh nvm, got it to work.
But I am having issues when you do /spawn and /create.
When I would put 1 for the player id, it will spawn where alot of medkits do, rather than their feet.
Title: Re: CommandBox
Post by: Kavukamari on October 29, 2007, 12:35:55 pm
I fixed that, will release next version soon. not fin'd yet because of fistbox Source code being released :):):) I ♥ (<3) fistbox

Date Posted: October 29, 2007, 01:30:43 pm
(right now it spawns at the coords you give :P)
Title: Re: CommandBox
Post by: Diss on October 30, 2007, 02:12:14 pm
Hurray :P
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Hunter91 on October 31, 2007, 08:46:16 am
When i say /force 1 5  7 0 then server kick me BE ;/ and when i say /active 1 5 true nothing is Power i must On All Gun for Active and unactive ? How i can use this 2 commands ?
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Toumaz on October 31, 2007, 08:49:04 am
When i say /force 1 5  7 0 then server kick me BE ;/ and when i say /active 1 5 true nothing is Power i must On All Gun for Active and unactive ? How i can use this 2 commands ?
It's not a BE kick, it's the built in anti-cheat system in the server. If you want to use certain weapons you need to disable it in soldat.ini.
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Hunter91 on October 31, 2007, 09:36:57 am
Say me where is this on the Soldat.ini files and this /active (num) , (gun) true i say and this is not work why ?? And Kills too. I must power Gun in Soldat.ini or something ? :(
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on October 31, 2007, 12:52:53 pm
/active num num true/false (second num is gun number, 0=socom 1=deagles 2=hk 3=ak 4=steyr 5=spas 6=ruger 7=m79 8=barret 9=minimi 10=minigun 11=knife 12=saw 13=law I think)

/active 2 1 false would disable Deagles for player 2

for force, you could make sure you is admin (not just joining 172.0.0.1 and trying commands) /adminlog *password*
then you cant be kicked >:)

Date Posted: October 31, 2007, 01:43:15 pm
oh and every parameter in each command is seperated by only one space (nothing confusing just "/command blah meep wutever")
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Hunter91 on October 31, 2007, 01:34:39 pm
Hm.. but in Soldat.ini change something ? Then : /active (1 - player num) ? (3 - gun ak) true or false ok , /force num gun gun ammo ok i later check this thx  :D
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Diss on October 31, 2007, 03:13:04 pm
Only thing you would need to change to make weapons active/disabled in soldat.ini is this:
Code: [Select]
Weapon_1=1
Weapon_2=1
Weapon_3=1
Weapon_4=1
Weapon_5=1
Weapon_6=1
Weapon_7=1
Weapon_8=1
Weapon_9=1
Weapon_10=1
Weapon_11=1
Weapon_12=1
Weapon_13=1
Weapon_14=1
*Set for 1 active, and 0 for disable.*
Kav posted the numbers of the weapons for these.

@Kav
If you join your server as 127.0.0.1, then you are already an admin that is logged in. There i no need for the /adminlog [password]
Also, rofl at "/command blah meep wutever
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Hunter91 on November 01, 2007, 05:03:18 am
But i have Climb Server i am admin and i want when enter on server can be use this commands /force and /active for my only. When enter player he don't see toggle of weapon and don't can take weapon. Only i hm.. but i don't now how make this. Sorry for my Englisch i learn it , im Polisch ;P
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on November 01, 2007, 12:42:38 pm
if it is climb server then you have to enable the weapon (/active # # true)

if you want to give weapon temporarily, do /force, then when person dies, they will lose weapon

(/force [primary] [secondary] [ammo])

but don't say you gave them weapon :P they will get annoying: "Give me weapon", "weapon please", "weapon gimme!!", "I wanna be admin", "give me weapon now" all from same person D:
then if you don't give them stuff or let them be admin, they'll try to use your name to use admin powers :(
then they'll give up (hopefully)
But they might not :(
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Hunter91 on November 01, 2007, 12:59:47 pm
I have two questions else :P. First if i want give somebody gun then obtain this but if i want give Flamer or Bow or Mode Flam guys get Ban. Next when i say command /spawn 3 - ak 1 - my num 0 and 0 then weapon appears on center of map but if i say /mega spawn 3 - ak 0 and 0 then all get weapon. Weapon is not on the middle only when i say /spawn for me :(  Sorry for Englisch ;P
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Diss on November 01, 2007, 02:31:38 pm
I have two questions else :P. First if i want give somebody gun then obtain this but if i want give Flamer or Bow or Mode Flam guys get Ban. Next when i say command /spawn 3 - ak 1 - my num 0 and 0 then weapon appears on center of map but if i say /mega spawn 3 - ak 0 and 0 then all get weapon. Weapon is not on the middle only when i say /spawn for me :( Sorry for Englisch ;P


On your 1st question...I had no idea what you said there.
On your 2nd question, Kav said it is fixed if I read correctly.
Title: Re: CommandCrate (Re named from CommandBox)
Post by: DorkeyDear on November 01, 2007, 02:47:52 pm
Hunter91: Englisch -> English*
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on November 01, 2007, 02:58:31 pm
I have two questions else :P. First if i want give somebody gun then obtain this but if i want give Flamer or Bow or Mode Flam guys get Ban. Next when i say command /spawn 3 - ak 1 - my num 0 and 0 then weapon appears on center of map but if i say /mega spawn 3 - ak 0 and 0 then all get weapon. Weapon is not on the middle only when i say /spawn for me :(  Sorry for Englisch ;P


ak would be /spawn *player* 3 0 0 not /spawn *player* ak 0 0 (you play too much fistbox :P )

that's why I posted the weapon numbers (and you can't spawn more than one weap for one person with one command, just repeat command for multiples)
Title: Re: CommandCrate (Re named from CommandBox)
Post by: corl45 on December 05, 2007, 06:39:47 pm
when i run this script on my server i get an error in the console:


invalid float
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on December 05, 2007, 07:03:12 pm
please post the full error
Title: Re: CommandCrate (Re named from CommandBox)
Post by: corl45 on December 05, 2007, 11:34:24 pm
that was full error, it says "Command box -> invalid float"
i fixed it, just took a little bit of editing (im not a noob, just havent been with soldat forums for very long)
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on December 06, 2007, 11:32:05 am
what did you have to change? maybe I have already fixed it in the version on my comp (I'm not sure if it is a diff. ver, but it works on my comp)
Title: Re: CommandCrate (Re named from CommandBox)
Post by: corl45 on December 06, 2007, 05:16:48 pm
well, i think it is just somthing I did, i was editing it before to see some functions and commands (im in the process of making a spawn script) and i think i added a variable to a function when i was editing it(just to mess around with functions and see what each part dose) cuz i had the zip file, and i un-ziped it again, and it work just fine.
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Kavukamari on December 06, 2007, 07:31:04 pm
do you think I should rewrite the script using the Case statement?
Title: Re: CommandCrate (Re named from CommandBox)
Post by: Iq Unlimited on December 06, 2007, 08:30:43 pm
do you think I should rewrite the script using the Case statement?

for conventions sake, yes, it looks better and its easier to fix.
Title: Re: CommandCrate (Re named from CommandBox)
Post by: corl45 on December 07, 2007, 07:52:09 am
do you think I should rewrite the script using the Case statement?
yes, that would probably help, looking at your script.. it will help alot with cleaning up