English usebutton for admin

6 replies
Goto Page
To the start Previous 1 Next To the start
03.07.21 11:30:00 am
Up
daris
User
Offline Off
Hello guys i want to create script to only admin can use button to open and close a door but it dosnt work please help me.

Code:
1
2
3
4
5
6
addhook("usebutton","adminbutton")
function adminbutton(id, x, y)
    if pl[id].lvl >= 10 then
    parse("trigger A1" ..id.. "67, 102 ")
    end
end
Ne gubi vreme
03.07.21 11:56:02 am
Up
Bowlinghead
User
Offline Off
Is that the whole script or is it the smallest potion of it?
Any error messages in console?
Which doors? All doors? Only some buttons? Who is admin? Why is admin? Does the door open on button press without any scripts?

Wrong usage of parse("trigger A1" ..id.. "67, 102 ")?
cs2d cmd trigger
cs2d cmd triggerposition

No return 1; so script will only work on maps which dont already have that button
cs2d lua hook use
cs2d lua hook usebutton
Share time limited free games here
03.07.21 12:09:27 pm
Up
daris
User
Offline Off
Hey i made adminhouse so i want to open doors with 4 buttons but i dont want everyone can open it, only admins.

67 102, 72 102, 67 104, 72 104
this is tiles of 4 buttons please help me

and there is 4 tiles of doors named A1
Ne gubi vreme
03.07.21 05:16:23 pm
Up
The Dark Shadow
User
Offline Off
@user daris: I don't think there is anyone who will write you scripts here, usually most of them only help you with the stuff and give you the main ideas, they don't write all the code for you.
03.07.21 06:06:21 pm
Up
daris
User
Offline Off
where i asked for whole script? i just asked for help beacuse i dont understand how to make this work!
Ne gubi vreme
03.07.21 06:41:44 pm
Up
Bowlinghead
User
Offline Off
Is it your map? Can you modify it? Make it, so the buttons dont do anything by the map itself, same for doors. The connection between buttons and doors will happen by the script
Share time limited free games here
03.07.21 07:57:59 pm
Up
daris
User
Offline Off
ye its my map, i do it already i just put name for doors to trigger them
Ne gubi vreme
To the start Previous 1 Next To the start