Forum

> > CS2D > Scripts > Trigger Use.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Trigger Use.

14 replies
To the start Previous 1 Next To the start

old Trigger Use.

Egoist
User Off Offline

Quote
I want to make a prison map and , cts will have weapons when
press "E" near trigger use I looked other comments but I didnt understand.

I want to make this:

example:

Press"e" then
equip id deagle(weapon id = 3)

Sorry for bad english

Thanks for helps.

old Re: Trigger Use.

Egoist
User Off Offline

Quote
I dont mean this I know how to do it.
I wanna do this
I saw this at a server.
When you use the button
It gives direct weapon.
It gives to you not to floor.
I want it I know how to it with an entity.

old Re: Trigger Use.

Homam
User Off Offline

Quote
Tell me the TileX and TileY and the weapon id, and i will try to make it.

Note: Give me the TileX, TileY on this pattern,

IMG:https://i54.tinypic.com/260wk07.jpg


Not Like This!

IMG:https://i56.tinypic.com/2ivz2vs.jpg
edited 1×, last 30.04.11 05:50:24 pm

old Re: Trigger Use.

Egoist
User Off Offline

Quote
HoMaM gived me code but
when I press deagle's button
then usp's button
I have all 2 weapons usp and deagle
I want this:
example:I got deagle then I press usp's button
deagle will be dropped on the floor
usp will be equiped
who can do this ???



This is my code:

addhook("use","gunbuy2")
function gunbuy2(id,event,data,x,y)
if (x == 11 and y == 88) then
parse("equip "..id.." 3")
end
end

old Re: Trigger Use.

3RROR
User Off Offline

Quote
user Egoist has written
HoMaM gived me code but
when I press deagle's button
then usp's button
I have all 2 weapons usp and deagle
I want this:
example:I got deagle then I press usp's button
deagle will be dropped on the floor
usp will be equiped
who can do this ???



This is my code:

addhook("use","gunbuy2")
function gunbuy2(id,event,data,x,y)
if (x == 11 and y == 88) then
parse("equip "..id.." 3")
end
end


Didn't tested.
1
2
3
4
5
6
addhook("use","gunZ")
function gunZ()
if trigger == usetrigger1 then
    parse(spawnitem 1 11 88)
end
end

old Re: Trigger Use.

Homam
User Off Offline

Quote
@RedFrix, Dude, the script works, read her/his comment again...

@TheFire1

TheFire1 has written
This is my code:


Yours? I give it to you..

old Re: Trigger Use.

3RROR
User Off Offline

Quote
user Homam has written
@RedFrix, Dude, the script works, read her/his comment again...

@TheFire1

TheFire1 has written
This is my code:


Yours? I give it to you..

user Egoist has written
deagle will be dropped on the floor

Btw. The id1 is USP. Change it to Deagle.

old Re: Trigger Use.

Dovahkin
User Off Offline

Quote
What you mean event in that usebutton?

just try this!

1
2
3
4
5
6
7
addhook("say","lol")
function lol(id,txt)
	if(txt=="!equip") then
		parse("equip "..id.." 1")
		parse("spawnitem 1 11 88")
	end
end

i think it will work?

old Re: Trigger Use.

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function contains(table, element)
    for _, value in pairs(table) do
        if value == element then
            return true
        end
    end
    return false
end

addhook("usebutton","megabutton")
function megabutton(id,x,y)
	if (x==BUTTONTILEX and y==BUTTONTILEY) then
		for i=1,6 do
			if (contains(playerweapons(id),i)) then
				parse("strip "..id.." "..i)
				parse("spawnitem "..i.." "..player(id,"tilex").." "..player(id,"tiley"))
				parse("equip "..id.." 4")
			end
		end
	end
end
I think this is what you meant.

no read, go post

old Re: Trigger Use.

Egoist
User Off Offline

Quote
I must write HoMaM'S ??


HoMaM has written
read his/her...

Quote
wtf her x.x



Engineer has written
function contains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end

addhook("usebutton","megabutton")
function megabutton(id,x,y)
if (x==BUTTONTILEX and y==BUTTONTILEY) then
for i=1,6 do
if (contains(playerweapons(id),i)) then
parse("strip "..id.." "..i)
parse("spawnitem "..i.." "..player(id,"tilex").." "..player(id,"tiley"))
parse("equip "..id.." 4")
end
end
end
end


Quote
Didnt work :(( You know my problem but I am pressing buttons but dont gives weps.
edited 1×, last 02.05.11 01:42:09 pm

old Re: Trigger Use.

Homam
User Off Offline

Quote
TheFire1 has written
Didnt work :(( You know my problem but I am pressing buttons but dont gives weps.


Did you even changed the "BUTTONX" and "BUTTONY" ?
If you did, then idk what to do.

old Re: Trigger Use.

Egoist
User Off Offline

Quote
you mean this :"if (x==BUTTONTILEX and y==BUTTONTILEY) then" I changed it didnot work


-----------------


Hey guys I want to make this code like this:

A player got a M4A1 from the button,
then he press to aug's button then lua will not give him aug.
He must drop m4a1 for get aug.

I dont know I could explain my problem to you.

Sorry for bad english
I only learn it from school
And from films
edited 1×, last 07.05.11 04:43:21 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview