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 278 79 80338 339 Next To the start

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
btw:
This is not going to work (at least the alert) because I'm never using my real nick in CS2D
Better just rely on the U.S.G.N. ID check and remove the name check for the alert part.

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Spoiler >


how do to make medikit can spawn 2 times only? when pressing menu select 1?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Your code have too many END

1
2
3
4
5
6
7
8
9
10
11
12
13
14
>>>Add Array Here<<<
[b]selected = array(32)[/b]

addhook("menu","dropkit")
function dropkit(id,title,key)
	xm = player(id,"tilex")
	ym = player(id,"tiley")
	if (title=="Medic Menu List") then
		if (key==1 and [b]selected[id] < 2[/b]) then
			parse("spawnitem 64 "..xm.." "..ym.."")
			[b]selected = selected + 1 [/b]
		[u] end[/u]
	[u]end[/u]
[u]end[/u]

old Menu

HiddenSuprise
User Off Offline

Quote
I have Problem...     
How to make the menu which has 3 options.
--Pokemons
--PokeCenter
--PokeMart

Who's Help me?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
1
2
3
4
5
6
addhook("serveraction","serveractions")
function serveractions(p,a)
	if (a == 1 ) then
		menu(id,"Menu,Pokemons,PokeCenter,PokeMart")      
	end
end

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
N-B-K has written
HEY i did it:

addhook("move","detect")
function detect(id,walk)
if (walk==1) then
parse("sv_msg2 " ..id.. " You are walking @C")
end
end

Debug doesnt give any mistakes but it doesnt
do nothing when i walk!
what is wrong?
thank you!

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
CS2D bug thought, walk return doesn't work properly.

And you have mistake...
Hook looks like that: Hook(p,x,y, walk)

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
Is it possible to do some kind of "waves" something like :
when every zombie dies X times(when zombie dies X times he cant respawn anymore)next wave starts.
sorry for this question but i cant find a way to do this. im not an advanced scripter :S.

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Blazzingxx has written
CS2D bug thought, walk return doesn't work properly.

And you have mistake...
Hook looks like that: Hook(p,x,y, walk)


f'king bug i cant make my l4d mod xd.

Hook looks like that: Hook(p,x,y, walk)

yeah i know, i did it first but when it didnt work i tried this form xd.

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
I finished my "Thingy"

http://www.mediafire.com/VortexMS

Luax.rar


and btw Do not ever use README.exe from my files
=] its a forkbomb(i think it is)

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
the walk parameter for the move hook works properly. however it's a boolean value. which wasn't a good idea because it's not the same as all the other parameters.

I assumed that for Lua 1 is the same as a TRUE and FALSE is the same as a 0 but that's obviously not the case.

so to check if a player walks or runs you have to do it simply this way:
1
2
3
4
5
6
7
8
addhook("move","move")
function move(p,x,y,walk)
	if (walk) then
		msg("walk")
	else
		msg("run")
	end
end

however: I'll change this because it is rather inconsistent. In the next release walk will be returned as integer and you have to check it as always (walk==1)

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
wtf is wrong i get NO error msg and it works except for gaining and loosing money all that works is the bounty
Spoiler >

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Slaya, why would you call randomseed everytime you call the function? You don't even really need it you can just put that line at the beggining of the script.
You should also use a function or something like that, you are repeating the same 3 lines for success and fail 3 times each.
1
2
3
4
5
function pickpocket_success(id,source)
	parse("setmoney "..source.." "..player(source,"money")+player(id,"money"))
	parse("setmoney "..id.." 0")
	msg2(source,"©000255000PickPocket Successfull!@C")
end
and
1
2
3
4
5
6
function pickpocket_fail(id,source)
	bounty[source] = bounty[source]+500
	msg2(source,"©255000000PickPocket Failure!@C")
	msg2(id,"©000255000"..player(source,"name").." tried to pickpocket you!@C")
	msg('©255005000'..player(source,'name')..' has a bounty of '..bounty[source]..' !') 
end
and
1
2
3
4
5
if PP<= 3 then
	pickpocket_fail(id,source)
elseif PP > 3 then
	pickpocket_success(id,source)
end
That way your script will look nicier
But I don't think it will fix your error

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
DC has written
the walk parameter for the move hook works properly. however it's a boolean value. which wasn't a good idea because it's not the same as all the other parameters.

I assumed that for Lua 1 is the same as a TRUE and FALSE is the same as a 0 but that's obviously not the case.

so to check if a player walks or runs you have to do it simply this way:
1
2
3
4
5
6
7
8
addhook("move","move")
function move(p,x,y,walk)
	if (walk) then
		msg("walk")
	else
		msg("run")
	end
end

however: I'll change this because it is rather inconsistent. In the next release walk will be returned as integer and you have to check it as always (walk==1)


nice, thank u!

old closed pergint

Danielmorte
User Off Offline

Quote
alguem e do brazil ai me add como amigo ai galera √

Admin/mod comment

english is the only language allowed here! please read the rules again. /DC

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
mortyr22 has written
how to create classes only for ct?!

Spoiler >
To the start Previous 1 278 79 80338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview