Jump to content

arezu

Members
  • Posts

    446
  • Joined

  • Last visited

Everything posted by arezu

  1. arezu

    Gravity Problem

    isVehicleOnGround doesn't work with all vehicles, and wont work on non-flat ground (walls, loops etc).
  2. getPedAnimation only returns the current playing animation block and animation name, not these: time: float - duration of the animation start_time: float - starting point finished: boolean - has animation finished playing? i tested it anyways and wiki was correct on getPedAnimation, so it didn't work.
  3. The only problem is at getPedAnimationData! i can see the ped at the position i set it and with the animation i set it to, no problem there, but getPedAnimationData is the only thing that doesn't work
  4. It's because getPedAnimationData is a Clientside function. In your xml file you should add: type="client" Example: I am 110% sure that the problem is caused by that. Without the "type="client"", the script will run as a serverside script. it is : , otherwise it would say error on 'getLocalPlayer()' too
  5. It says: attempt to call global 'getPedAnimationData' (a nil value).. here is how i tried it: local x, y, z = getElementPosition(getLocalPlayer()) local npc = {} npc.shop = {} npc.shop.ped = createPed(171, x + 3, y + 5, z) setPedAnimation(npc.shop.ped, "BAR", "Barserve_loop", -1, true, false, true, false) local name, block_name, loop, update_position, iterruptible, time, start_time, finished = getPedAnimationData(npc.shop.ped) does it exist, but wiki is outdated and the function has different arguments?
  6. obvious troll is obvious, TAPL's code copied. no, he removed the "type" from file node
  7. You dont need to restart server. Just stop the resource then delete from http-client-files and then /refresh and start the resource again.
  8. onMapStarting is a custom event so you need to add; addEvent too. But since you are never killing the timer, you dont need to put it inside that event. function setTheCarColors( ) local endteam = getTeamFromName( "END#" ) for i, car in ipairs( getElementsByType( "vehicle" ) ) do local theplayer = getVehicleOccupant( car ) local nowteam = getPlayerTeam( theplayer ) if theplayer then if(nowteam == endteam) then setVehicleColor(car, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) end end end end addEvent("onVehColorChange",true) addEventHandler("onVehColorChange",getRootElement(),setTheCarColors) setTimer(setTheCarColors,500,0)
  9. download the latest one. The previous ones are bugged. it "cant" be bugged because its the one im using in my server
  10. I made it and published it now to public: training script: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3667 carfade: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3668 I didn't really have time to test it so i dont know if it will work 100% ... Im sure some people are mad at me for publishing it.
  11. there are many ways. Here are some examples: processLineOfSight, isLineOfSightClear, onClientVehicleCollision or colshapes.
  12. local currentSound and currentSound is not the same thing. If you use local inside a function, then it will only exist inside that function so do this.. (look up, i edit it) I just made currentSound a global variable instead
  13. so i guess you are trying to play random sound after the current one stops.. use a more natural way then: local rand = musicURL[math.random(#musicURL)] local currentPlayingMusic = playSound(rand, false) addEventHandler("onClientElementDestroy", getRootElement(), function () if(source == currentPlayingMusic)then local rand = musicURL[math.random(#musicURL)] currentPlayingMusic = playSound(rand, false) end end)
  14. mta wiki says that the key (setElementData(player, key, value)) can only have a max value of 31 characters.
  15. why dont you use a "loop" then? easiest way to detect, isn't it? -- or 1 in case it fails, but probably wont happen local dim = getElementDimension(getLocalPlayer()) or 1 addEvent("onClientPlayerDimensionChange", true) addEventHandler("onClientPlayerDimensionChange", getRootElement(), function(dimension) outputChatBox("Dimension changed to: "..dimension) end) addEventHandler("onClientRender", getRootElement(), function() local _dim = getElementDimension(getLocalPlayer()) if(_dim ~= dim)then dim = _dim triggerEvent("onClientPlayerDimensionChange", getLocalPlayer(), _dim) end end)
  16. arezu

    Custom camera.

    use processLineOfSight and if hit, get the hit position and set the camera position as that position
  17. remove illegal characters from resource folder name (like spaces)
  18. isVehicleOnGround does only work when you are on a somewhat flat ground and not with all vehicles
  19. if you are looking for id of an object, you can use map editor and select world object
  20. arezu

    drawColor

    here's a copy of mine: dxText = {} dxText_mt = { __index = dxText } local idAssign,idPrefix = 0,"c" local g_screenX,g_screenY = guiGetScreenSize() local visibleText = {} ------ local defaults = { fX = 0.5, fY = 0.5, bRelativePosition = true, strText = "", bVerticalAlign = "center", bHorizontalAlign = "center", tColor = {255,255,255,255}, fScale = 1, strFont = "default", strType = "normal", tAttributes = {}, bPostGUI = false, bClip = false, bWordWrap = true, bVisible = true, tBoundingBox = false, --If a bounding box is not set, it will not be used. bRelativeBoundingBox = true, } local validFonts = { default = true, ["default-bold"] = true, clear = true, arial = true, pricedown = true, bankgothic = true, diploma = true, beckett = true, } local validTypes = { normal = true, shadow = true, border = true, stroke = true, --Clone of border } local validAlignTypes = { center = true, left = true, right = true, } function dxText:create( text, x, y, relative ) assert(not self.fX, "attempt to call method 'create' (a nil value)") if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then outputDebugString ( "dxText:create - Bad argument", 0, 112, 112, 112 ) return false end local new = {} setmetatable( new, dxText_mt ) --Add default settings for i,v in pairs(defaults) do new[i] = v end idAssign = idAssign + 1 new.id = idPrefix..idAssign new.strText = text or new.strText new.fX = x or new.fX new.fY = y or new.fY if type(relative) == "boolean" then new.bRelativePosition = relative end visibleText[new] = true return new end function dxText:text(text) if type(text) ~= "string" then return self.strText end self.strText = text return true end function dxText:position(x,y,relative) if not tonumber(x) then return self.fX, self.fY end self.fX = x self.fY = y if type(relative) == "boolean" then self.bRelativePosition = relative else self.bRelativePosition = true end return true end function dxText:color(r,g,b,a) if not tonumber(r) then return unpack(self.tColor) end g = g or self.tColor[2] b = b or self.tColor[3] a = a or self.tColor[4] self.tColor = { r,g,b,a } return true end function dxText:scale(scale) if not tonumber(scale) then return self.fScale end self.fScale = scale return true end function dxText:visible(bool) if type(bool) ~= "boolean" then return self.bVisible end self.bVisible = bool if bool then visibleText[self] = true else visibleText[self] = nil end return true end function dxText:destroy() self.bDestroyed = true setmetatable( self, self ) return true end function dxText:extent() local extent = dxGetTextWidth ( self.strText, self.fScale, self.strFont ) if self.strType == "stroke" or self.strType == "border" then extent = extent + self.tAttributes[1] end return extent end function dxText:height() local height = dxGetFontHeight ( self.fScale, self.strFont ) if self.strType == "stroke" or self.strType == "border" then height = height + self.tAttributes[1] end return height end function dxText:font(font) if not validFonts[font] then return self.strFont end self.strFont = font return true end function dxText:postGUI(bool) if type(bool) ~= "boolean" then return self.bPostGUI end self.bPostGUI = bool return true end function dxText:clip(bool) if type(bool) ~= "boolean" then return self.bClip end self.bClip = bool return true end function dxText:wordWrap(bool) if type(bool) ~= "boolean" then return self.bWordWrap end self.bWordWrap = bool return true end function dxText:type(type,...) if not validTypes[type] then return self.strType, unpack(self.tAttributes) end self.strType = type self.tAttributes = {...} return true end function dxText:align(horzA, vertA) if not validAlignTypes[horzA] then return self.bHorizontalAlign, self.bVerticalAlign end vertA = vertA or self.bVerticalAlign self.bHorizontalAlign, self.bVerticalAlign = horzA, vertA return true end function dxText:boundingBox(left,top,right,bottom,relative) if left == nil then if self.tBoundingBox then return unpack(boundingBox) else return false end elseif tonumber(left) and tonumber(right) and tonumber(top) and tonumber(bottom) then self.tBoundingBox = {left,top,right,bottom} if type(relative) == "boolean" then self.bRelativeBoundingBox = relative else self.bRelativeBoundingBox = true end else self.tBoundingBox = false end return true end addEventHandler ( "onClientRender", getRootElement(), function() for self,_ in pairs(visibleText) do while true do if self.bDestroyed then visibleText[self] = nil break end local l,t,r,b --If we arent using a bounding box if not self.tBoundingBox then --Decide if we use relative or absolute local p_screenX,p_screenY = 1,1 if self.bRelativePosition then p_screenX,p_screenY = g_screenX,g_screenY end local fX,fY = (self.fX)*p_screenX,(self.fY)*p_screenY if self.bHorizontalAlign == "left" then l = fX r = fX + g_screenX elseif self.bHorizontalAlign == "right" then l = fX - g_screenX r = fX else l = fX - g_screenX r = fX + g_screenX end if self.bVerticalAlign == "top" then t = fY b = fY + g_screenY elseif self.bVerticalAlign == "bottom" then t = fY - g_screenY b = fY else t = fY - g_screenY b = fY + g_screenY end elseif type(self.tBoundingBox) == "table" then local b_screenX,b_screenY = 1,1 if self.bRelativeBoundingBox then b_screenX,b_screenY = g_screenX,g_screenY end l,t,r,b = self.tBoundingBox[1],self.tBoundingBox[2],self.tBoundingBox[3],self.tBoundingBox[4] l = l*b_screenX t = t*b_screenY r = r*b_screenX b = b*b_screenY end local type,att1,att2,att3,att4,att5 = self:type() if type == "border" or type == "stroke" then att2 = att2 or 0 att3 = att3 or 0 att4 = att4 or 0 att5 = att5
  21. arezu

    drawColor

    use the same dxDrawColoredText function as you did before, and it should work:) (i did it when i uploaded that function and it worked) and only replace the line which i said, because the other lines is for shadow.
  22. arezu

    drawColor

    i dont think thats the problem, i think you can write "left" without parantheses in lua.. its just that dxDrawColoredText is a "void" function that doesn't return anything, and the one killmessages use is a custom dx library. go to killmessages/utils/textlib.lua and go to line 272 and change that dxDrawText to dxDrawColoredText instead.
  23. check the installation here: https://wiki.multitheftauto.com/wiki/Mysql
  24. the reason for that could be that you change ped camera rotation when you press a or d, and whats the points of that if you want point and walk?? if you want the ped to ignore your keyboard input (for whatever reason you made one), then in your setTransformedPosition calculate rotation from ped to destination and setPedCameraRotation
×
×
  • Create New...