Recommended Posts

I have a Issue that I can't solve.

iK27VGn.png

Here's code:

CLIENT


g = 0

addCommandHandler("auto", function(plr, cmd)
    if g == 0 then
        g = 1
        
        local screenW, screenH = guiGetScreenSize()
        okno = guiCreateWindow((screenW - 580) / 2, (screenH - 550) / 2, 580, 550, "Stwórz pojazd", false)
        guiWindowSetSizable(okno, false)
        guiSetAlpha(okno, 0.81)

        stworz = guiCreateButton(103, 401, 374, 109, "Stwórz", false, okno)
        guiSetProperty(stworz, "NormalTextColour", "FFAAAAAA")
        id = guiCreateEdit((580 - 378) / 2, (550 - 84) / 2, 378, 84, "ID POJAZDU", false, okno)
        showCursor(true)

        x, y, z = getElementPosition(localPlayer)

        addEventHandler("onClientGUIClick", stworz, triggeruj, false)
    else
        g = 0
        guiSetVisible(okno, false)
        guiSetVisible(stworz, false)
        guiSetVisible(id, false)
        showCursor(false)
    end
end)

function triggeruj(button)
    if button == "left" then
        local auto = guiGetText(id)
        auto = tonumber(auto)
        triggerServerEvent("triggerujZrespienie", root, x, y, z)
    end
end

SERVER


function zrespFurke(auto, x, y, z)
	createVehicle(auto, x, y, z)
end
addEvent("triggerujZrespienie", true)
addEventHandler("triggerujZrespienie", resourceRoot, zrespFurke)

Please help to me!

Share this post


Link to post
function zrespFurke(auto, x, y, z)
	createVehicle(auto, x, y, z)  -- you need 4 arguments
end
addEvent("triggerujZrespienie", true)
addEventHandler("triggerujZrespienie", resourceRoot, zrespFurke)
56 minutes ago, NoviceWithManyProblems said:

 


g = 0

addCommandHandler("auto", function(plr, cmd)
    if g == 0 then
        g = 1
        
        local screenW, screenH = guiGetScreenSize()
        okno = guiCreateWindow((screenW - 580) / 2, (screenH - 550) / 2, 580, 550, "Stwórz pojazd", false)
        guiWindowSetSizable(okno, false)
        guiSetAlpha(okno, 0.81)

        stworz = guiCreateButton(103, 401, 374, 109, "Stwórz", false, okno)
        guiSetProperty(stworz, "NormalTextColour", "FFAAAAAA")
        id = guiCreateEdit((580 - 378) / 2, (550 - 84) / 2, 378, 84, "ID POJAZDU", false, okno)
        showCursor(true)

        x, y, z = getElementPosition(localPlayer)

        addEventHandler("onClientGUIClick", stworz, triggeruj, false)
    else
        g = 0
        guiSetVisible(okno, false)
        guiSetVisible(stworz, false)
        guiSetVisible(id, false)
        showCursor(false)
    end
end)

function triggeruj(button)
    if button == "left" then
        local auto = guiGetText(id)
        auto = tonumber(auto)
        triggerServerEvent("triggerujZrespienie", root, auto, x, y, z) --now you have 4 arguments
    end
end

 

In the client-side you only return the position x, y, z ( 3 arguments) , you need to return auto!

Share this post


Link to post

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.