-
Posts
582 -
Joined
-
Last visited
Everything posted by darhal
-
try this --- Use render event here please ! speedx,speedy,speedz = getElementVelocity(getPedOccupiedVehicle(localPlayer)) kmh = math.floor(((speedx^2 + speedy^2 + speedz^2) ^ (0.5)) * 180) dxDrawText (""..tostring(kmh).." km/h" , correctResolutinX(1080),correctResolutinY(700),x,y,tocolor(255,255,0,255),2,"pricedown") -- local screenWidth, screenHeight = guiGetScreenSize() cResolutionY = 768-- put your current resoultion Y here cResolutionX = 1360 -- put your current resoultion X here function correctResolutinY(y) if y then return (y/cResolutionY )*screenHeight end end function correctResolutinX(x) if x then return (x/cResolutionX)*screenWidth end end
-
tell me your current resolution ? local screenWidth, screenHeight = guiGetScreenSize() cResolutionY = 600 -- put your current resoultion Y here for me it s 600 cResolutionX = 800 -- put your current resoultion X here for me it s 800 function correctResolutinY(y) if y then return (y/cResolutionY )*screenHeight end end function correctResolutinX(x) if x then return (x/cResolutionX)*screenWidth end end
-
It because getCursorPosition return the position in relative (from 0 to 1). Try this: showCursor(true) local sx, sy = guiGetScreenSize() angle = 0 addEventHandler("onClientRender", root, function() --showCursor(true) local x, y = getCursorPosition() angle = findRotation(x*sx, y*sy, 358, 276) outputChatBox(angle) dxDrawImage(358, 100, 100, 100, ":CUPvehicles/files/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(140, 276, 100, 100, ":CUPvehicles/files/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(537, 276, 100, 100, ":CUPvehicles/files/lights.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(358, 276, 100, 100, ":CUPvehicles/files/switch.png", angle, 0, 0, tocolor(255, 255, 255, 255), true) end ) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end WOW thx a lot TAPL
-
showCursor(true) angle = 0 addEventHandler("onClientRender", root, function() --showCursor(true) x, y, _, _, _= getCursorPosition ( ) angle = findRotation(x, y, 358, 276) outputChatBox(angle) dxDrawImage(358, 100, 100, 100, ":CUPvehicles/files/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(140, 276, 100, 100, ":CUPvehicles/files/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(537, 276, 100, 100, ":CUPvehicles/files/lights.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(358, 276, 100, 100, ":CUPvehicles/files/switch.png", angle, 0, 0, tocolor(255, 255, 255, 255), true) end ) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end Dont even rotate !
-
show me an example at least
-
i forget that i always forget to save anyway thx alwa7sh function cpremoveCmd(plr, cmd) xml = xmlLoadFile ("clans.xml") for index, childNode in pairs ( xmlNodeGetChildren (xml) ) do xmlNodeSetAttribute(childNode, "Points", 0) end xmlSaveFile(xml) xmlUnloadFile(xml) end addCommandHandler("cpremove", cpremoveCmd)
-
try this one function cpremoveCmd(plr, cmd) xml = xmlLoadFile ("clans.xml") for index, childNode in pairs ( xmlNodeGetChildren (xml) ) do xmlNodeSetAttribute(childNode, "Points", 0) outputChatBox("Done",plr,0,255,0) break; end xmlSaveFile(xml) xmlUnloadFile(xml) end addCommandHandler("cpremove", cpremoveCmd) OMG puting the break here wil exsit the loop and only the first one will be done so @Barikat try this code function cpremoveCmd(plr, cmd) xml = xmlLoadFile ("clans.xml") for index, childNode in pairs ( xmlNodeGetChildren (xml) ) do xmlNodeSetAttribute(childNode, "Points", 0) end xmlSaveFile(xml) xmlUnloadFile(xml) end addCommandHandler("cpremove", cpremoveCmd)
-
At the line two u should put numbers not undefined x, y, z variables
-
local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0, 255, 0) local antiSpamTimer = {} local canPlayerUseMedkitsAgain = {} addEventHandler("onMarkerHit", theMarker, function(player) if getElementType(player) == "player" then outputChatBox("Type /med to buy 25% of Health", player, 255, 255, 255) end end) addCommandHandler("med", function(player) if getPlayerMoney(player) >= 1500 and not canPlayerUseMedkitsAgain[player] then local newHealth = getElementHealth(player) + 25 setElementHealth(player, newHealth) takePlayerMoney(player, 1500) canPlayerUseMedkitsAgain[player] = true outputChatBox("You have bought 25% health for $1,500", player, 0, 255, 0) antiSpamTimer[player] = setTimer(function (player) canPlayerUseMedkitsAgain[player] = false end, 2000, 1, player) end end)
-
Your code is kinda messy I fix it to see the problem try this addEventHandler("onClientGUIClick", guifinalizuj, function () if guiGetText(tytul) == "Tytuł: Mleko" then guiSetVisible(oknoprz, false) showCursor(false) exports["notifications"]:showBox("info","Na Twoim radarze zostało umieszczone miejsce rozładunku.") jakafura = getPedOccupiedVehicle(localPlayer) nazwafury = getVehicleName(jakafura) trasa = true if guiGetText(wyladunek) == "Wyładunek: San Fierro" then punkt = createMarker(-2443.31812, 740.89063, 34, "cylinder", 10, 0, 255, 255, 20) blip = createBlip(-2443.31812, 740.89063, 34.01563, 41) end if guiGetText(wyladunek) == "Wyładunek: Los Santos" then guiSetText(wynagrodzenie, "$500") end if guiGetText(wyladunek) == "Wyładunek: Las Venturas" then guiSetText(wynagrodzenie, "$2000") end if guiGetText(wyladunek) == "Wyładunek: Bayside" then guiSetText(wynagrodzenie, "$1700") end if guiGetText(wyladunek) == "Wyładunek: Fort Carson" then guiSetText(wynagrodzenie, "$1800") end if guiGetText(wyladunek) == "Wyładunek: Angel Pine" then guiSetText(wynagrodzenie, "$700") end if guiGetText(wyladunek) == "Wyładunek: Palomino Creek" then guiSetText(wynagrodzenie, "$1000") end if guiGetText(wyladunek) == "Wyładunek: Blubbery" then guiSetText(wynagrodzenie, "$900") end if guiGetText(wyladunek) == "Wyładunek: Doki" then guiSetText(wynagrodzenie, "$100") end if nazwa == "Roadtrain" then triggerServerEvent("cysterna", root) outputChatBox("Do tego rodzaju pojazdu wymagana jest przyczepa. Uważaj! Nie zgub jej.", 0, 255, 0) end end end)
-
ok then there is ) missed at line 164 find it and fix it by yourself
-
function cpremoveCmd(plr, cmd, clan) xml = xmlLoadFile ("clans.xml") for index, childNode in pairs ( xmlNodeGetChildren (xml) ) do local name = xmlNodeGetAttribute (childNode, "isim" ) if name == clan then mlNodeSetAttribute(childNode, "Points", 0) break; end end xmlUnloadFile(xml) end addCommandHandler("cpremove", cpremoveCmd)
-
addEventHandler("onClientGUIClick", guifinalizuj, function () if guiGetText(tytul) == "Tytuł: Mleko" then guiSetVisible(oknoprz, false) showCursor(false) exports["notifications"]:showBox("info","Na Twoim radarze zostało umieszczone miejsce rozładunku.") jakafura = getPedOccupiedVehicle(localPlayer) nazwafury = getVehicleName(jakafura) trasa = true if guiGetText(wyladunek) == "Wyładunek: San Fierro" then punkt = createMarker(-2443.31812, 740.89063, 34, "cylinder", 10, 0, 255, 255, 20) blip = createBlip(-2443.31812, 740.89063, 34.01563, 41) end if guiGetText(wyladunek) == "Wyładunek: Los Santos" then guiSetText(wynagrodzenie, "$500") end if guiGetText(wyladunek) == "Wyładunek: Las Venturas" then guiSetText(wynagrodzenie, "$2000") end if guiGetText(wyladunek) == "Wyładunek: Bayside" then guiSetText(wynagrodzenie, "$1700") end if guiGetText(wyladunek) == "Wyładunek: Fort Carson" then guiSetText(wynagrodzenie, "$1800") end if guiGetText(wyladunek) == "Wyładunek: Angel Pine" then guiSetText(wynagrodzenie, "$700") end if guiGetText(wyladunek) == "Wyładunek: Palomino Creek" then guiSetText(wynagrodzenie, "$1000") end if guiGetText(wyladunek) == "Wyładunek: Blubbery" then guiSetText(wynagrodzenie, "$900") end if guiGetText(wyladunek) == "Wyładunek: Doki" then guiSetText(wynagrodzenie, "$100") end if nazwa == "Roadtrain" then triggerServerEvent("cysterna", root) outputChatBox("Do tego rodzaju pojazdu wymagana jest przyczepa. Uważaj! Nie zgub jej.", 0, 255, 0) end end end end , false)
-
OMG no one know this calculation Guys I need helpp ! the image dont rotate
-
Hi as the title said I want the picture to face the cursor here is my code showCursor(true) angle = 0 addEventHandler("onClientRender", root, function() --showCursor(true) x, y, _, _, _= getCursorPosition ( ) --local angle = math.deg (math.atan2 ((x), (y))) angle = math.atan2(y - 100/2, x - 100/2) angle = math.deg(angle) if(angle < 0) then angle = 360 - (-angle) end outputChatBox(angle) dxDrawImage(358, 100, 100, 100, ":CUPvehicles/files/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(140, 276, 100, 100, ":CUPvehicles/files/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(537, 276, 100, 100, ":CUPvehicles/files/lights.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(358, 276, 100, 100, ":CUPvehicles/files/switch.png", angle+90, 0, 0, tocolor(255, 255, 255, 255), true) end )
-
You can also use cancelEvent
-
Solved i used split function
-
Hi I wan to covert this skin = "265, 217, 230" to this skin = {265, 217, 230} how ?
-
Well functions are not boolean values by the way you should change carGodMod and carNoGodMod to bool not function like carGodMod = true when you need to enable the god mod and set it to false when you need to disable it
-
Well stack overflow is a function that call another function which call the first function this called a trail function You should visit lua user wiki to see how to fix it !
-
Can you post any code?