Jump to content

[HELP] When you are begginer.


Unkovic

Recommended Posts

That it! When you create 2 cmds, and you think you are best.

heh.

Where im wrong, this guis dont show

 

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHan()
	fadeCamera(source, true)
    showCursor(source, true)
    triggerClientEvent("pJoin", source )
end

addEventHandler("onPlayerJoin", getRootElement(), joinHan)

function trig()
	triggerClientEvent("pCreate", root)
end

addEventHandler("onResourceStart", getRootElement(), trig)

this is server script

 

GUIEditor = {
    label = {}
}

function create()
    login = guiCreateWindow(0.34, 0.23, 0.40, 0.30, "Unesite vasu lozinku da biste nastavili", true)
    guiWindowSetSizable(login, false)

    pw1 = guiCreateEdit(111, 136, 176, 17, "", false, login)
    guiSetProperty(pw1, "MaskText", "True")
    guiEditSetMasked(pw1, true)
    pw = guiCreateButton(108, 195, 43, 15, "Nastavi", false, login)
    pw2 = guiCreateButton(244, 195, 43, 15, "Izlaz", false, login)

    GUIEditor.label[1] = guiCreateLabel(412, 245, 318, 39, "Unesite vasu lozinku da biste nastavili registraciju", false)
    guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true)    	
end
)

addEvent("pCreate", true)
addEventHandler("pCreate", create) 


addEvent("pJoin", true)
addEventHandler("pJoin", root, function()
    guiSetVisible(login, true)
    guiSetVisible(pw1, true)
    guiSetVisible(pw2, true)
    guiSetVisible(pw, true)
    guiSetVisible(GUIEditor.label[1], true)
    otputConsole("Pjoin pozvan")
end
)

function ClickLeftBut(button, state)
    if(button == "left" and state == "up") then
        if(guiGetText(pw1) == nil or guiGetText(pw1) == '') then outputChatBox("Niste uneli pw", 231, 217, 176, false)
        else
            spawnPlayer(spawnX, spawnY, spawnZ)
            
            setCameraTarget(getLocalPlayer())
            outputChatBox("Welcome to My Server", getLocalPlayer())
        end
    end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

function ClickRightBut(button, state)
    if(button == "left" and state == "up")
    then 
        guiSetVisible(login, false)
        guiSetVisible(pw1, false)
        guiSetVisible(pw2, false)
        guiSetVisible(pw, false)
        guiSetVisible(GUIEditor.label[1], false)
        kickPlayer(getRootElement(), "Iskljucili ste registraciju")
    end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

and this is client!

 

So, im new, please. I lost my youth on stupid pawn.

Edited by Unkovic
Link to comment
GUIEditor = {
    label = {}
}

function create()
    login = guiCreateWindow(0.34, 0.23, 0.40, 0.30, "Unesite vasu lozinku da biste nastavili", true)
    guiWindowSetSizable(login, false)

    pw1 = guiCreateEdit(111, 136, 176, 17, "", false, login)
    guiSetProperty(pw1, "MaskText", "True")
    guiEditSetMasked(pw1, true)
    pw = guiCreateButton(108, 195, 43, 15, "Nastavi", false, login)
    pw2 = guiCreateButton(244, 195, 43, 15, "Izlaz", false, login)

    GUIEditor.label[1] = guiCreateLabel(412, 245, 318, 39, "Unesite vasu lozinku da biste nastavili registraciju", false)
    guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true)    	
end
)

addEvent("pCreate", true)
addEventHandler("pCreate", create) 


addEvent("pJoin", true)
addEventHandler("pJoin", root, function()
   
    create() 
    guiSetVisible(login, true)
    guiSetVisible(pw1, true)
    guiSetVisible(pw2, true)
    guiSetVisible(pw, true)
    guiSetVisible(GUIEditor.label[1], true)
    otputConsole("Pjoin pozvan")
end
)

function ClickLeftBut(button, state)
    if(button == "left" and state == "up") then
        if(guiGetText(pw1) == nil or guiGetText(pw1) == '') then outputChatBox("Niste uneli pw", 231, 217, 176, false)
        else
            setCameraTarget(getLocalPlayer())
            outputChatBox("Welcome to My Server", getLocalPlayer())
        end
    end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

