Jump to content

why my script not work


Viudes

Recommended Posts

Posted (edited)

Why my script not work?? 

function Ikkuna(resource)
Musiikki = playSound("Musiikki.mp3")
setSoundVolume(sound,1.0)
showCursor (true)
ikkuna = guiCreateWindow(0.34, 0.20, 0.20, 0.2,"Login",true)
Nimi = guiCreateEdit( 0.3, 0.3, 0.6, 0.09, "", true, ikkuna)
Salasana = guiCreateEdit( 0.3, 0.4, 0.6, 0.09, "", true, ikkuna)
Nimi = guiSetText( 0.3, 0.4, 0.6, 0.09, "name:", true, ikkuna)
loginbutton = guiCreateButton(0.2, 0.6, 0.3, 0.1, "Login", true,ikkuna)
registerbutton = guiCreateButton(0.5, 0.6, 0.3, 0.1, "Register", true, ikkuna)



end
addEventHandler("onClientResourceStart", getRootElement(),Ikkuna)
addEventHandler("OnClientQUIClick",loginbutton, Login)

function Login(button)
Toimii = guiCreateWindow(0.34, 0.20, 0.20, 0.2,"Toimii!",true)
end

function Register()
end
Quote

 

Edited by Dutchman101
removed odd tag
Posted (edited)
Quote
23 minutes ago, Tourettes said:

"Nimi" is used twice, you're trying to set the volume on "sound" instead of "Musiikki"... Etc?

I fix that. I try to make loginpanel but i don't know is that correct? And what i but serverside? This is fixed verison:


function Ikkuna(resource)
guiSetInputEnabled(false)
Musiikki = playSound("Musiikki.mp3")
setSoundVolume(Musiikki, 1.0)
showCursor (true)
ikkuna = guiCreateWindow(0.34, 0.20, 0.20, 0.2,"Login",true)
Nimi = guiCreateEdit( 0.3, 0.3, 0.6, 0.09,"", true, ikkuna)
Salasana = guiCreateEdit( 0.3, 0.4, 0.6, 0.09, "", true, ikkuna)
loginbutton = guiCreateButton(0.2, 0.6, 0.3, 0.1, "Login", true,ikkuna)
registerbutton = guiCreateButton(0.5, 0.6, 0.3, 0.1, "Register", true, ikkuna)
Nimi1 = guiCreateLabel(0.1, 0.1, 0.6, 0.09, "name:", true, ikkuna)
salasana1 = guiCreateLabel(0.3, 0.2, 0.6, 0.09, "Password:", true, ikkuna)
addEventHandler("onClientGUIClick",loginbutton,Login)
addEventHandler("onClientGUIClick",loginbutton,Register)
end


addEventHandler("onClientResourceStart", getRootElement(),Ikkuna)
--
--

function Login(button, username, password)
local username = guiGetText(Nimi)
local password = guiGetText(Salasana)

if username and password then
triggerServerEvent("Login", getRootElement(), username, password)
guiSetInputEnabled(false)
else 
outputChatBox("Enter a username and password")

end
	end

 

 

Edited by Viudes
Fix
Posted
12 minutes ago, f8upd8 said:

Any debug strings?

I think clientside script work fine but I don't know what i but serverside

Posted (edited)
47 minutes ago, Viudes said:

I think clientside script work fine but I don't know what i but serverside

GUI Functions is meant to be used clientside. You should read scripting guide properly.

And it will be nice if you start nesting your code by TAB (NOT BACKSPACES)

Edited by f8upd8

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