Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 How can I make a marker on the client side and create a car on the server side when a player enters it? Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 7 minutes ago, Firespider said: How can I make a marker on the client side and create a car on the server side when a player enters it? I don't understand what you mean, do you want to make a car? Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 I want to spawn a car Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 2 minutes ago, Firespider said: I want to spawn a car You want it when a player presses a button or you want it in F8 Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 How can I make a marker on the client side and spawn a car on the server side when a player enters it?* I would like to create a Marker on the client side and if the player goes into it, a car will spawn on the server side Oh Oh I just looked at shared function Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 Why is not working. Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 8 minutes ago, Firespider said: Why is not working. You can put up your code Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 local sx,sy = guiGetScreenSize();--1920,1080 local relx,rely = sx/1920,sy/1080; ----------- IsCardShop = false local money = getPlayerMoney(localPlayer) local Cardlist = { [1] = {411, "Jogosítvány", 1000}, [2] = {482, "Jogosítvány", 10000}, }; color = tocolor(41, 173, 21, 255) ----------- function Panel() if IsCardShop == true then dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color)--gomb1 dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, color2 or color)--gomb1 dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat ----------- function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end ----------- if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then color1 = tocolor(34, 110, 23, 255) else color1 = color end ----------- if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then color2 = tocolor(34, 110, 23, 255) else color2 = color end end end ----------- function OpenWindow() IsCardShop = not IsCardShop if removeEventHandler("onClientRender", root, Panel) then removeEventHandler("onClientRender", root, Panel) showCursor(false) else addEventHandler("onClientRender", root, Panel) showCursor(true) end end ---------- addEventHandler("onClientClick", root, function(button,state) if IsCardShop then if ( button == "left" and state == "down" ) then if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then takePlayerMoney (10000) IsCardShop = false outputChatBox("Menj be a Markerbe a vizsga elkezdéséhez") local playerMarker = createMarker(341.64114379883, -1351.6920166016, 14.5078125, "cylinder", 1, 10, 244, 23, 200) end end end end) ---------- function handlePlayerMarker(hitElement) local elementType = getElementType(hitElement) outputChatBox(" Itt tudod fel venni a szolgálatott /dutyonR") outputChatBox("Itt tudod le tenni a szolgálatott /dutyoffR") end addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker) ---------- local thePed = createPed(579, 336.8766784668, -1358.7130126953, 14.5078125, 280) addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if (button == "right") and (state == "up") then if isElement(clickedWorld) and clickedWorld == thePed then IsCardShop = not IsCardShop removeEventHandler("onClientRender", root, Panel) if IsCardShop then addEventHandler("onClientRender", root, Panel) end end end end) bindKey("BACKSPACE","down",function() if IsCardShop == true then IsCardShop = false end end) Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 -- Client Side local sx,sy = guiGetScreenSize();--1920,1080 local relx,rely = sx/1920,sy/1080; ----------- IsCardShop = false local money = getPlayerMoney(localPlayer) local Cardlist = { [1] = {411, "Jogosítvány", 1000}, [2] = {482, "Jogosítvány", 10000}, }; color = tocolor(41, 173, 21, 255) ----------- function Panel() if IsCardShop == true then dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color)--gomb1 dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, color2 or color)--gomb1 dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat ----------- function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end ----------- if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then color1 = tocolor(34, 110, 23, 255) else color1 = color end ----------- if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then color2 = tocolor(34, 110, 23, 255) else color2 = color end end end ----------- function OpenWindow() IsCardShop = not IsCardShop if removeEventHandler("onClientRender", root, Panel) then removeEventHandler("onClientRender", root, Panel) showCursor(false) else addEventHandler("onClientRender", root, Panel) showCursor(true) end end ---------- addEventHandler("onClientClick", root, function(button,state) if IsCardShop then if ( button == "left" and state == "down" ) then if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then triggerServerEvent("car", getLocalPlayer()) IsCardShop = false outputChatBox("Menj be a Markerbe a vizsga elkezdéséhez") end end end end) ---------- local thePed = createPed(579, 336.8766784668, -1358.7130126953, 14.5078125, 280) addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if (button == "right") and (state == "up") then if isElement(clickedWorld) and clickedWorld == thePed then IsCardShop = not IsCardShop removeEventHandler("onClientRender", root, Panel) if IsCardShop then addEventHandler("onClientRender", root, Panel) end end end end) bindKey("BACKSPACE","down",function() if IsCardShop == true then IsCardShop = false end end) Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 Can you help me in this? Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 -- Server Side addEventHandler("onPlayerQuit", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end) vehicle = {} addEvent("car", true) addEventHandler("car", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(599, x, y, z) --599 is the vehicle's hands. Put any vehicle you want warpPedIntoVehicle(source, vehicle[source]) end) try this 1 minute ago, Firespider said: Can you help me in this? try this Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 I want her to go to the maker and get a car, and that's the problem. Link to comment
Mr.Hugin Posted August 1, 2022 Share Posted August 1, 2022 I don't know my friend, but I'm waiting for someone to come, I'm a little busy Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 What does this error code mean? Link to comment
Firespider Posted August 1, 2022 Author Share Posted August 1, 2022 Why is playerMaker not detected? Link to comment
roaddog Posted August 2, 2022 Share Posted August 2, 2022 7 hours ago, Firespider said: Why is playerMaker not detected? addEvent("car", true) addEventHandler("car", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(599, x, y, z) --599 is the vehicle's hands. Put any vehicle you want warpPedIntoVehicle(source, vehicle[source]) playerMarker = createMarker(341.64114379883, -1351.6920166016, 14.5078125, "cylinder", 1, 10, 244, 23, 200) addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker) end) function handlePlayerMarker(hitElement) local elementType = getElementType(hitElement) outputChatBox(" Itt tudod fel venni a szolgálatott /dutyonR") outputChatBox("Itt tudod le tenni a szolgálatott /dutyoffR") end Link to comment
Firespider Posted August 2, 2022 Author Share Posted August 2, 2022 Now destroyElement cannot find it Link to comment
#\_oskar_/# Posted August 2, 2022 Share Posted August 2, 2022 18 minutes ago, Firespider said: Now destroyElement cannot find it Look at this page Link to comment
Firespider Posted August 2, 2022 Author Share Posted August 2, 2022 I do not get what you want? Link to comment
#\_oskar_/# Posted August 2, 2022 Share Posted August 2, 2022 47 minutes ago, Firespider said: I do not get what you want? Do not photograph codes and put them in a picture Link to comment
Firespider Posted August 2, 2022 Author Share Posted August 2, 2022 -- Server Side addEventHandler("onPlayerQuit", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end) vehicle = {} addEvent("car", true) addEventHandler("car", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(579, 341.7890625, -1373.0964355469, 14.366669654846, 0, 380, 470) --599 is the vehicle's hands. Put any vehicle you want warpPedIntoVehicle(source, vehicle[source]) playerMarker = createMarker(313.41094970703, -1394.2287597656, 13.993467330933, "cylinder", 4, 255, 0, 0, 0) addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker) end) function handlePlayerMarker(hitElement) local elementType = getElementType(hitElement) destroyElement(playerMarker) end Do you also need the client side? Link to comment
#\_oskar_/# Posted August 2, 2022 Share Posted August 2, 2022 4 hours ago, Firespider said: Do you also need the client side? what do you want to do ? Because I see that all the proposed codes are working and there are no problems Link to comment
Firespider Posted August 2, 2022 Author Share Posted August 2, 2022 That when the player's marker goes in, the marker disappears Link to comment
Firespider Posted August 2, 2022 Author Share Posted August 2, 2022 It just doesn't detect the playerMarker for some reason Link to comment
Mr.Hugin Posted August 2, 2022 Share Posted August 2, 2022 --Client Side local sx,sy = guiGetScreenSize();--1920,1080 local relx,rely = sx/1920,sy/1080; ----------- IsCardShop = false local money = getPlayerMoney(localPlayer) local Cardlist = { [1] = {411, "Jogosítvány", 1000}, [2] = {482, "Jogosítvány", 10000}, }; color = tocolor(41, 173, 21, 255) ----------- function Panel() if IsCardShop == true then dxDrawRectangle(sx*.35, sy*.35, sx*.30, sy*.05, tocolor(0, 0, 0, 200))--Fejléc dxDrawText("Jogosítvány", sx*.50, sy*.035, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*.35, sy*.40, sx*.30, sy*.20, tocolor(30, 40, 50, 250))-- panel dxDrawRectangle(sx*.40, sy*.47, sx*.06, sy*.05, color1 or color)--gomb1 dxDrawText("Megvétel", sx*.36, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Legális 1000$", sx*.36, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawRectangle(sx*0.55, sy*0.47, sx*0.06, sy*0.05, color2 or color)--gomb1 dxDrawText("Megvétel", sx*.66, sy*.27, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Ilegális 10000$", sx*.66, sy*.19, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat dxDrawText("Összeged: "..money.."$", sx*.52, sy*.40, sx*.50, sy*.72, tocolor(200, 200, 200, 255), relx*2, rely*2, "default-bold", "center", "center", false, false, false)--Felirat ----------- function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end ---------- if isMouseInPosition(sx*.40, sy*.47, sx*.06, sy*.05) then color1 = tocolor(88, 0, 0, 50) else color1 = color end ----------- if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then color2 = tocolor(88, 0, 0, 50) else color2 = color end end end ---------- function OpenWindow() IsCardShop = not IsCardShop if removeEventHandler("onClientRender", root, Panel) then removeEventHandler("onClientRender", root, Panel) showCursor(false) else addEventHandler("onClientRender", root, Panel) showCursor(true) end end bindKey("F3", "down", OpenWindow) ---------- addEventHandler("onClientClick", root, function(button,state) if IsCardShop == true then if ( button == "left" and state == "down" ) then if isMouseInPosition(sx*0.55, sy*0.47, sx*0.06, sy*0.05) then local yourMoney = getPlayerMoney() if ( yourMoney >= 10000) then takePlayerMoney(10000) triggerServerEvent("car", getLocalPlayer()) else outputChatBox("* You Don't Have Enough Money",255,0,0,true) --outputChatBox("Menj be a Markerbe a vizsga elkezdéséhez") end end end end end) ---------- local thePed = createPed(579, 336.8766784668, -1358.7130126953, 14.5078125, 280) addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if (button == "right") and (state == "up") then if isElement(clickedWorld) and clickedWorld == thePed then IsCardShop = not IsCardShop removeEventHandler("onClientRender", root, Panel) if IsCardShop then addEventHandler("onClientRender", root, Panel) end end end end) bindKey("BACKSPACE","down",function() if IsCardShop == true then IsCardShop = false end end) --Server Side vehicle = {} -------- addEvent("car", true) addEventHandler("car", root, function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(599, x, y, z) --599 is the vehicle's hands. Put any vehicle you want warpPedIntoVehicle(source, vehicle[source]) end) try this 20 minutes ago, Firespider said: It just doesn't detect the playerMarker for some reason You what do you want, I do not understand you Do you want a panel to open in Marker 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