piotrek87411
Wiek: 26 Na forum: 1754 dni Posty: 66
Nick w MP: piotrek84
Piwa : 173
chodzi o to ?e jak mam faggiosa punkt sie respi a jak zmieniam auto nie, chce zmienic jakby x,y,z ale nie wiem jak bo to dziwne jakie?
https://imgur.com/a/fNfXkbf
https://imgur.com/h8Nzab2
a i usuwam blipy na oddanie bo to nie to a tylko przeszkada
[code][/code]
Kod: local v = getVehicleModelFromName("boxville")
local v2 = getVehicleModelFromName("burrito")
pojazd = {}
local wyplaty = {
[1] = {6000, 7000}, --lvl 1
[2] = {7000, 8000}, -- lvl 2
}
addEvent("startListonosz", true)
addEventHandler("startListonosz", root, function()
pojazd[client] = createVehicle(v, 2770.972, -1614.987, 10.522, 359.472, 359.999, 270.32) -- 609 - boxville
warpPedIntoVehicle(client, pojazd[client])
setElementData(pojazd[client], "lvl", 1)
setElementData(pojazd[client], "listonosz_veh", 1)
setVehicleColor(pojazd[client], 0, 19, 83, 0, 0, 0,255,255,255,255,255,255)
setElementData(pojazd[client],"vehicle:fuel", 100)
setElementData(pojazd[client],"vehicle:bak", 100)
setVehicleVariant(pojazd[client], 0, 0)
setElementData(pojazd[client],"vehicle:desc","Praca Listonosza")
end)
addEvent("startListonosz2", true)
addEventHandler("startListonosz2", root, function()
pojazd[client] = createVehicle(v2, 2772.504, -1606.266, 11.043, 359.135, 0, 270.971) -- 482 - Burrito
warpPedIntoVehicle(client, pojazd[client])
setElementData(pojazd[client], "lvl", 2)
setElementData(pojazd[client], "listonosz_veh", 1)
setVehicleColor(pojazd[client], 0, 19, 83, 0, 0, 0,0,0,0,0,0,0)
setElementData(pojazd[client],"vehicle:fuel", 100)
setElementData(pojazd[client],"vehicle:bak", 100)
setVehicleVariant(pojazd[client], 0, 0)
addVehicleUpgrade(pojazd[client], 1080)
setElementData(pojazd[client],"vehicle:desc","Praca Listonosza")
end)
addEventHandler("onVehicleStartEnter", resourceRoot, function(plr)
if source ~= pojazd[plr] then
cancelEvent()
end
end)
addEvent("tp_listy", true)
addEventHandler("tp_listy", root, function()
destroyElement(pojazd[client])
pojazd[client] = nil
removePedFromVehicle(client)
setElementPosition(client, 2770.469, -1623.579, 10.927)
local rand = math.random(wyplaty[1][1], wyplaty[1][2])
--givePlayerMoney(client, rand)
exports['pystories-db']:dbSet("UPDATE `pystories_users` SET `bank_money` = `bank_money` + ? WHERE `id` = ?", rand, getElementData(client, "player:sid"))
outputChatBox ("??” #FFFFFFZarobi?‚e?› #00c000"..rand.."$ + RP #FFFFFFza oddanie wszystkich listĂłw! (Pieni?…dze trafi?‚y do konta bankowego).", client, 0, 255, 0, true)
local l = getElementData(client, "player:listy_kursy") or 0
--setElementData(client, "player:listy_kursy", l + 1)
--triggerServerEvent("daj:punkty:listonosza", localPlayer, localPlayer)
local srp = tonumber(getElementData(client, "player:srp"))
setElementData(client, "player:srp", srp + math.random(0, 2))
end)
addEvent("tp_listy2", true)
addEventHandler("tp_listy2", root, function()
destroyElement(pojazd[client])
pojazd[client] = nil
removePedFromVehicle(client)
setElementPosition(client, 2770.469, -1623.579, 10.927)
local rand = math.random(wyplaty[2][1], wyplaty[2][2])
--givePlayerMoney(client, rand)
exports['pystories-db']:dbSet("UPDATE `pystories_users` SET `bank_money` = `bank_money` + ? WHERE `id` = ?", rand, getElementData(client, "player:sid"))
outputChatBox ("??” #FFFFFFZarobi?‚e?› #00c000"..rand.."$ + RP #FFFFFFza oddanie wszystkich listĂłw! (Pieni?…dze trafi?‚y do konta bankowego).", client, 0, 255, 0, true)
local l = getElementData(client, "player:listy_kursy") or 0
--setElementData(client, "player:listy_kursy", l + 1)
--triggerServerEvent("daj:punkty:listonosza", localPlayer, localPlayer)
local srp = tonumber(getElementData(client, "player:srp"))
setElementData(client, "player:srp", srp + math.random(0, 3))
end)
addEvent("daj:punkty:listonosza", true)
addEventHandler("daj:punkty:listonosza", root, function(player)
local sid = getElementData(player, "player:sid")
local ilosc = getElementData(player, "player:listy_kursy") or 0
local q = exports['pystories-db']:dbGet("UPDATE pystories_users SET listonosz=listonosz+1 where id=?", sid)
setElementData(player, "player:listy_kursy", ilosc+1)
end)
addEventHandler("onPlayerQuit", root, function()
if pojazd[source] then
destroyElement(pojazd[source])
pojazd[source] = nil
end
end)
addEventHandler("onPlayerWasted", root, function()
if pojazd[source] then
destroyElement(pojazd[source])
pojazd[source] = nil
triggerClientEvent(source, "list_pktDelete", source)
setElementData(source, "listy", nil)
end
end)
addEventHandler("onVehicleStartEnter", root, function(plr)
if getElementData(plr, "listy") == true then
if not getElementData(source, "listonosz_veh") then
cancelEvent()
end
end
end)
addEventHandler("onVehicleExit", resourceRoot, function(plr)
if getElementData(plr, "listy") == true then
if getElementData(source, "lvl") == 2 then
setVehicleDoorOpenRatio (source, 4, 1, 1500)
setVehicleDoorOpenRatio (source, 5, 1, 1500)
end
end
end)
addEventHandler("onVehicleEnter", resourceRoot, function(plr)
if getElementData(plr, "listy") == true then
if getElementData(source, "lvl") == 2 then
setVehicleDoorOpenRatio (source, 4, 0, 1500)
setVehicleDoorOpenRatio (source, 5, 0, 1500)
end
end
end)
addEvent("zakoncz_listonosz", true)
addEventHandler("zakoncz_listonosz", root, function()
setElementPosition(client, 2770.469, -1623.579, 10.927)
triggerClientEvent(source, "list_pktDelete", source)
if pojazd[source] then
destroyElement(pojazd[source])
pojazd[source] = nil
setElementData(client, "listy", nil)
end
end)
local top = createElement("text")
setElementData(top, "name", "Top Graczy Listonosza:\n ")
setElementData(top, "scale", 1.0)
setElementPosition(top, 2795.39, -1619.247, 10.922+0.4)
local topka = exports["pystories-db"]:dbGet("SELECT * FROM `pystories_users` ORDER BY `listonosz` DESC LIMIT 10")
for i, v in ipairs(topka) do
local name = getElementData(top, "name")
setElementData(top, "name", name.."\n"..i..". "..v["login"].." ("..v["listonosz"].." kursĂłw)")
if i == 10 then
local name = getElementData(top, "name")
setElementData(top, "name", name.."\n\nTOP 1 (16.08.2021 - 22.08.2021) --- Premier 2.4 (Unikat)")
end
end
setTimer(function()
setElementData(top, "name", "Top Graczy Listonosza:\n ")
local topka = exports["pystories-db"]:dbGet("SELECT * FROM `pystories_users` ORDER BY `listonosz` DESC LIMIT 10")
for i, v in ipairs(topka) do
local name = getElementData(top, "name")
setElementData(top, "name", name.."\n"..i..". "..v["login"].." ("..v["listonosz"].." kursĂłw)")
if i == 10 then
local name = getElementData(top, "name")
setElementData(top, "name", name.."\n\nTOP 1 (16.08.2021 - 22.08.2021) --- Premier 2.4 (Unikat)")
end
end
end, 60000, 0)]
KLIENT------------------------
-- Autor MateuszDafGames
-- Dla PSEUDO?OW
[code]createBlip(2782.084, -1622.718, 10.922, 46, 2, 0, 0, 0, 0, 0, 500)
local punkty = { --punkty na 1 poziom
{2843.237, -1649.995, 11.045, 0, 0, 2.063},
{2865.684, -2049.97, 11.101, 270, 0, 2
c.lua
Kod: -- Autor MateuszDafGames
-- Dla serwera Navaxa RPG!
createBlip(2782.084, -1622.718, 10.922, 46, 2, 0, 0, 0, 0, 0, 500)
local wymagania = {
[1] = 3500, --rp
[2] = 850, --kursy
}
local do_oddania = 6 --ile punktĂłw ma sie pojawiac
local models = {0, 1, 181, 2, 7, 9, 14, 15, 16, 26, 27, 28, 29, 30}
obj = {}
for i, v in ipairs(punkty) do
obj[i] = createObject(1258, v[1], v[2], v[3]-0.4, 0, 0, v[4])
end
local start_job = createMarker(2770.601, -1628.37, 12.177-1.05, "cylinder", 1.3, 255, 200, 0, 150)
setElementData(localPlayer, "listy", nil)
addEventHandler("onClientMarkerHit", start_job, function(plr)
if plr ~= localPlayer then return end
if isPedInVehicle(plr) then return end
if getElementData(plr, "listy") == true then return end
if not isEventHandlerAdded("onClientRender", root, gui) then
tts = 1
addEventHandler("onClientRender", root, gui)
showCursor(true, false)
end
end)
addEventHandler("onClientMarkerLeave", start_job, function(plr)
if plr ~= localPlayer then return end
if isEventHandlerAdded("onClientRender", root, gui) then
tts = nil
removeEventHandler("onClientRender", root, gui)
showCursor(false)
end
end)
local x, y = guiGetScreenSize()
local px, py = (x/1024), (y/768)
local win = dxCreateTexture("files/gui.png", "argb", false)
local win2 = dxCreateTexture("files/window.png", "argb", false)
function button(title, posx, posy, w, h)
if isMouseIn(posx, posy, w, h) then
dxDrawImage(posx, posy, w, h, "files/button.png", 0, 0, 0, tocolor(200, 200, 200))
else
dxDrawImage(posx, posy, w, h, "files/button.png")
end
dxDrawText(title, posx, posy, (w+posx), (h+posy), tocolor(255, 255, 255), 1, "clear", "center", "center")
end
function gui()
if tts == 1 then
dxDrawImage(377*px, 154*py, 270*px, 460*py, win)
button("Rozpocznij", 447*px, 530*py, 130*px, 50*py)
local kursy = getElementData(localPlayer, "player:listy_kursy") or 0
dxDrawText("Twoje kursy: "..kursy.."\n\nPoziom 1 - "..wymagania[1].." RP\nPoziom 2 - "..wymagania[2].." kursĂłw", 412*px, 380*py, 612*px, 530*py, tocolor(255, 255, 255), 1*px, "default-bold", "center", "center")
elseif tts == 2 then
dxDrawImage(377*px, 154*py, 270*px, 460*py, win2)
button("Poziom 1", 447*px, 400*py, 130*px, 50*py)
button("Poziom 2", 447*px, 460*py, 130*px, 50*py)
end
end
function startListonosz(level)
if level == 1 then
local rnd = math.random(1, #punkty)
m = createMarker(punkty[rnd][1], punkty[rnd][2], punkty[rnd][3]-1.05, "cylinder", 1)
attachElements(m, obj[rnd], 0, -0.8, -0.6)
b = createBlipAttachedTo(m, 41)
setElementData(m, "listy_marker", true)
outputChatBox ("??” #FFFFFFPomy?›lnie rozpoczynasz prac?™: #00c005Listonosza Poziom 1", 0, 255, 0, true)
outputChatBox("?’? #FFFFFFJedĹş do celĂłw i dostarcz listy.",255,255,0,true)
licznik = 0
elseif level == 2 then
local rnd = math.random(1, #punkty_2)
--local random2 = math.random(1, #models)
m = createMarker(punkty_2[rnd][1], punkty_2[rnd][2], punkty_2[rnd][3]-1.05, "cylinder", 1)
attachElements(m, obj[rnd], 0, -0.8, -0.6)
--ped = createPed(models[random2], punkty_2[rnd][1], punkty_2[rnd][2], punkty_2[rnd][3], punkty_2[rnd][4])
b = createBlipAttachedTo(m, 41)
setElementData(m, "listy_marker2", true)
outputChatBox ("??” #FFFFFFPomy?›lnie rozpoczynasz prac?™: #00c005Listonosza Poziom 2", 0, 255, 0, true)
outputChatBox("?’? #FFFFFFJedĹş do celĂłw i dostarcz listy.",255,255,0,true)
licznik = 0
end
end
addEventHandler("onClientMarkerHit", resourceRoot, function(plr)
if plr ~= localPlayer then return end
if getElementData(source, "listy_marker") == true then
if not wziete then
outputChatBox("#FF0000?“? #ffffffWeĹş list z pojazdu.", 255, 255, 255, true)
return
end
licznik = licznik + 1
setPedAnimation (plr, "CASINO", "dealone", -1, true, false)
destroyElement(source)
destroyElement(b)
setTimer(function()
outputChatBox("#00FF00?“? #ffffffPomy?›lnie oddano list "..licznik.."/"..do_oddania, 255, 255, 255, true)
triggerServerEvent("daj:punkty:listonosza", localPlayer, localPlayer)
setPedAnimation(plr, false)
wziete = nil
local rnd = math.random(1, #punkty)
m = createMarker(punkty[rnd][1], punkty[rnd][2], punkty[rnd][3]-1.05, "cylinder", 1)
setElementData(m, "listy_marker", true)
attachElements(m, obj[rnd], 0, -0.8, -0.6)
b = createBlipAttachedTo(m, 41)
if licznik == do_oddania then
triggerServerEvent("tp_listy", localPlayer)
setElementData(localPlayer, "listy", nil)
destroyElement(m)
destroyElement(b)
m = nil
b = nil
if timer then
killTimer(timer)
timer = nil
end
if timer2 then
killTimer(timer2)
timer2 = nil
end
clockTimer = nil
timer = nil
timer2 = nil
clockTimer = nil
end
end, 2000, 1)
elseif getElementData(source, "listy_marker2") == true then
if not wziete then
outputChatBox("#FF0000?“? #ffffffWeĹş list z pojazdu.", 255, 255, 255, true)
return
end
licznik = licznik + 1
setPedAnimation (plr, "CASINO", "dealone", -1, true, false)
destroyElement(source)
destroyElement(b)
setTimer(function()
outputChatBox("#00FF00?“? #ffffffPomy?›lnie oddano list "..licznik.."/"..do_oddania, 255, 255, 255, true)
triggerServerEvent("daj:punkty:listonosza", localPlayer, localPlayer)
setPedAnimation(plr, false)
wziete = nil
local rnd = math.random(1, #punkty_2)
m = createMarker(punkty_2[rnd][1], punkty_2[rnd][2], punkty_2[rnd][3]-1.05, "cylinder", 1)
setElementData(m, "listy_marker2", true)
attachElements(m, obj[rnd], 0, -0.8, -0.6)
b = createBlipAttachedTo(m, 41)
if licznik == do_oddania then
triggerServerEvent("tp_listy2", localPlayer)
setElementData(localPlayer, "listy", nil)
destroyElement(m)
destroyElement(b)
m = nil
b = nil
if timer then
killTimer(timer)
timer = nil
end
if timer2 then
killTimer(timer2)
timer2 = nil
end
clockTimer = nil
timer = nil
timer2 = nil
clockTimer = nil
end
end, 1500, 1)
end
end)
addEvent("list_pktDelete", true)
addEventHandler("list_pktDelete", root, function()
for i, v in ipairs(getElementsByType("marker", resourceRoot)) do
if getElementData(v, "listy_marker") or getElementData(v, "listy_marker2") then
destroyElement(v)
destroyElement(b)
end
end
if attachedMarker then
destroyElement(attachedMarker)
attachedMarker = nil
end
end)
addEventHandler("onClientRender", root, function()
if clockTimer then
dxDrawText("Pozosta?‚o "..clockTimer.."s", 480*px, 740*py, 0, 0, tocolor(255, 255, 255), 1*px, "default-bold")
end
end)
addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat ~= 0 then return end
if plr == localPlayer then
if getElementData(source, "lvl") == 1 then
attachedMarker = createMarker(0, 0, -1.05, "cylinder", 0.6, 255, 0, 0)
setElementData(attachedMarker, "dupaPojazdu", true)
attachElements(attachedMarker, source, 0, -1.6, -0.5)
outputChatBox("#FF0000?“? #ffffffJe?›li nie wejdziesz do pojazdu w ci?…gu 60 sekund, praca zostanie zako?„czona!", 255, 255, 255, true)
clockTimer = 60
timer2 = setTimer(function()
clockTimer = clockTimer - 1
end, 1000, 60)
timer = setTimer(function()
if not clockTimer then return end
outputChatBox ("âś #FFFFFFPomy?›lnie zako?„czono prac?™: #00c005Listonosza Poziom 1", 255, 0, 0, true)
triggerServerEvent("zakoncz_listonosz", plr)
timer = nil
killTimer(timer2)
timer2 = nil
clockTimer = nil
if m then
destroyElement(m)
destroyElement(b)
m = nil
b = nil
end
end, 60000, 1)
elseif getElementData(source, "lvl") == 2 then
attachedMarker = createMarker(0, 0, -1.05, "cylinder", 1, 255, 0, 0)
setElementData(attachedMarker, "dupaPojazdu_2", true)
attachElements(attachedMarker, source, 0, -3.5, -1)
outputChatBox("#FF0000?“? #ffffffJe?›li nie wejdziesz do pojazdu w ci?…gu 60 sekund, praca zostanie zako?„czona!", 255, 255, 255, true)
clockTimer = 60
if not timer2 then
timer2 = setTimer(function()
clockTimer = clockTimer - 1
end, 1000, 60)
end
if not timer then
timer = setTimer(function()
if not clockTimer then return end
outputChatBox ("âś #FFFFFFPomy?›lnie zako?„czono prac?™: #00c005Listonosza Poziom 2", 255, 0, 0, true)
triggerServerEvent("zakoncz_listonosz", plr)
timer = nil
killTimer(timer2)
timer2 = nil
clockTimer = nil
if m then
destroyElement(m)
destroyElement(b)
m = nil
b = nil
end
end, 60000, 1)
end
end
end
end)
addEventHandler("onClientVehicleEnter", resourceRoot, function(plr)
if plr == localPlayer then
killTimer(timer)
killTimer(timer2)
timer = nil
timer2 = nil
clockTimer = nil
if getElementData(source, "lvl") == 1 then
clockTimer = nil
if timer2 then
killTimer(timer2)
timer2 = nil
end
if attachedMarker then
destroyElement(attachedMarker)
attachedMarker = nil
wziete = nil
clockTimer = nil
if timer2 then
killTimer(timer2)
timer2 = nil
clockTimer = nil
end
if timer then
killTimer(timer)
timer = nil
end
end
elseif getElementData(source, "lvl") == 2 then
clockTimer = nil
if attachedMarker then
destroyElement(attachedMarker)
attachedMarker = nil
wziete = nil
clockTimer = nil
if timer2 then
killTimer(timer2)
timer2 = nil
clockTimer = nil
end
if timer then
killTimer(timer)
timer = nil
end
end
end
end
end)
addEventHandler("onClientMarkerHit", resourceRoot, function(plr)
if plr ~= localPlayer then return end
if getElementData(source, "dupaPojazdu") == true then
if wziete then return end
setPedAnimation (plr, "CASINO", "dealone", -1, true, false)
wziete = true
destroyElement(source)
attachedMarker = nil
setTimer(function()
setPedAnimation(plr, false)
outputChatBox("?’? #FFFFFFWyj?™to list z pojazdu.",255,255,0,true)
end, 2000, 1)
elseif getElementData(source, "dupaPojazdu_2") == true then
if wziete then return end
setPedAnimation (plr, "CASINO", "dealone", -1, true, false)
wziete = true
destroyElement(source)
attachedMarker = nil
setTimer(function()
setPedAnimation(plr, false)
outputChatBox("?’? #FFFFFFWyj?™to list z pojazdu.",255,255,0,true)
end, 2000, 1)
end
end)
addEventHandler("onClientVehicleEnter", resourceRoot, function(plr)
if plr ~= localPlayer then return end
if skrzynia then
destroyElement(skrzynia)
skrzynia = nil
toggleControl("sprint", true)
toggleControl("jump", true)
toggleControl("walk", true)
wziete = nil
end
end)
addEventHandler("onClientClick", root, function(btn, state)
if btn ~= "left" or state ~= "down" then return end
if not isEventHandlerAdded("onClientRender", root, gui) then return end
if isMouseIn(447*px, 530*py, 130*px, 50*py) then
if tts == 1 then
tts = 2
end
end
if isMouseIn(447*px, 400*py, 130*px, 50*py) then --poziom 1
if tts == 2 then
if tonumber(getElementData(localPlayer, "player:srp")) < wymagania[1] then
outputChatBox("âś #FFFFFFNie posiadasz wymaganej reputacji. ("..wymagania[1].." RP)", 255, 0, 0, true)
return
end
startListonosz(1)
triggerServerEvent("startListonosz", localPlayer)
setElementData(localPlayer, "listy", true)
end
end
if isMouseIn(447*px, 460*py, 130*px, 50*py) then --poziom 2
if tts == 2 then
local gk = getElementData(localPlayer, "player:listy_kursy") or 0
if gk < wymagania[2] then
outputChatBox("âś #FFFFFFNie posiadasz wymaganych kursĂłw. ("..wymagania[2].." kursĂłw)", 255, 0, 0, true)
return
end
startListonosz(2)
triggerServerEvent("startListonosz2", localPlayer)
setElementData(localPlayer, "listy", true)
end
end
end)
setTimer(function()
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
if getElementData(veh, "listonosz_veh") then
for i, v in ipairs(getElementsByType("vehicle")) do
if getElementData(v, "listonosz_veh") then
setElementCollidableWith(v, veh, false)
setElementCollidableWith(veh, v, false)
setElementCollidableWith(v, v, false)
end
end
end
end
end, 50, 0)
function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i, v in ipairs( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end
function isMouseIn( 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