Wysłany: 2020-07-30, 18:46
oskiixx
Wiek: 26 Na forum: 2331 dni Posty: 12
Nick w MP: eloskarro
Witam. Przychodz? z zapytaniem, gdzie dodaje si? koordynaty do marker?w w tych obu skryptach:
Kod:
--[[
autor: Asper (© 2019)
discord: Asper#0069
mail: nezymr69@gmail.com
for: Admaxis
all rights reserved.
]]
local sw,sh = guiGetScreenSize()
local zoom = 1920/sw
local dx = exports.dxLibary
local PJ = {}
local tbl = {}
local timer = false
addCommandHandler("t", function()
timer = setTimer(function()
local x,y,z = getElementPosition(localPlayer)
table.insert(tbl, {x, y, z})
outputChatBox("Dodano!")
end, 2500, 0)
end)
addCommandHandler("s", function()
for i,v in pairs(tbl) do
outputChatBox("{"..v[1]..", "..v[2]..", "..v[3].."},")
end
if(timer and isTimer(timer))then
killTimer(timer)
timer = false
end
end)
-- usefull function created by Asper
function isMouseInPosition(x, y, w, h)
if not isCursorShowing() then return end
local mouse = {getCursorPosition()}
local myX, myY = (mouse[1] * sw), (mouse[2] * sh)
if (myX >= x and myX <= (x + w)) and (myY >= y and myY <= (y + h)) then
return true
end
return false
end
local click = false
function onClick(x, y, w, h, called)
if(isMouseInPosition(x, y, w, h) and not click and getKeyState("mouse1"))then
click = true
called()
elseif(not getKeyState("mouse1") and click)then
click = false
end
end
--
PJ.marker = false
PJ.point = 1
PJ.type = false
PJ.blip = false
PJ.licenses = {
B = {
points = {
{1645.6860351563, -1715.671875, 20.126415252686},
{1642.8538818359, -1695.4031982422, 15.299208641052},
{1641.2005615234, -1714.0266113281, 14.971693992615},
{1628.2347412109, -1677.1921386719, 13.072877883911},
{1619.5090332031, -1607.6440429688, 13.219975471497},
{1651.1447753906, -1595.0229492188, 13.065179824829},
{1711.8215332031, -1595.2456054688, 13.037338256836},
{1777.9709472656, -1609.4774169922, 13.044215202332},
{1822.3901367188, -1603.6644287109, 13.081874847412},
{1832.4359130859, -1551.6011962891, 13.0444688797},
{1850.6055908203, -1490.8609619141, 13.040225982666},
{1876.1396484375, -1465.4860839844, 13.043773651123},
{1936.1046142578, -1465.4536132813, 13.056776046753},
{2005.4809570313, -1465.4729003906, 13.065214157104},
{2072.8642578125, -1466.6655273438, 22.884731292725},
{2110.4448242188, -1479.2982177734, 23.470254898071},
{2110.982421875, -1531.4783935547, 23.651109695435},
{2111.3181152344, -1588.3485107422, 25.480041503906},
{2110.9553222656, -1645.0474853516, 17.457712173462},
{2104.1345214844, -1709.8969726563, 13.057781219482},
{2086.0305175781, -1750.3048095703, 13.037436485291},
{2035.2227783203, -1750.3559570313, 13.068511962891},
{1968.3869628906, -1750.6295166016, 13.053482055664},
{1898.8675537109, -1750.4573974609, 13.061648368835},
{1842.9916992188, -1750.3210449219, 13.066005706787},
{1812.8585205078, -1732.9558105469, 13.076373100281},
{1765.4903564453, -1730.4362792969, 13.064309120178},
{1711.6925048828, -1730.3864746094, 13.061891555786},
{1651.1182861328, -1731.1380615234, 13.066401481628},
{1628.6301269531, -1712.9395751953, 13.079035758972},
{1638.8807373047, -1712.0574951172, 13.500531196594},
{1646.1105957031, -1699.498046875, 15.288143157959},
{1640.3757324219, -1712.4969482422, 19.704486846924},
{1651.8109130859, -1698.9530029297, 20.163457870483},
{1650.3585205078,-1696.4144287109,20.119714736938},
},
cost = 50,
pos = {1654.2717285156,-1656.4663085938,22.515625-1},
marker = false,
veh = {589, 1670.5559082031,-1695.9725341797,20.149894714355,0,0,140.32885742188},
},
}
for i,v in pairs(PJ.licenses) do
v.marker = createMarker(v.pos[1], v.pos[2], v.pos[3]+0.01, "cylinder", 1.2, 0, 200, 100)
end
PJ.onRender = function()
local cost = ""
if(PJ.licenses[PJ.type].cost > 0)then
cost = "\n\nCena: "..PJ.licenses[PJ.type].cost.."$"
end
dx:dxLibary_createWindow(714/zoom, 307/zoom, 493/zoom, 467/zoom)
dx:dxLibary_text("Prawo jazdy", 724/zoom, 317/zoom, 1197/zoom, 373/zoom, tocolor(0, 125, 255, 255), 10, "default", "center", "center", false, false, false, false, false)
dx:dxLibary_text("Posiadaj?c prawo jazdy mo?esz kierowa? r??norakim pojazdem."..cost, 738/zoom, 485/zoom, 1187/zoom, 569/zoom, tocolor(255, 255, 255, 255), 5, "default", "center", "center", false, true, false, false, false)
dx:dxLibary_createButton("Rozpocznij", 748/zoom, 678/zoom, 202/zoom, 51/zoom, 3)
dx:dxLibary_createButton("Anuluj", 985/zoom, 678/zoom, 202/zoom, 51/zoom, 3)
onClick(748/zoom, 678/zoom, 202/zoom, 51/zoom, function()
removeEventHandler("onClientRender", root, PJ.onRender)
showCursor(false)
for i,v in pairs(PJ.licenses) do
if(isElementWithinMarker(localPlayer, v.marker))then
triggerServerEvent("start.pj", resourceRoot, v, i)
end
end
end)
onClick(985/zoom, 678/zoom, 202/zoom, 51/zoom, function()
removeEventHandler("onClientRender", root, PJ.onRender)
showCursor(false)
end)
end
addEventHandler("onClientMarkerHit", resourceRoot, function(hit, dim)
if(hit ~= localPlayer or not dim)then return end
for i,v in pairs(PJ.licenses) do
if(source == v.marker)then
addEventHandler("onClientRender", root, PJ.onRender)
showCursor(true)
PJ.type = i
return
end
end
if(source == PJ.marker)then
destroyElement(PJ.marker)
destroyElement(PJ.blip)
PJ.point = PJ.point+1
for i,v in pairs(PJ.licenses) do
if(i == PJ.type)then
if(PJ.point == #v.points)then
triggerServerEvent("stop.pj", resourceRoot, i)
outputChatBox("* Zdajesz egzamin.")
setTimer(function()
setElementPosition(localPlayer, 1657.5795898438,-1658.7155761719,22.515625)
end, 500, 1)
else
PJ.marker = createMarker(v.points[PJ.point][1], v.points[PJ.point][2], v.points[PJ.point][3], "checkpoint", 2, 0, 255, 0, 255)
PJ.blip = createBlipAttachedTo(PJ.marker, 41)
end
end
end
end
end)
addEvent("start.pj", true)
addEventHandler("start.pj", resourceRoot, function(v, type)
PJ.point = 1
PJ.type = type
for i,v in pairs(PJ.licenses) do
if(i == type)then
PJ.marker = createMarker(v.points[1][1], v.points[1][2], v.points[1][3], "checkpoint", 2, 0, 255, 0, 255)
PJ.blip = createBlipAttachedTo(PJ.marker, 41)
end
end
end)
addEvent("stop.pj", true)
addEventHandler("stop.pj", resourceRoot, function(v, type)
if(PJ.marker and isElement(PJ.marker))then
destroyElement(PJ.marker)
destroyElement(PJ.blip)
end
end)
[ Dodano : 2020-07-30, 18:47 ]
Kod: --[[
autor: Asper (© 2019)
discord: Asper#0069
mail: nezymr69@gmail.com
for: Admaxis
all rights reserved.
]]
local db = exports.polaczenie
local PJ = {}
PJ.vehs = {}
PJ.peds = {}
function isPlayerHavePJ(player, type)
local result = db:query("select * from users where login=? limit 1", getPlayerName(player))
if(type == "A")then
return result[1].prawkoA
elseif(type == "B")then
return result[1].prawkoB
elseif(type == "C")then
return result[1].prawkoC
elseif(type == "L")then
return result[1].prawkoL
end
end
function givePlayerPJ(player, type)
if(type == "A")then
db:query("update users set prawkoA=1 where login=?", getPlayerName(player))
elseif(type == "B")then
db:query("update users set prawkoB=1 where login=?", getPlayerName(player))
elseif(type == "C")then
db:query("update users set prawkoC=1 where login=?", getPlayerName(player))
elseif(type == "L")then
db:query("update users set prawkoL=1 where login=?", getPlayerName(player))
end
end
addEvent("start.pj", true)
addEventHandler("start.pj", resourceRoot, function(v, type)
if(v.cost > 0)then
if(getPlayerMoney(client) < v.cost)then
outputChatBox("* Nie sta? Ci? na ten egzamin.", client)
return
else
takePlayerMoney(client, v.cost)
end
end
if(isPlayerHavePJ(client, type) == 0)then
triggerClientEvent(client, "start.pj", resourceRoot, v, type)
PJ.vehs[client] = createVehicle(unpack(v.veh))
warpPedIntoVehicle(client, PJ.vehs[client])
setElementData(PJ.vehs[client], "vehicle:ghost", true)
setVehicleColor(PJ.vehs[client], 255, 255, 255)
setVehicleHandling(PJ.vehs[client], "maxVelocity", 50)
PJ.peds[client] = createPed(17, 0, 0, 0)
warpPedIntoVehicle(PJ.peds[client], PJ.vehs[client], 1)
else
outputChatBox("* Posiadasz ju? zdane prawo jazdy tej kategorii.", client)
end
end)
addEvent("stop.pj", true)
addEventHandler("stop.pj", resourceRoot, function(passed)
if(PJ.vehs[client] and isElement(PJ.vehs[client]))then
destroyElement(PJ.vehs[client])
PJ.vehs[client] = nil
end
if(PJ.peds[client] and isElement(PJ.peds[client]))then
destroyElement(PJ.peds[client])
PJ.peds[client] = nil
end
if(passed)then
givePlayerPJ(client, passed)
end
end)
addEventHandler("onVehicleStartEnter", resourceRoot, function(player, seat)
cancelEvent()
end)
addEventHandler("onVehicleStartExit", resourceRoot, function(player, seat)
if(PJ.vehs[player] and isElement(PJ.vehs[player]))then
destroyElement(PJ.vehs[player])
PJ.vehs[player] = nil
end
if(PJ.peds[player] and isElement(PJ.peds[player]))then
destroyElement(PJ.peds[player])
PJ.peds[player] = nil
end
triggerClientEvent(player, "stop.pj", resourceRoot)
outputChatBox("* Oblewasz egzamin.", player)
setTimer(function()
setElementPosition(player, 1657.5795898438,-1658.7155761719,22.515625)
end, 500, 1)
end)
addEventHandler("onVehicleDamage", resourceRoot, function()
local controller = getVehicleController(source)
if(controller)then
if(PJ.vehs[controller] and isElement(PJ.vehs[controller]))then
destroyElement(PJ.vehs[controller])
PJ.vehs[controller] = nil
end
if(PJ.peds[controller] and isElement(PJ.peds[controller]))then
destroyElement(PJ.peds[controller])
PJ.peds[controller] = nil
end
triggerClientEvent(controller, "stop.pj", resourceRoot)
outputChatBox("* Oblewasz egzamin.", controller)
setTimer(function()
setElementPosition(controller, 1657.5795898438,-1658.7155761719,22.515625)
end, 500, 1)
end
end)
Wysłany: 2020-07-30, 18:48
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Z tego co widz? z kodu, je?li chcesz przerobi? punkty, x,y,z, znajduj? si? w tabeli o nazwie "points"
points = {
{ 1645.6860351563 , - 1715.671875 , 20.126415252686 },
{ 1642.8538818359 , - 1695.4031982422 , 15.299208641052 },
{ 1641.2005615234 , - 1714.0266113281 , 14.971693992615 },
{ 1628.2347412109 , - 1677.1921386719 , 13.072877883911 },
{ 1619.5090332031 , - 1607.6440429688 , 13.219975471497 },
{ 1651.1447753906 , - 1595.0229492188 , 13.065179824829 },
{ 1711.8215332031 , - 1595.2456054688 , 13.037338256836 },
{ 1777.9709472656 , - 1609.4774169922 , 13.044215202332 },
{ 1822.3901367188 , - 1603.6644287109 , 13.081874847412 },
{ 1832.4359130859 , - 1551.6011962891 , 13.0444688797 },
{ 1850.6055908203 , - 1490.8609619141 , 13.040225982666 },
{ 1876.1396484375 , - 1465.4860839844 , 13.043773651123 },
{ 1936.1046142578 , - 1465.4536132813 , 13.056776046753 },
{ 2005.4809570313 , - 1465.4729003906 , 13.065214157104 },
{ 2072.8642578125 , - 1466.6655273438 , 22.884731292725 },
{ 2110.4448242188 , - 1479.2982177734 , 23.470254898071 },
{ 2110.982421875 , - 1531.4783935547 , 23.651109695435 },
{ 2111.3181152344 , - 1588.3485107422 , 25.480041503906 },
{ 2110.9553222656 , - 1645.0474853516 , 17.457712173462 },
{ 2104.1345214844 , - 1709.8969726563 , 13.057781219482 },
{ 2086.0305175781 , - 1750.3048095703 , 13.037436485291 },
{ 2035.2227783203 , - 1750.3559570313 , 13.068511962891 },
{ 1968.3869628906 , - 1750.6295166016 , 13.053482055664 },
{ 1898.8675537109 , - 1750.4573974609 , 13.061648368835 },
{ 1842.9916992188 , - 1750.3210449219 , 13.066005706787 },
{ 1812.8585205078 , - 1732.9558105469 , 13.076373100281 },
{ 1765.4903564453 , - 1730.4362792969 , 13.064309120178 },
{ 1711.6925048828 , - 1730.3864746094 , 13.061891555786 },
{ 1651.1182861328 , - 1731.1380615234 , 13.066401481628 },
{ 1628.6301269531 , - 1712.9395751953 , 13.079035758972 },
{ 1638.8807373047 , - 1712.0574951172 , 13.500531196594 },
{ 1646.1105957031 , - 1699.498046875 , 15.288143157959 },
{ 1640.3757324219 , - 1712.4969482422 , 19.704486846924 },
{ 1651.8109130859 , - 1698.9530029297 , 20.163457870483 },
{ 1650.3585205078 ,- 1696.4144287109 , 20.119714736938 },
},
Wysłany: 2020-07-30, 18:52
oskiixx
Wiek: 26 Na forum: 2331 dni Posty: 12
Nick w MP: eloskarro
nie chc? przerobi?, chc? doda? nowe koordynaty pod markery, ale nie wiem gdzie si? je dodaje
Wysłany: 2020-07-30, 19:32
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
No przecie? na logik?, 1 linijka to 1 marker, je?li chcesz doda? odlicz sobie np chcesz doda? jako 6 marker co?, to dodaj to za 6 linijk? jako nowa linijka.
Tagi: markery
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: