Kamilo_Kamilo12
Wiek: 25 Na forum: 1930 dni Posty: 8
Nick w MP: Kamilo
Piwa : 2
Witam, Przychodz? dzi? do was z Pytaniem dlaczego nie dzia?a Skrypt na SARA, Zacznijmy od tego ?e nie wczytuje si? Blip do wej?cia do Interioru, Nast?pna sprawa jest taka ?e wy?wietlaj? sie Takie B??dy w debugscript 3:
ERROR: frakcja-sara\c_duty.lua:14: exports: Call to non-running server resource (blur) [string "?"]
ERROR: Server triggered clientside event onClientAddNotification, but event is not added clientside
Kod Skryptu: (c_duty) Kod:
local marker=createMarker(-49.77, -269.36, 6.63, 'cylinder', 1.3, 255, 79, 10)
local sx, sy = guiGetScreenSize()
function p1(x)
return (x/1280)*sx
end
function p2(y)
return (y/1024)*sy
end
local blur = exports['blur']
local screenW, screenH = guiGetScreenSize()
local sw,sh = guiGetScreenSize()
local elements = {}
mojeW,mojeH = 1280, 1024
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local sx,sy = guiGetScreenSize()
local baseX = 1920
local zoom = 1
local minZoom = 2
if sx < baseX then
zoom = math.min(minZoom, baseX/sx)
end
function shadowText2(text, x, y, w, h, color, size, font, xx, yy)
dxDrawText(text, x, y, w, h, color, size, font, xx, yy, false,false,false,true)
end
function shadowText(text, x, y, w, h, color, size, font, xx, yy)
dxDrawText(text, x+1, y+1, w+1, h+1, tocolor(0,0,0), size, font, xx, yy, false)
dxDrawText(text, x, y, w, h, color, size, font, xx, yy, false,false,false,true)
end
function roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
local font = "default-bold"
okno = false
okno69 = false
tick = getTickCount()
local sx, sy = guiGetScreenSize()
function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
addEventHandler("onClientMarkerHit", marker, function(player)
if player ~= localPlayer then return end
tick = getTickCount()
addEventHandler("onClientRender", root, gui)
okno69 = true
showCursor(true)
end)
function gui()
local alph = interpolateBetween(0, 0, 0, 255, 0, 0, (getTickCount() - tick)/1000, "OutQuad")
dxDrawLine(790/zoom - 1, 355/zoom - 1, 790/zoom - 1, 725/zoom, tocolor(0, 0, 0, 255), 1, false)
dxDrawLine(1131/zoom, 355/zoom - 1, 790/zoom - 1, 355/zoom - 1, tocolor(0, 0, 0, 255), 1, false)
dxDrawLine(790/zoom - 1, 725/zoom, 1131/zoom, 725/zoom, tocolor(0, 0, 0, 255), 1, false)
dxDrawLine(1131/zoom, 725/zoom, 1131/zoom, 355/zoom - 1, tocolor(0, 0, 0, 255), 1, false)
blur:dxDrawBluredRectangle(790/zoom, 355/zoom, 341/zoom, 370/zoom, tocolor(175, 175, 175, 255), false)
dxDrawText("San Andreas Road Assistance", 752/zoom + 1, 355/zoom + 1, 1168/zoom + 1, 397/zoom + 1, tocolor(0, 0, 0, 255), 1.00/zoom, font, "center", "center", false, false, false, false, false)
dxDrawText("San Andreas Road Assistance", 752/zoom, 355/zoom, 1168/zoom, 397/zoom, tocolor(255, 255, 255, 255), 1.00/zoom, font, "center", "center", false, false, false, false, false)
--dxDrawText("sara jest fajna", 800/zoom + 1, 405/zoom + 1, 1118/zoom + 1, 527/zoom + 1, tocolor(0, 0, 0, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
--dxDrawText("sara jest fajna", 800/zoom, 405/zoom, 1118/zoom, 527/zoom, tocolor(255, 255, 255, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
if isMouseIn(818/zoom, 568/zoom, 285/zoom, 59/zoom) then
dxDrawLine(818/zoom - 1, 568/zoom - 1, 818/zoom - 1, 627/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 568/zoom - 1, 818/zoom - 1, 568/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(818/zoom - 1, 627/zoom, 1103/zoom, 627/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 627/zoom, 1103/zoom, 568/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawRectangle(818/zoom, 568/zoom, 285/zoom, 59/zoom, tocolor(255, 255, 255, 150), false)
else
dxDrawLine(818/zoom - 1, 568/zoom - 1, 818/zoom - 1, 627/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 568/zoom - 1, 818/zoom - 1, 568/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(818/zoom - 1, 627/zoom, 1103/zoom, 627/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 627/zoom, 1103/zoom, 568/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawRectangle(818/zoom, 568/zoom, 285/zoom, 59/zoom, tocolor(255, 255, 255, 95), false)
end
if isMouseIn(818/zoom, 637/zoom, 285/zoom, 59/zoom) then
dxDrawLine(818/zoom - 1, 637/zoom - 1, 818/zoom - 1, 696/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 637/zoom - 1, 818/zoom - 1, 637/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(818/zoom - 1, 696/zoom, 1103/zoom, 696/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 696/zoom, 1103/zoom, 637/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawRectangle(818/zoom, 637/zoom, 285/zoom, 59/zoom, tocolor(255, 255, 255, 150), false)
else
dxDrawLine(818/zoom - 1, 637/zoom - 1, 818/zoom - 1, 696/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 637/zoom - 1, 818/zoom - 1, 637/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(818/zoom - 1, 696/zoom, 1103/zoom, 696/zoom, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(1103/zoom, 696/zoom, 1103/zoom, 637/zoom - 1, tocolor(255, 255, 255, 255), 1, false)
dxDrawRectangle(818/zoom, 637/zoom, 285/zoom, 59/zoom, tocolor(255, 255, 255, 95), false)
end
if getElementData(localPlayer,'player:faction') == 'SARA' then
dxDrawText("Zako?cz s?u?b?", 818/zoom + 1, 568/zoom + 1, 1103/zoom + 1, 627/zoom + 1, tocolor(0, 0, 0, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Zako?cz s?u?b?", 818/zoom, 568/zoom, 1103/zoom, 627/zoom, tocolor(255, 255, 255, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
else
dxDrawText("Rozpocznij s?u?b?", 818/zoom + 1, 568/zoom + 1, 1103/zoom + 1, 627/zoom + 1, tocolor(0, 0, 0, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Rozpocznij s?u?b?", 818/zoom, 568/zoom, 1103/zoom, 627/zoom, tocolor(255, 255, 255, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
end
dxDrawText("Anuluj", 818/zoom + 1, 637/zoom + 1, 1103/zoom + 1, 696/zoom + 1, tocolor(0, 0, 0, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
dxDrawText("Anuluj", 818/zoom, 637/zoom, 1103/zoom, 696/zoom, tocolor(255, 255, 255, 255), 1.00/zoom, "default-bold", "center", "center", false, false, false, false, false)
end
addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if isMouseIn(818/zoom, 568/zoom, 285/zoom, 59/zoom) and okno69 == true then
triggerServerEvent("RozpocznijSARA",root,localPlayer)
removeEventHandler("onClientRender", root, gui)
tick = getTickCount()
okno69 = false
okno = true
showCursor(false)
elseif isMouseIn(818/zoom, 637/zoom, 285/zoom, 59/zoom) and okno69 == true then
removeEventHandler("onClientRender", root, gui)
showCursor(false)
tick = getTickCount()
okno69 = false
end
end
end)
--]]
Nast?pny kod: (s_duty)
Kod:
function RGBToHex(red, green, blue, alpha)
if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then
return nil
end
if(alpha) then
return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha)
else
return string.format("#%.2X%.2X%.2X", red,green,blue)
end
end
local licz = {}
local t=createElement('text')
setElementData(t,'name','Rozpocz?cie s?u?by\nSan Andreas Road Assistance')
setElementPosition(t,1045.41, 1248.67, -29.03)
setElementInterior(t, 0)
local blip = createBlip(-49.75, -277.07, 5.43, 11,2,0,0,0,0,0,275)
function isPlayerInSARAFaction(plr)
local sid=getElementData(plr,'player:sid')
if not sid then return end
local result=exports['pystories-db']:dbGet('SELECT 1 FROM pystories_factions WHERE code=? AND sid=? LIMIT 1;', "SARA", sid)
if result[1] then
return true
else
return false
end
end
addEvent("RozpocznijSARA",true)
addEventHandler("RozpocznijSARA",root,function(el)
if isPlayerInSARAFaction(el) then
if not getElementData(el,'player:faction') then
exports['psrpg-frakcja-ustawienia']:rozpocznijnaliczanie(el)
setElementData(el,'player:faction','SARA')
local rank = exports['psrpg-frakcja-ustawienia']:getPlayerFactionRank(el,'SARA')
setElementData(el,"player:rank",rank)
giveWeapon(el,32,1)
setElementData(el,"last:nick",getPlayerName(el))
setElementData(el,"last:color",tostring(getPlayerNametagColor(el)))
setPlayerName(el,"#808080"..getPlayerName(el):gsub("#%x%x%x%x%x%x",""))
triggerClientEvent( el, "onClientAddNotification", el, "Rozpocz??e?/a? s?u?be we frakcji:\n#00c005SARA #FFFFFF(#00c005San Andreas Road Assistance#FFFFFF)", "success" )
local desc = "[S?u?ba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." rozpocz?? s?u?be we frakcji: SARA"
triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
triggerEvent("admin:logs", root, desc)
outputServerLog(desc)
local sid=getElementData(el,"player:sid")
exports['pystories-db']:dbSet('UPDATE pystories_factions set actived=NOW() WHERE code=? AND sid=? LIMIT 1;', "SARA", sid)
else
takeAllWeapons(el)
exports['psrpg-frakcja-ustawienia']:zatrzymajnaliczanie(el)
setElementData(el, 'player:faction', false)
setElementData(el,"player:rank",false)
setElementData(el,'player:wyposazenie_medyka',false)
local skin=getElementData(el,"player:skin")
setElementModel(el, skin)
setPlayerName(el,getElementData(el,"last:nick"))
triggerClientEvent( el, "onClientAddNotification", el, "Zako?czy?e?/a? s?u?be we frakcji:\n#00c005SARA #FFFFFF(#00c005San Andreas Road Assistance#FFFFFF)", "success" )
local desc = "[S?u?ba] Gracz: "..getPlayerName(el):gsub("#%x%x%x%x%x%x","").." zako?czy? s?u?be we frakcji: SARA"
triggerEvent("admin:addText", resourceRoot, RGBToHex(0,87,110)..desc..RGBToHex(255,255,255),math.random(0,99))
triggerEvent("admin:logs", root, desc)
outputServerLog(desc)
end
else
triggerClientEvent( el, "onClientAddNotification", el, "Nie jeste? zatrudniony/a we frakcji:\n#bf0101SARA #FFFFFF(#bf0101San Andreas Road Assistance#FFFFFF)", "error" )
end
end)
function naliczanie(el)
if isElement(el) then
local x = getElementData(el,"player:workinjob") or 0
setElementData(el,"player:workinjob",x+1)
else
if isTimer(licz[el]) then
killTimer(licz[el])
licz[el] = nil
end
end
end
mig = {}
function pacholek(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local ob = createObject(1238,x,y,z-0.65,0,0,rotZ)
local s = createMarker(x,y,z-0.30,'corona',1,255,255,0,125)
mig[s] = true
--setElementAlpha(s,0)
setElementFrozen(ob,true)
triggerClientEvent("setBreakable",root,ob)
setElementParent(s,ob)
table.insert(rbs, ob )
setTimer(function() if isElement(ob) then destroyElement(ob) end end,60000 * 20,1)
--setElementID ( roadblockobject, rbo )
setElementPosition ( source, x, y, z+1 )
outputChatBox('Ustawiono pacho?‚ek ?›wiec?…cy.',source,255,255,0)
setElementData(source,'player:rbs',rbs)
setElementInterior(ob, getElementInterior(source))
setElementDimension(ob, getElementDimension(source))
end
end
setTimer(function()
if not mig then return end
for key, value in pairs(mig) do
if isElement(key) then
if getElementType(key) ~= "marker" then return end
local r, g, b = getMarkerColor(key)
if ( r == 255 and g == 255 ) then
setMarkerColor(key,255,0,0,125)
else
setMarkerColor(key,255,255,0,125)
end
end
end
end, 1500, 0)
addCommandHandler('ustaw',function(source,cmd,arg)
if not arg then return end
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
outputChatBox("/ustaw [pacholek/barierka/bariera/swiatlo] Blokady znikaj?… po 20min.",source)
if arg == "pacholek" then
pacholek(source)
elseif arg == "barierka" then
barierka(source)
elseif arg == "parawan" then
parawan(source)
elseif arg == "bariera" then
bariera(source)
elseif arg == "swiatlo"then
swiatlo(source)
end
end
end)
function parawan(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local obj = createObject(1852, x,y,z-0.25,90,0,rotZ) --1239
table.insert(rbs,obj )
setTimer(function() if isElement(obj) then destroyElement(obj) end end,60000 * 20,1)
setElementID ( roadblockobject, rbs )
--setElementPosition ( source, x, y, z )
triggerClientEvent("setBreakable",root,obj)
setElementFrozen(obj,true)
outputChatBox('#06B200(??”) #FFFFFFPomy?›lnie ustawiono parawan. ID: '..#rbs,source,255,255,0, true)
setElementData(source,'player:rbs',rbs)
setElementInterior(obj, getElementInterior(source))
setElementDimension(obj, getElementDimension(source))
end
end
addCommandHandler('usun',function(source,cmd,arg,arg2)
if not arg then return end
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
outputChatBox("/usun [blokady/blokade]",source)
if arg == "blokady" then
blokady(source)
elseif arg == "blokade" then
if not arg2 then outputChatBox("Wpisz id blokady!",source) return end
blokade(source,arg2)
end
end
end)
function barierka(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local obj = createObject(1228,x,y,z-0.65,0,0,rotZ)
table.insert(rbs,obj )
setTimer(function() if isElement(obj) then destroyElement(obj) end end,60000 * 20,1)
--setElementID ( roadblockobject, rbo )
setElementPosition ( source, x, y, z+1 )
triggerClientEvent("setBreakable",root,obj)
setElementFrozen(obj,true)
outputChatBox('Ustawiono barierk?™.',source,255,255,0)
setElementData(source,'player:rbs',rbs)
setElementData(obj,"create:player",getPlayerName(source))
setElementInterior(obj, getElementInterior(source))
setElementDimension(obj, getElementDimension(source))
end
end
function swiatlo(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local obj = createObject(1262,x,y,z+2,0,0,rotZ)
table.insert(rbs,obj )
setTimer(function() if isElement(obj) then destroyElement(obj) end end,60000 * 20,1)
--setElementID ( roadblockobject, rbo )
setElementPosition ( source, x, y, z+1 )
setElementFrozen(obj,true)
triggerClientEvent("setBreakable",root,obj)
outputChatBox('Ustawiono swiatlo.',source,255,255,0)
setElementData(source,'player:rbs',rbs)
setElementData(obj,"create:player",getPlayerName(source))
setElementInterior(obj, getElementInterior(source))
setElementDimension(obj, getElementDimension(source))
end
end
function bariera(source,command)
if getElementData(source,'player:faction') and getElementData(source,'player:faction')=='SARA' then
local rbs = getElementData(source,'player:rbs') or {}
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local obj = createObject(3578,x,y,z-0.65,0,0,rotZ)
table.insert(rbs,obj )
setTimer(function() if isElement(obj) then destroyElement(obj) end end,60000 * 20,1)
setElementPosition ( source, x, y, z+1 )
triggerClientEvent("setBreakable",root,obj)
outputConsole(x..','..y..','..z)
outputChatBox('Ustawiono barier?™.',source,255,255,0)
setElementData(obj,"create:player",getPlayerName(source))
setElementData(source,'player:rbs',rbs)
setElementFrozen(obj,true)
setElementInterior(obj, getElementInterior(source))
setElementDimension(obj, getElementDimension(source))
end
end
function blokady(plr)
if getElementData(plr,'player:rbs') then
for key, value in ipairs(getElementData(plr,'player:rbs')) do
if isElement(value) then
destroyElement(value)
end
end
outputChatBox('*Usun?…?‚e?› blokady.',plr,255,255,255,true)
removeElementData(plr,'player:rbs')
end
end
function blokade(plr,value)
if value then
local rbs = {}
for key, v in ipairs(getElementData(plr,'player:rbs')) do
if isElement(v) and key == tonumber(value) then
destroyElement(v)
outputChatBox('Usuno?‚e?› Blokad?™ ID: '..key,plr,255,255,0)
else
table.insert(rbs,v)
end
setElementData(plr,'player:rbs',rbs)
end
else
--outputChatBox('Aby usun?…c blokade wpisz /'..CommandName..' [id]',player,150,0,0)
end
end
Ostatnio zmieniony przez Wilq 2021-03-23, 15:21, w całości zmieniany 3 razy