Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 253 54 55338 339 Next To the start

old Re: Lua Scripts/Questions/Help

dre187killz
User Off Offline

Quote
Edited:
1. I need a hook function
so when you kill a player you get 5 Health
and ur Max Health goes up 2

2. i have a problem with my kills.lua
if you kill 5 people without dieing it should say Unstopable but this script if you kill 3 or 4 people
it goes back to the start idunno it doesnt keep track properly


Spoiler >
edited 1×, last 13.09.09 03:02:33 pm

old Re: Lua Scripts/Questions/Help

New Rex
User Off Offline

Quote
dre187killz has written
is there a way to make it

so there is 5 rounds?

each round u start u get diffrent items?


Update Post:

1
2
Im not saying that you are selfish... 
There are to many people who wants to get script without working (and later use it as his own script), that I call selfish.

i am not looking to take credit for anything you shouldnt jugde me by the cover u should read the pages inside and ull see i am not like that

and its for Personal Use for now
cus i cant host and dont want 2 my net gets shut off at 12 am so i cant play online so i can play with bots at nighttime and ive tryd and tryd to make scripts i dont understand Lua and how things work


--- Off-Topic ---
If you are trying to reply to a person, don't use [ code ] [ code /], use [ quote = *name of user* ] [ / quote ].
Code is just to put stuff in it like Lua scripts or source codes-

_________

--- On-Topic --

old Radio Messages

dre187killz
User Off Offline

Quote
Radio messages:
Just wondering how do i edit
So When you Press "P" Ingame
i need to add 1 more radio msg to the list
and when i press it it says my ogg File
if some1 could help thx a bunch
edited 2×, last 13.09.09 05:05:55 pm

old Re: Lua Scripts/Questions/Help

New Rex
User Off Offline

Quote
I'll release my UFSS aka UFS (Ultimate Female Sounds Script), but I need a tester. Is anybody interested? PM me then.

It's because I've got some problems and...
edited 2×, last 14.09.09 11:00:13 pm

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
dre187killz has written
Edited:
1. I need a hook function
so when you kill a player you get 5 Health
and ur Max Health goes up 2

2. i have a problem with my kills.lua
if you kill 5 people without dieing it should say Unstopable but this script if you kill 3 or 4 people
it goes back to the start idunno it doesnt keep track properly


Spoiler >


For the first part, just take lilcoder's code and extrapolate (it should be a very straightforward change) You have to realize that you need to learn to script some of this stuff by yourself.

For the second part

1
2
3
4
if (os.clock()-sample.ut.timer[killer])>3 then 
		sample.ut.level[killer]=0; 
	
	end
If you haven't killed anyone within 3 seconds, your score resets

Also, there's absolutely nothing in there that checks to see if you have died.The script presumes that if you died then you can't kill again, this is only true for standard modes, replace the kill functions starting code with

1
2
3
4
5
6
7
8
9
if (os.clock()-sample.ut.timer[killer])>[b]Some number for the timeout[/b] then 
		sample.ut.level[killer]=0; 
	end 


	sample.ut.level[killer]=sample.ut.level[killer] + 1
	
	sample.ut.timer[killer]=os.clock() 
	sample.ut.level[victim] = 0

old Re: Lua Scripts/Questions/Help

dre187killz
User Off Offline

Quote
oo ty ur a elite scripter

so for
Quote
if (os.clock()-sample.ut.timer[killer])>Some number for the timeout then
sample.ut.level[killer]=0;
end


i just put how ever many seconds if he doesnt kill any1
it resets?

I playd LaG FuN and theres is good
its like u can kill how ever many and ur unstopable
but then when u die it resets not how ever many of seconds dunno they are good ;p

and lee could you help me i dont know how to
make a new radio msg

i already made the OGG file i just dont know how
to add it the List Ingame and make it MY ogg file play

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
1
2
3
4
if (os.clock()-sample.ut.timer[killer])>39999999 then 
          sample.ut.level[killer]=0; 
      
     end


Easiest thing is to set the time to a time which is impossible to get, 39999999 seconds shall be enough<.<

1
2
3
4
addhook("die","nomnom") 
function nomnom(v,k,w,x,y) 
sample.ut.level[v]=0 
end

