Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2128 129 130338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

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

alt Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Zitieren
Blazzingxx hat geschrieben
hyh2 hat geschrieben
null

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

Edit:
hyh2 hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

wups
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

MiroslavR
User Off Offline

Zitieren
Deatherr hat geschrieben
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.

alt m4a1/m203

NKN
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

hyh2
COMMUNITY BANNED Off Offline

Zitieren
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???

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

Noxic
User Off Offline

Zitieren
hyh2 hat geschrieben
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 hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
Spoiler >

alt Re: Lua Scripts/Questions/Help

4064305
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Zitieren
Vectar666 hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
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 hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Noxic
User Off Offline

Zitieren
@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.

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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.
2× editiert, zuletzt 02.01.10 22:15:01
Zum Anfang Vorherige 1 2128 129 130338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht