Jump to content

gui login box not working??


Luke_Ferrara

Recommended Posts

i wrote this in 5 minutes and after login is clicked the player is suspended in air and doesn't come back to the ground? but the lable (like when you go into different areas says internation airport, perish square ect.) changes without moving heres the script:

Server Side

function joinHandler(Username, Password)

local x,y,z

x = 1643.4725

y = -2238.2766

z = 13.4952

if (client) then

spawnPlayer(client, x, y, z)

fadeCamera(client, true)

outputChatBox("Scripted By The GTRP Scripting Team", client)

outputChatBox("Animation List (/animlist)", client)

outputChatBox("Rules And Help Press F1)", client)

end

end

addEvent("SubmitLogin", true)

addEventHandler("SubmitLogin", getRootElement(), joinHandler)

Client Side

function CreateLoginWindow()

local X = 252

local Y = 230

local Width = 538

local Height = 368

wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", false)

X = 0.277

Y = 0.3071

Width = 0.0725

Height = 0.0489

Name_Tag = guiCreateLabel(X, Y, Width, Height, "Name:", true, wdwLogin)

guiLabelSetColor(Name_Tag,255,255,255)

guiLabelSetVerticalAlign(Name_Tag,"top")

guiLabelSetHorizontalAlign(Name_Tag,"left",false)

X = 0.2416

Y = 0.413

Width = 0.1022

Password_Tag = guiCreateLabel(X, Y, Width, Height, "Password:", true, wdwLogin)

guiLabelSetColor(Name_Tag,255,255,255)

guiLabelSetVerticalAlign(Password_Tag,"top")

guiLabelSetHorizontalAlign(Password_Tag,"left",false)

X = 0.3587

Y = 0.4076

Width = 0.2751

Height = 0.0571

Password_input = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)

Y = 0.3043

Name_input = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)

guiEditSetMaxLength(Name_input, 16)

guiEditSetMaxLength(Password_input, 16)

guiEditSetMasked(Password_input,true)

X = 0.0725

Y = 0.8098

Width = 0.2621

Height = 0.1658

btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)

guiSetFont(btnLogin,"sa-header")

guiSetVisible(wdwLogin, false)

addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)

X = 0.6004

Y = 0.8098

Width = 0.3253

Height = 0.1658

btnRegister = guiCreateButton(X, Y, Width, Height, "Register", true, wdwLogin)

guiSetFont(btnRegister,"sa-header")

guiSetVisible(wdwLogin, false)

end

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),

function ()

CreateLoginWindow()

outputChatBox("Welcome to Grand Theft RolePlay, Please Log In. ")

if (wdwLogin ~= nil) then

guiSetVisible(wdwLogin, true)

end

showCursor(true)

guiSetInputEnabled(true)

end

)

function clientSubmitLogin(button)

if button == "left" then

triggerServerEvent("SubmitLogin", getRootElement(), guiGetText(Name_input), guiGetText(Password_input))

guiSetInputEnabled(false)

guiSetVisible(wdwLogin, false)

showCursor(false)

end

end

it should work it calls the window on start up and when the lgnbtn is clicked it calls the joinhandler which spawns the character which it does not....

Link to comment
Change the spawning code to what i've put below.

if (client) then
spawnPlayer(client, x, y, z)
fadeCamera(client, true)
setCameraTarget ( source, source )

The "setCameraTarget ( source, source )" should fix it.

nope still the same i don't think its the camera im not 100% though cause you don't even see your character.

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...