function ClickRightBut(button, state)
    if(button == "left" and state == "up")
    then 
        guiSetVisible(login, false)
        guiSetVisible(pw1, false)
        guiSetVisible(pw2, false)
        guiSetVisible(pw, false)
        guiSetVisible(GUIEditor.label[1], false)
      end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

Try this  kickPlayer and spawnPlayer is server side not client 

Edited by Dimos7
Link to comment
13 minutes ago, Dimos7 said:

GUIEditor = {
    label = {}
}

function create()
    login = guiCreateWindow(0.34, 0.23, 0.40, 0.30, "Unesite vasu lozinku da biste nastavili", true)
    guiWindowSetSizable(login, false)

    pw1 = guiCreateEdit(111, 136, 176, 17, "", false, login)
    guiSetProperty(pw1, "MaskText", "True")
    guiEditSetMasked(pw1, true)
    pw = guiCreateButton(108, 195, 43, 15, "Nastavi", false, login)
    pw2 = guiCreateButton(244, 195, 43, 15, "Izlaz", false, login)

    GUIEditor.label[1] = guiCreateLabel(412, 245, 318, 39, "Unesite vasu lozinku da biste nastavili registraciju", false)
    guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true)    	
end
)

addEvent("pCreate", true)
addEventHandler("pCreate", create) 


addEvent("pJoin", true)
addEventHandler("pJoin", root, function()
   
    create() 
    guiSetVisible(login, true)
    guiSetVisible(pw1, true)
    guiSetVisible(pw2, true)
    guiSetVisible(pw, true)
    guiSetVisible(GUIEditor.label[1], true)
    otputConsole("Pjoin pozvan")
end
)

function ClickLeftBut(button, state)
    if(button == "left" and state == "up") then
        if(guiGetText(pw1) == nil or guiGetText(pw1) == '') then outputChatBox("Niste uneli pw", 231, 217, 176, false)
        else
            setCameraTarget(getLocalPlayer())
            outputChatBox("Welcome to My Server", getLocalPlayer())
        end
    end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

function ClickRightBut(button, state)
    if(button == "left" and state == "up")
    then 
        guiSetVisible(login, false)
        guiSetVisible(pw1, false)
        guiSetVisible(pw2, false)
        guiSetVisible(pw, false)
        guiSetVisible(GUIEditor.label[1], false)
      end
end

addEventHandler("onPlayerGUIClick", ClickLeftBut)

Try this  kickPlayer and spawnPlayer is server side not client 

Nah, also i removed that from client script, and again same, when player joins guis dont show

Link to comment
local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHan()
	fadeCamera(source, true)
    showCursor(source, true)
    triggerClientEvent(source , "pJoin", source )
  spawnPlayer(source, spawnX, spawnY, spawnZ) 
end

addEventHandler("onPlayerJoin", getRootElement(), joinHan)

function trig()
  for _, v in ipairs(getElementsByType("player")) do 
	triggerClientEvent(v, "pCreate", v)
end
end 

addEventHandler("onResourceStart", getRootElement(), trig)

 

Edited by Dimos7
Link to comment

Ill try,

Notig again

 

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHan()
	fadeCamera(source, true)
    showCursor(source, true)
    triggerClientEvent(source , "pJoin", source )
  	spawnPlayer(source, spawnX, spawnY, spawnZ) 
  	setCameraTarget(source)
end
addEventHandler("onPlayerJoin", getRootElement(), joinHan)
function trig()
	for _, v in ipairs(getElementsByType("player")) do 
		triggerClientEvent(v, "pCreate", v)
	end
end 
addEventHandler("onResourceStart", getRootElement(), trig)

gui wont show, i also added setCameraTarget and it just spawns me and shows cursor

Link to comment

You should remove this

function joinHan()
	fadeCamera(source, true)
    showCursor(source, true)
    triggerClientEvent("pJoin", source )
end

addEventHandler("onPlayerJoin", getRootElement(), joinHan)

function trig()
	triggerClientEvent("pCreate", root)
end

addEventHandler("onResourceStart", getRootElement(), trig)

and paste this (client-side)

addEventHandler("onClientResourceStart",resourceRoot,function()
	fadeCamera(true)
	showCursor(true)
	--maybe some setCameraMatrix stuff right here
	create()
end)

@Unkovic

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