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 2335 336 337 338 339 Next To the start

old Re: Lua Scripts/Questions/Help

ULtiMa
User Off Offline

Quote
Guys i have a problem....with lua
Can someone help me??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
addhook("join","exerciseJoin")
function exerciseJoin(id)
  msg("Player"..player(id,"name").."joined the server!")
end

addhook("ms100","ms_hud")
function ms_hud()
for id = 1,32 do
if (player(id,"exists")) then
parse('hudtxt2 '..id..' 44 "©000255000A simple script made by firez " 220 13')
		end
	end
end

addhook("serveraction","instamenu")
function instamenu(id,imenu)
     if imenu == 1 then
          menu(id,"Weapons,Grenader,Rocketeer,Miner,Shotguner,General")
     	end
end
addhook("menu","instaequipall")
function instaequipall(id,menuall,select)
if menu == "Weapons" then
    if select == 1 then
         menuall(id,"Grenader,Snowball,HE,Flashbang,Smoke,Gas Grenade,Molotov,Air Strike,Gut Bomb")
    	end
end

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Adriene in your last hook you didnt write what is menu. I think it should be something like
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
addhook("join","exerciseJoin")
function exerciseJoin(id)
msg("Player"..player(id,"name").."joined the server!")
end

addhook("ms100","ms_hud")
function ms_hud()
for id = 1,32 do
if (player(id,"exists")) then
parse('hudtxt2 '..id..' 44 "©000255000A simple script made by firez " 220 13')
          end
     end
end

addhook("serveraction","instamenu")
function instamenu(id,imenu)
if imenu == 1 then
menu(id,"Weapons,Grenader,Rocketeer,Miner,Shotguner,General")
     end
end
addhook("menu","instaequipall")
function instaequipall(id,title,select)
if title == "Weapons" then
if select == 1 then
menu(id,"Grenader,Snowball,HE,Flashbang,Smoke,Gas Grenade,Molotov,Air Strike,Gut Bomb")
     end
end

------------------------------------------------------
Now my part :
can anybody write simple spawn object parameters ?
I mean like if server action (done) a building will appear (player TILEX +1 ,TILE Y+2)(another and so on...)
thanks

EDIT : Never Mind, found out...

old Re: Lua Scripts/Questions/Help

DannyDeth
User Off Offline

Quote
AdrienneTheGreat213 has written
Guys i have a problem....with lua
Can someone help me??

Spoiler >

( Added Spoiler to make it smaller... )

Could u please explain what is actually happening? You have a problem but what is it?

old DaKnOb

sixpack
User Off Offline

Quote
Here's one for you:
Is there any way to bind buttons using LUA so if the player presses a button (lets say F12) it executes a function?
This is not about:
•F2
•F3
•F4
•E

old Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Quote
No, you can't check whether F12 is executed, except if it's a default character that is used for something else, so you could set your lets say drop as F12 and then use the drop hook to record it, but besides that you can't(to my knowledge).

old Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Quote
This mainly happens because someone may have Walk Forward on F12(example) and it will walk and buy things from shop at them same time!

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
DaKnOb has written
This mainly happens because someone may have Walk Forward on F12(example) and it will walk and buy things from shop at them same time!


The reason why you cant hook to keys (only to 'events') is that you can do crazy shit with players. For example, you can hook to Esc and "return 1" (do nothing) so he will never open main menu.

old Re: Lua Scripts/Questions/Help

brk951753
User Off Offline

Quote
addhook("collect","no_wrench_pickup")
function no_wrench_pickup(iid)
if(iid==74) then
return 1
else
return 0
end
end


Whats Wrong??

old Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Quote
try this
1
2
3
4
5
6
addhook("collect","no_wrench_pickup")
function no_wrench_pickup(iid)
if(iid==74) then
return 1
end
end

old Re: Lua Scripts/Questions/Help

brk951753
User Off Offline

Quote
FN_Nemesis has written
try this
1
2
3
4
5
6
addhook("collect","no_wrench_pickup")
function no_wrench_pickup(iid)
if(iid==74) then
return 1
end
end


its doesnt work...

old :O

weed_muffin
User Off Offline

Quote
ohey guys

i have a RP server and it needs multiple things.

1st: i need help with arresting people. like, if you hit someone with a claw, it spawns them to jail? it'd be cool to have a f3 menu with instaequip, actions whitch includes teleport and set arrest point

2nd: i need admin gun mods, like sg552 giving you a shop license, claw arresting and so on.
please help me out?

old Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Quote
You used your parameters wrong @brk
Lua allows to name your own local variables but you still have to get their places right.
1
2
3
4
5
6
7
8
9
addhook("collect","pickupevent")
function pickupevent(id, iid, type, ain, a, mode)
	if (iid == 74) then
		return 1
	else
		return 0
	end
return 0
end
That should probably work.
To the start Previous 1 2335 336 337 338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview