Jump to content

Help Making a Teleport and GUI


LimEDuuD

Recommended Posts

Okay so I'm trying to make a base for my gang on an RP server and I want a script that teleports you from the base in the outside world to the interior. There should be a marker infront of the door and if you walk into it, you need to enter a password via GUI. The password can be whatever.

So I got learning how to make this and I started on it but nothing works xD help me

What I've made already:

http://rapidshare.com/files/398928926/B ... g_base.zip

The file includes mapedit

The Coordinates should be:

outside entrance = 1923, -1411, 14 (the marker you walk into to open the GUI that asks for the password)

outside exit = 1917, -1415, 14 (where you come out when you walk into interior exit)

interior entrance = 565.637, -124.3715133667, 964.71618652344 (int world 11 + after you put in the password you teleport here)

interior exit = 532.12658691406, -85.317939758301, 964.66149902344 (int world 11 + there should be a marker)

Just tell me what's wrong and I'll (try) to fix it myself.

I'll post the code in here just in case:

--LimEDuuD's gang base teleports settings and blips
addEventHandler("onPlayerConnect", getRootElement(), bmxersetup)
function bmxersetup()
bmxent = createMarker ( 1923, -1411, 14, "corona", 1, 255, 0, 0, 255 ) then
bmxerblip createBlip ( 1923, -1411, 14, [int icon=19, int size=2, int r=255, int g=0, int b=0, int a=255, int ordering=0, float visibleDistance=2000.0, visibleTo = getRootElement()])
end
function baseentry(bmxent, matchingDimension true)
if getElementType(bmxent) == "player" then
outputChatBox( "Vehicles can't enter the gang base!", getRootElement(), 255, 255, 0 )
elseif getElementType(bmxent) == "vehicle" then
outputChatBox( "Vehicles can't enter the gang base!", getRootElement(), 255, 255, 0 )
end
end
addEventHandler( "onMarkerHit", bmxent, baseentry )
end

and the GUI:

--stupid GUI for gang Base by LimEDuuD
function createbmxerWindow()
local X = 0.375
local Y = 0.375
local Width = 0.25
local Height = 0.25
basicpw = guiCreateWindow(X, 0.5, Width, Height, "Please Enter The Password", true)
guiCreateLabel(0.415, 0.2, 0.5, 0.15, "Password", true, basicpw)
edtPass = guiCreateEdit(X, 0.5, Width, Height, "", true, basicpw)
guiEditSetMaxLength(edtPass, 50)
btnLogin = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Enter", true, basicpw)
showCursor(true)
guiSetInputEnabled(true)
addEventHandler("onClientGUIClick", Enter, teleportPlayerbmx, false)
function teleportPlayerbmx(button,state)
if button == "left" and state == "up" then
if source == Enter then
setElementPosition ( source, 565.637, -124.3715133667, 964.71618652344 [,warp = true ] ), getRootElement() then
setCameraTarget(client,client) then
outputChatBox("You climb down long flights of stairs...") then
outputChatBox("Welcome to base, gang member!")
-- How can I make it so that you have to enter a specific password only?
end

Link to comment

Look at debug window (when logged in as admin type in: "/debugscript 3" in chatbox or without "/" in console).

You will see errors that will tell you what is wrong with your code. You can also use MTA:Script Editor which will check your syntax for errors so you don't have to look at debug window in game. You have too many errors for me to list them here because I don't have much time at the moment.

Learn to debug your scripts.

Link to comment

Okay thanks 50p, the script editor is really great.

But when I type/debugscript 3 in my own test server, it says ACL: Acess denied for debugscript. I don't know why my access is denied because I added myself to the admins group in acl.xml

Now that I'm using the script editor I can see errors in the syntax, etc.

I've probably read all the guides on the wiki a thousand times, thanks very much varez.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...