Sayonara Posted May 9, 2018 Share Posted May 9, 2018 Hello guys! I have a Ped on serverside, and a Panel on clientside. How can I open my panel on serverside just for the localplayer? Link to comment
myonlake Posted May 9, 2018 Share Posted May 9, 2018 You can use triggerClientEvent for that specific player you want to open the panel for. Link to comment
Tommy. Posted May 10, 2018 Share Posted May 10, 2018 If the player clicks the ped with the id 1 it open the panel SERVER-SIDE: -- IDSkin, "id number", x, y, z, r peds = { {0, "1", 0, 0, 13, 0} } for i = 1, #peds do ped = createPed(peds[i][1], peds[i][3], peds[i][4], peds[i][5]) setElementRotation(ped, 0, 0, peds[i][6]) setElementData(ped, "id", peds[i][2], true) end CLIENT-SIDE function clickPed(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (clickedElement) and (getElementType(clickedElement) == "ped" ) then local x, y, z = getElementPosition(getLocalPlayer()) local wx, wy, wz = getElementPosition(clickedElement) local jij = getLocalPlayer() if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3) and (button == "left") and (state == "down" ) then local ped = getElementData(clickedElement, "id") if (ped == "1") then --FUNCTION PANEL end end else return end end addEventHandler("onClientClick", getRootElement(), clickPed, true) Link to comment
Sayonara Posted May 10, 2018 Author Share Posted May 10, 2018 For me the clickedPed function is in Server-side too. Link to comment
myonlake Posted May 10, 2018 Share Posted May 10, 2018 28 minutes ago, Sayonara said: For me the clickedPed function is in Server-side too. Show us your code so we can help you with the issue. Link to comment
MandaBraza Posted May 10, 2018 Share Posted May 10, 2018 local peds = {} function ped(id, model, x,y,z, rotz) local pedTable = {} pedTable.newPed = createPed(model, x,y,z, rotz) setElementFrozen(pedTable.newPed, true) setElementCollisionsEnabled(pedTable.newPed, false) setElementDimension(pedTable.newPed, getElementDimension(localPlayer)) table.insert(peds, pedTable) end function execute() for i, v in pairs(peds) do if (v.id == "1") then -- do whatever you want end end end bindKey("f", "down", execute) ped("1", 65, 2488.64160, -1664.28223, 13.34375, 90) -- grove street Link to comment
Master_MTA Posted May 11, 2018 Share Posted May 11, 2018 onElementClicked---server side then use triggerClientEvent---server side etc Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now