Shows u how to use eventscripts to open a door in hammer.
[u][b]Introduction[/b][/u]
Ok Well you are probably scratching your wondering what this tutorial is all about. Well it is quite simple. We are going to use a combination of Hammer editor and Mattie's EventScripts to trigger events in the map. For those of you who do not know what EventScripts is, I suggest you read through it and learn the basics before attempting this tutorial, as I am going to assume you have some basic knowledge when I explain the steps. All the information about EventScripts can be found here: [url]http://www.eventscripts.com/pages/Main_Page[/url] Ok, our goal for today is to create an admin only door. The door will open when the user says a command.
[u][b]STEP ONE: Entities Needed[/b][/u]
Ok what you will need to do is create a door in your map, untick all the flags except for toggle and name the door [b]Adminonlydoor[/b].
We are also going to need a [b]logicauto[/b] entity, and a [b]pointservercommand[/b] entity.
[b][u]STEP TWO: Configuring the script[/b][/u]
Ok we will need to get the basic script done before we do continue in hammer. First thing is first, open up a notepad document and add the following:
[code] block load { // Add as many as you want. People with these SteamIds will be able to access the door. esxsetinfo adminonlydoorcheck "STEAM:X:X:XXXXXX ; STEAM:X:X:XXXXXX" esxmsg Admindoor Loaded }
event playersay { if (eventvar(text) == "!open") do { if (eventvar(essteamid) in servervar(adminonlydoorcheck) do { esfire eventvar(userid) Adminonlydoor open estell eventvar(userid) #multi #greenThe door #lightgreenopens! } else do { estell eventvar(userid) #multi #greenYou lack the permission to use this command! } } if (eventvar(text) == "!close") do { if (eventvar(essteamid) in servervar(adminonlydoorcheck) do { esfire eventvar(userid) Adminonlydoor close estell eventvar(userid) #multi #greenThe door #lightgreenopens! } else do { estell event_var(userid) #multi #greenYou lack the permission to use this command! } } } [/code]
Ok now in this code you will be able to see there is a space that needs configuring. Just change the Steam ID's in there to the ones desired.
What is going to happen, is when the command !open is typed by a verified steam id, it will open the door, and same for !close.
Save the above script under the name: [b]esadmindoor[/b] then save it into a folder called [b]admin_door[/b]
[b][u]STEP THREE: piecing it all together[/b][/u]
Create the [b]point_servercommand[/b] anywhere in your map and name it "Command".
Now, we will get back into hammer, and create the entity [b]logicauto[/b]. In this entity, we want to add the specified output: [b] OnMapSpawn Command Command esload admin_door 0.00 [/b] This tells the game to load the script on map spawn, so the server host does not need to manually put it in the cfg files etc.
[b][u]Summary[/b][/u] Ok we have basically created a script giving authorization to a handful of players to open a special door. This is useful on maps like surf, zombie etc, but can be transformed into anything, like triggers etc. All the trigger work is done in the script, but the results show in the map.
Anyway, I hope this helped, and if it did, leave some feed back and approve it :)
Thanks guys, happy mapping/scripting.





