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 2128 129 130338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
1
2
3
4
5
6
7
if cod4==nil then cod4={} end --If you havent made a table

addhook("team","cod4.title")
function cod4.title(id)
	parse('hudtxt2 '..id..' 7 "©000255000Call Of Duty Modern Warfare 2D Mod" 247 13')
	parse('hudtxt2 '..id..' 9 "©160160255'..game("sv_name")..'" 260 26')
end

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
damn you are good i spend yesterday all of it with try to fix you are not Blazzingxx you are Super Hero man

old Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Quote
Blazzingxx has written
hyh2 has written
null

Spam...
By the way, probably it's called Nil on Lua

Edit:
hyh2 has written
If i press button in map, then come menu where is 6 buttons and if i press button 1 then i get cap (sprites) and so on..

Yes? So?


CAN U MAKE

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
I saw this in the news.

"[ADDED] Optional player param. for Lua images (only one player can see img) "

But where in the info file is that parameter?

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
I have this lua i need for my town server ([DS] Town) Its a taser so people (police) can taser people. It doesn't work but i believe that I did something wrong.Mind fixing it?
Five-Seven would be the taser.

1
2
3
4
5
6
7
addhook("hit","Taser") 
function Taser(id,source,weapon,speed) 
if(weapon == 6) then 
parse ("speedmod "..id.." "..player(id,"speed")-10) 
return 1 
end 
end

old Re: Lua Scripts/Questions/Help

MiroslavR
User Off Offline

Quote
Deatherr has written
I have this lua i need for my town server ([DS] Town) Its a taser so people (police) can taser people. It doesn't work but i believe that I did something wrong.Mind fixing it?
Five-Seven would be the taser.

1
2
3
4
5
6
7
addhook("hit","Taser") 
function Taser(id,source,weapon,speed) 
if(weapon == 6) then 
parse ("speedmod "..id.." "..player(id,"speed")-10) 
return 1 
end 
end

I would recommend reading info.txt (again). There is written that only player(id, "speedmod") returns what you are looking for.

old m4a1/m203

NKN
User Off Offline

Quote
Someone could make a script that when you buy m4a1 comes whit 5 he, so that would look like an M41A/M203

old Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Quote
If i press button in map, then come menu where is 6 buttons and if i press button 1 then i get cap (sprites) and so on..
CAN ANYONE MAKE???

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
What's wrong with this script?
1
2
3
4
5
6
7
8
function op4_hit(id,source,weapon)
	if (weapon==34) then
		if (xbow_zoom[source]==0) then
			parse("explosion "..player(id,"x").." "..player(id,"y").." 64 35 "..source)
			return 0
		end
	end
end
There IS a hook, it IS working, but if explosion kills player, player respawns without any effects at the same place with no weapons and 0 hp! Or not respawns, he just drops weapon, but NOT die.

old Re: Lua Scripts/Questions/Help

Noxic
User Off Offline

Quote
hyh2 has written
If i press button in map, then come menu where is 6 buttons and if i press button 1 then i get cap (sprites) and so on..
CAN ANYONE MAKE???


We don't make scripts for you the same way teachers don't solve your assignments for you.

Vectar666 has written
What's wrong with this script?
...


Can you show the whole code in a spoiler tag, including the hook? Any errors in the console?
It could just be glitches because of a disorganized or large script (a few weird things have happened to me - Then again, I'm running it in Linux), but I doubt.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
Spoiler >

old Re: Lua Scripts/Questions/Help

4064305
User Off Offline

Quote
Hey all!
I'm pretty experienced with programming languages, i know some Java GML php and basic, so I'm struggling to find a good tutorial which doesn't endlessly explain what a 'variable' is. So can some tell me if this idea is possible and what functions to look at, maybe even help me out if you find it a good idea:

Personally, i hate campers. That is why I want to make a script that detects campers and punishes them. For instance check if they've been on their own site for a minute, or if they stick in the same square with an awp. Is this thing possible?

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Vectar666 has written
I don't know about weapon, but there is a command setarmor, if you want to equip half-charged kevlar

Woops I completely forgot about that,I can use it in lua script.
Thanks.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
It isn't too weak, but if i kill smb, he just drops items and in death notice he is dead, but he is alive, grabs his items again and there we go until he is dead if there would no explosion.
status HP(with explosion) HP w/o explosion
alive 100 100
alive 55 90
alive 10 80
STILL alive 0 80 but there IS explosion, player drops items, w/o any item, he picks up smth and tryes again.
Death notice has written
Me Explosion Player

STILL alive 0 70
STILL alive 0 60
STILL alive 0 50
STILL alive 0 40
STILL alive 0 30
STILL alive 0 20
STILL alive 0 10
DEAD 0 0

old Re: Lua Scripts/Questions/Help

Noxic
User Off Offline

Quote
@KiWi
While the Lua manual can be very useful for learning its syntax and built-in functions, I think what you're looking for is in <cs2d dir>/sys/lua/info.txt. For console commands, you can also go to http://www.cs2d.com/help.php?cat=all

@Vectar666
That's a really weird glitch you got there. Perhaps make an explosion, but kill him through other means? You shouldn't have to do it, but it looks like you've run into something really weird...
Check the damage the player achieved from the explosion. If it's larger than his health, kill him with parse("killplayer "..id). You might also wanna test what happens to people in his vicinity.

I would also suggest using single quotes in your code for the weapon reload sounds; Then you won't have to make backslash-doublequotes. It's less confusing that way.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Wait, did u try returning 1 instead of 0 like this?
1
2
3
4
5
6
7
8
9
addhook("hit","op4_hit")
function op4_hit(id,source,weapon)
	if weapon == 4 then
		if (xbow_zoom[source]==0) then
			parse("explosion "..player(id,"x").." "..player(id,"y").." 64 35 "..source)
			return 1
		end
	end
end

It should work because I remember doing this some time before.
edited 2×, last 02.01.10 10:15:01 pm
To the start Previous 1 2128 129 130338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview