Best-Killer Posted January 24, 2016 Share Posted January 24, 2016 server-side pv = {} spawners = { posX, posY, posZ, R, G, B, Alpha {1541.1, -1693.67, 13.55,255, 255, 255,600} } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(spawners) do local marker = createMarker(tostring(v[1]), tostring(v[2]), tostring(v[3])-1, "cylinder", 1.5, tostring(v[4]), tostring(v[5]), tostring(v[6]), tostring(v[7])) addEventHandler("onMarkerHit", marker, onMarkerHit) addEventHandler("onMarkerLeave", marker, onMarkerLeave) end end) function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end pv[player] = createVehicle(id, posx, posy, posz + 3) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end end addEvent("crVeh", true) addEventHandler("crVeh", getRootElement(), createTheVehicle) -- function onMarkerHit(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end function onMarkerLeave(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end any example to make it : posX, posY, posZ, R, G, B, Alpha,Rotation please guys really i need help here pls Link to comment
Castillo Posted January 24, 2016 Share Posted January 24, 2016 I really don't understand the problem. By the way, why are you using tostring for the numbers? createMarker uses numbers. Also, this will give you an error: tostring(v[3])-1 Link to comment
Army@1 Posted January 24, 2016 Share Posted January 24, 2016 Are you talking about createTheVehicle function arguments? Link to comment
Best-Killer Posted January 24, 2016 Author Share Posted January 24, 2016 I really don't understand the problem.By the way, why are you using tostring for the numbers? createMarker uses numbers. Also, this will give you an error: tostring(v[3])-1 tostring work fine my problem i want add markers rotation cuz i want add more than marker Link to comment
Best-Killer Posted January 24, 2016 Author Share Posted January 24, 2016 Castillo help me please , some help guys pls Link to comment
joaosilva099 Posted January 24, 2016 Share Posted January 24, 2016 pv = {} spawners = { posX, posY, posZ, R, G, B, Alpha {1541.1, -1693.67, 13.55,255, 255, 255,600} } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(spawners) do local marker = createMarker(tostring(v[1]), tostring(v[2]), tostring(v[3])-1, "cylinder", 1.5, tostring(v[4]), tostring(v[5]), tostring(v[6]), tostring(v[7])) setElementData(marker, "spawner>ID", i, false) addEventHandler("onMarkerHit", marker, onMarkerHit) addEventHandler("onMarkerLeave", marker, onMarkerLeave) end end) function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end local posx, posy, posz = spawners[getElementData(client, "spawner>ID")][1], spawners[getElementData(client, "spawner>ID")][2], spawners[getElementData(client, "spawner>ID")][3] setElementData(client, "spawner>ID", false, false) pv[player] = createVehicle(id, posx, posy, posz + 1) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end end addEvent("crVeh", true) addEventHandler("crVeh", getRootElement(), createTheVehicle) -- function onMarkerHit(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) setElementData(hitElement, "spawner>ID", getElementData(source, "spawner>ID"), false) end end function onMarkerLeave(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) setElementData(hitElement, "spawner>ID", false, false) end end Link to comment
Best-Killer Posted January 24, 2016 Author Share Posted January 24, 2016 pv = {} spawners = { posX, posY, posZ, R, G, B, Alpha {1541.1, -1693.67, 13.55,255, 255, 255,600} } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(spawners) do local marker = createMarker(tostring(v[1]), tostring(v[2]), tostring(v[3])-1, "cylinder", 1.5, tostring(v[4]), tostring(v[5]), tostring(v[6]), tostring(v[7])) setElementData(marker, "spawner>ID", i, false) addEventHandler("onMarkerHit", marker, onMarkerHit) addEventHandler("onMarkerLeave", marker, onMarkerLeave) end end) function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end local posx, posy, posz = spawners[getElementData(client, "spawner>ID")][1], spawners[getElementData(client, "spawner>ID")][2], spawners[getElementData(client, "spawner>ID")][3] setElementData(client, "spawner>ID", false, false) pv[player] = createVehicle(id, posx, posy, posz + 1) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end end addEvent("crVeh", true) addEventHandler("crVeh", getRootElement(), createTheVehicle) -- function onMarkerHit(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) setElementData(hitElement, "spawner>ID", getElementData(source, "spawner>ID"), false) end end function onMarkerLeave(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) setElementData(hitElement, "spawner>ID", false, false) end end 21 attempt to index field '?' a nill value Link to comment
joaosilva099 Posted January 24, 2016 Share Posted January 24, 2016 pv = {} sp = {} spawners = { [1] = {1541.1, -1693.67, 13.55,255, 255, 255,600, 0}, } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(spawners) do local marker = createMarker(v[1], v[2], v[3]-1, "cylinder", 1.5, v[4], v[5], v[6], v[7]) setElementData(marker, "spawner>ID", i) addEventHandler("onMarkerHit", marker, onMarkerHit) addEventHandler("onMarkerLeave", marker, onMarkerLeave) end end) function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end local posx, posy, posz, rotation = spawners[sp[player]][1], spawners[sp[player]][2], spawners[sp[player]][3], spawners[sp[player]][8] sp[player] = false pv[player] = createVehicle(id, posx, posy, posz + 1, 0, 0, rotation) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end end addEvent("crVeh", true) addEventHandler("crVeh", getRootElement(), createTheVehicle) -- function onMarkerHit(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) sp[hitElement] = getElementData(source, "spawner>ID") end end function onMarkerLeave(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end 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