231
Members-
Posts
30 -
Joined
-
Last visited
Recent Profile Visitors
913 profile views
231's Achievements
Rat (9/54)
0
Reputation
-
setTimer(function() for ,player in ipairs(getElementsByType("player")) do for ,blip in ipairs(getElementsByType("blip")) do if createBlipAttachedTo ( blip ) then getBlipColor ( blipValue ) else setBlipColor ( blip, 0, 0, 0, 255 ) end, 5000 ) bindKey( "4", "down" )) Lua:2: "<name>" expected near ","
-
لا يظهر التوقيت في الجزء العلوي من الشاشة
-
كان من الممكن أن أفعل ذلك بشكل خاطئ حيث لا يمكنني إحضاره بطريقة ما لا تزال مناسبة local sx, sy = guiGetScreenSize() function renderText() dxDrawText(timeText, sx/2, sy/2, 0, 0, tocolor(255, 255, 255), 2, "default-bold") end function countdownFin() --whatever you want to happen here end local countdown = setTimer(countdownFin, 600000, 1) --set the timer for 10 minutes setTimer( function() local x = getTimerDetails(countdown) local timeLeft = math.ceil(x/1000) outputChatBox(convertSecondsToMinutes(timeLeft)) end, 1000, 0) function convertSecondsToMinutes(sec) --turn the seconds into a MM:SS format local temp = sec/60 local temp2 = (math.floor(temp)) --this equals the minutes local temp3 = sec-(temp2*60) --and this is seconds if string.len(temp3) < 2 then --make sure it's displayed correctly (MM:SS) temp3 = "0"..tostring(temp3) end return tostring(temp2)..":"..tostring(temp3) end النص هو اقتباس
-
Thanks everyone server.lua:3: Bad argument @ 'getElementPosition' [Expected element at argument 1, got string 'easr'] server.lua:5: attempt to perform arithmetic on local 'posX' (a boolean value)
-
addCommandHandler("easr",function(_, player) players = getElementsByType ( "player" ) for i,v in ipairs(players) do setElementPosition ( source, posX, posY, posZ ) end end) What can be my fault I want to attract all players
-
I want to bring all players on the server with command
-
local function getPedsOnScreen() local peds = {} for key, ped in ipairs(getElementsByType("ped", root, true)) do if isElementOnScreen(ped) then table.insert(peds, ped) end end return peds end local function dxDrawLinedRectangle(posX, posY, height, width, angleAmount, color, postGUI) radius = height or 50 width = width or 5 angleAmount = angleAmount or 1 color = color or tocolor(255, 255, 255, 200) postGUI = postGUI or false function dxDrawLinedRectangle( x, y, width, height, color, _width, postGUI ) _width = _width or 1 dxDrawLine ( x, y, x+width, y, color, _width, postGUI ) -- Top dxDrawLine ( x, y, x, y+height, color, _width, postGUI ) -- Left dxDrawLine ( x, y+height, x+width, y+height, color, _width, postGUI ) -- Bottom return dxDrawLine ( x+width, y, x+width, y+height, color, _width, postGUI ) -- Right end return true end local function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end local function sortbyrot(a, b) local _, _, rz = getElementRotation(localPlayer) local x, y = getElementPosition(localPlayer) local ax, ay = getElementPosition(a) local bx, by = getElementPosition(b) local arz = findRotation(x, y, ax, ay) arz = math.abs(rz - arz) local brz = findRotation(x, y, bx, by) brz = math.abs(rz - brz) return arz < brz end addEventHandler("onClientRender", root, function() local weapon = getPedWeapon(localPlayer) if weapon and weapon > 0 then local peds = getPedsOnScreen() if #peds > 0 then table.sort(peds, sortbyrot) local chosen = peds[1] local hx, hy, hz = getPedBonePosition(chosen, 6) local sx, sy = getScreenFromWorldPosition(hx, hy, hz) if sx then dxDrawLinedRectangle(sx, sy) end end end end) client.lua/21.attempt to perform arithmetic on local width a nil value mta
-
local x, y, z = getElementPosition(getLocalPlayer()) local dx, dy = guiGetScreenSize() aimX, aimY = dx * 0.54, dy * 0.3971 triggerServerEvent("AimOnPosition", resourceRoot) function AimOnPosition() local setToX, setToY = 0, 0 local hx, hy, hz = getPedBonePosition(Ped, 6) local sx, sy = getScreenFromWorldPosition(hx, hy, hz) setToX = math.abs(dx / 2 - (aimX)) setToY = math.abs(dy / 2 - aimY) local a1, a2, a3 = getPedBonePosition(Ped, 6) local a4, a5, a6 = getElementPosition(Ped) local b1, b2, b3 = getElementPosition(localPlayer) local dist = getDistanceBetweenPoints3D(a1, a2, a3, b1, b2, b3) -- here if isRifle then aimX = dx * 0.54 + (10 - dist * 0.2) -- maybe you will need to play around with 10 or *0.2 to get the right result. else aimX = dx * 0.54 end setToX, setToY = getWorldFromScreenPosition(sx - setToX, sy + setToY, dist) _, _, setToX1 = getWorldFromScreenPosition(dx / 2, dy / 2, dist) _, _, setToX2 = getWorldFromScreenPosition(aimX, aimY, dist) setToX3 = (setToX2 - setToX1) setCameraTarget(setToX, setToY, b3 - setToX3 + 0.2 + (a6 - b3)) end function drawStuff() if getControlState("aim_weapon") then AimOnPosition() end end addEventHandler("onClientRender", root, drawStuff) I want this to be a command for players on my server, help me
-
local x,y,z = getElementPosition( getLocalPlayer ()) local Ped = createPed(49,x,y,z) local dx,dy = guiGetScreenSize() aimX ,aimY = dx*0.54 , dy*0.3971 function AimOnPosition() local setToX,setToY = 0,0 local hx, hy, hz = getPedBonePosition(Ped, 6) local sx,sy = getScreenFromWorldPosition(hx,hy,hz) setToX = math.abs(dx/2-(aimX)) setToY = math.abs(dy/2-aimY) local a1,a2,a3 = getPedBonePosition(Ped, 6) local a4,a5,a6 = getElementPosition(Ped) local b1,b2,b3 = getElementPosition(localPlayer) local dist = getDistanceBetweenPoints3D(a1,a2,a3,b1,b2,b3) -- here if isRifle then aimX = dx*0.54 + (10 - dist*0.2) -- maybe you will need to play around with 10 or *0.2 to get the right result. else aimX = dx*0.54 end setToX,setToY = getWorldFromScreenPosition(sx-setToX,sy+setToY,dist) _,_,setToX1 = getWorldFromScreenPosition(dx/2,dy/2,dist) _,_,setToX2 = getWorldFromScreenPosition(aimX,aimY,dist) setToX3 = (setToX2 - setToX1) setCameraTarget(setToX,setToY,b3-setToX3+0.2 +(a6-b3)) end function drawStuff() if getControlState("aim_weapon") then AimOnPosition() end end addEventHandler("onClientRender", root, drawStuff) how can you do it for the players