reset the kills to 0 after you died.

old Re: Lua Scripts/Questions/Help

dre187killz
User Off Offline

Quote
oo ;/ well they are talented lol

do you know how to make the radio msg?
sry to keep buggin you just trying to learn lol


@Skipper
Easiest thing is to set the time to a time which is impossible to get, 39999999 seconds shall be enough<.<

the timer helps because if you die you still have ur kills
lets say you kill 8 people and unstopable
then you die and go back ur still unstopable you dont start again inless u w8 the seconds lol

old Re: Lua Scripts/Questions/Help

LilCoder
BANNED Off Offline

Quote
dre187killz has written
oo ;/ well they are talented lol

do you know how to make the radio msg?
sry to keep buggin you just trying to learn lol


It isn't possible to edit the current radio system with lua.
That's because the menu hook only works for own lua menu's. But you CAN make a menu yourself. And let a sound play when you click a button
Downside of this is that sounds can not be transferred using lua, you'll have to put the sounds into your map.
(or they must download the sounds)
Ill give a small example...
Press serveraction1 key ( which is F2 by default)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
	if(action ==1)then
		menu(id, "Radio Sounds!, Hit em up, Prepare for fight, Unstoppable")
	end
end

radioButtons = { {title = "Hit me up!", sound=" \"fun/hitemup.wav\""},{title = "Prepare for war!",sound= " \"fun/prepare.wav\""},{title = "Unstoppable!", sound =" \"fun/unstoppable.wav\""}}

addhook("menu","my_menu")
function my_menu(id, title, button)
	if(title == "Radio Sounds!")then
		if(button >0 and button <4)then
			for p in ipairs(player(0,"table"))do
				if(player(p,"team")==player(id,"team"))then
					parse("sv_sound2 "..p.." "..radioButtons[button].sound)
					msg2(p,player(id,"name").."(radio): "..radioButtons[button].title)
				end
			end
		end
	end
end

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
playa slaya has written
could someone explain or give me a link about what arrays are.


1
value = array(4)

It means without array:

1
value = {0,0,0,0}

and another way:
1
2
3
4
value[1] = 0
value[2] = 0
value[3] = 0
value[4] = 0
edited 1×, last 13.09.09 09:36:20 pm

old Re: Lua Scripts/Questions/Help

LilCoder
BANNED Off Offline

Quote
Well in LUA you have tables.

You can create a table like this:
1
t = {}
now t is an empty table.

You can also make an array-like table.
1
t = {4 , 7 , 9 , 18}  or   stringArray = {"hi", "my", "name", "is", "DC"}
The first one is a int array, the last one a string array.
You can access this array with stringArray[1], which represents "hi".
you can also type something like
1
stringArray[5] = "LilCoder"
,
and then the array becomes : {"hi", "my", "name", "is", "LilCoder"}


Now there is a true table, with a key and a value.
You can create one like this:
1
color = {red = "©255000000", blue = "©000000255", green = "©000255000"}
you can access it with color.red or with color["red"]

for example in a string like this:

1
msg(color.red.."Hello World!")
which will produce a red string.

Anyway, you can find more of this here:
http://lua-users.org/wiki/TablesTutorial


and dre187killz, press F2.. ( which I already said)

old Re: Lua Scripts/Questions/Help

syntaku
User Off Offline

Quote
ok i have a request(hope this is were to post it)
Well im making a bomberman server and i cant learn lua (so... complicated.... ) what i need is a script so that
•uses money as time

•unlimited grenades

•when you "throw" a grenade it stays at your feet and detonates after 3 seconds

> is it possible?

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
is this possible itried and it did not work(its only part of the script)
1
msg ("000255000(ADMIN)"225225000 "..player(id,"name").." Is Now Godlike!!!")

im trying to have admin in green

and the rest in yellow

old Re: Lua Scripts/Questions/Help

robdun
User Off Offline

Quote
I need help one last time. Almost done with my climb server.

I need a script, where it auto saves your data so when you return to the game server you will still have your items, money, etc. When the map changes you will still have the same money from the last map.
And another script where it shows a timer on the top of the screen
(map time limit) for timed games.



Thanks
-robdun
To the start Previous 1 253 54 55338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview