Search the Community
Showing results for tags 'bug'.
-
Hi! I have a problem with my DX script. I made a DX screen that gets the items in a table and display it on the rectangle The problem is, it's multiplying everything that is related with the text. This is how the issue looks in game, look at the rectangle with the texts, it's multiplying everything! And here is my code: ------------------------------------------------------- local itemList = { {"Wooden Wall"}, {"Wooden Doorway"}, {"Wooden Window"}, {"Wooden Floor"}, {"Wooden Floorport"}, {"Wooden Stairs"}, {"Wooden Fence"}, {"Wooden Door"}, {"Wooden Gate"}, {"Metal Wall"}, {"Metal Doorway"}, {"Metal Window"}, {"Metal Floor"}, {"Metal Floorport"}, {"Metal Stairs"}, {"Metal Fence"}, {"Metal Door"}, {"Metal Gate"}, {"Concrete Wall"}, {"Concrete Doorway"}, {"Concrete Window"}, {"Concrete Floor"}, {"Concrete Floorport"}, {"Concrete Stairs"}, {"Concrete Fence"}, {"Reinforced Door"}, {"Reinforced Gate"}, } ------------------------------------------------------- function returnTableCount (tab) count = 1 if ( getLocalPlayer() ) then for i,item in ipairs(tab) do if ( item ) then count = count + 1 end end return count end return false end ------------------------------------------------------- local totalRows = returnTableCount(itemList) local iRows = totalRows local iVisibleRows = 20 local iCurrentCell = 0 ------------------------------------------------------- local screenWidth,screenHeight = guiGetScreenSize() local screenW, screenH = guiGetScreenSize() local sx,sy = guiGetScreenSize() local px,py = 1366,768 local x,y = (sx/px), (sy/py) ------------------------------------------------------- function isCursorOverRectangle(x,y,w,h) if isCursorShowing() then local mx,my = getCursorPosition() cursorx,cursory = mx*px,my*py if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true end end return false end function drawInventory () if ( getElementData(getLocalPlayer(),"viewingInv") ) then titleTable = dxDrawRectangle(x*050, y*040, x*350, y*45, tocolor(0, 77, 126, 170), false) titleText = dxDrawText("Building",x*060, y*055, x*250, y*30,tocolor(255,255,255, 255)) mainTable = dxDrawRectangle(x*050, y*090, x*350, y*640, tocolor(0, 0, 0, 170), false) for i,item in ipairs(itemList) do for ki = iCurrentCell, iVisibleRows+iCurrentCell-1 do visibleI = ki - iCurrentCell dxDrawRectangle(x*050+x*350, y*090+y*640/iRows*iCurrentCell, 5, y*640/iRows*iVisibleRows) itemBackground = dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 0, 0, 200), false) itemText = dxDrawText(item[1],x*070, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) --Problem is here :C useBackground = dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) useText = dxDrawText("Text",x*282, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) dropBackground = dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 0, 0, 200), false) dropText = dxDrawText("Text",x*347, y*107+visibleI*31, x*250, y*30,tocolor(255,255,255, 255)) if isCursorOverRectangle(x*060, y*100+visibleI*31, x*200, y*30) or isCursorOverRectangle(x*265, y*100+visibleI*31, x*60, y*30) or isCursorOverRectangle(x*330, y*100+visibleI*31, x*60, y*30) then dxDrawRectangle(x*060, y*100+visibleI*31, x*200, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*265, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) dxDrawRectangle(x*330, y*100+visibleI*31, x*60, y*30, tocolor(0, 77, 126,20)) end end end end end addEventHandler("onClientRender",getRootElement(),drawInventory) function rustCraftScrollUp () if ( getElementData(getLocalPlayer(),"viewingInv") ) then if isCursorOverRectangle(x*050, y*090, x*350, y*640) then iCurrentCell = iCurrentCell - 1 if iCurrentCell < 0 then iCurrentCell = 0 end end end end bindKey("mouse_wheel_up","down",rustCraftScrollUp) function rustCraftScrollDown () if ( getElementData(getLocalPlayer(),"viewingInv") ) then if isCursorOverRectangle(x*050, y*090, x*350, y*640) then iCurrentCell = iCurrentCell + 1 if iCurrentCell > iRows-iVisibleRows then iCurrentCell = iRows-iVisibleRows end end end end bindKey("mouse_wheel_down","down",rustCraftScrollDown) function showInventory () if ( getElementData(getLocalPlayer(),"viewingInv") ) then setElementData(getLocalPlayer(),"viewingInv",false) showCursor(false) showChat(true) else setElementData(getLocalPlayer(),"viewingInv",true) showCursor(true) showChat(false) end end bindKey("k","down",showInventory) How can I get the items in that table 'itemList' and put it in the screen that the dxGridList works without multiplying those stuff? I hope you guys undestand my problem :v pls help
-
Hello guys,i got a problem which annoys me for a while,i wanna change font of my custom radio script,but when i change it the font looks small and its just a default font,not the 1 i choose,PLS HELP! lol i forgot heres the settigns.xml of the custom radio script <settings> <color r="255" g="255" b="255"/> <font>sa-header</font> <realism enabled="false"/> <stations> <station name="The Beat" URL="http://listen.181fm.com/181-beat_64k.aac"/> <station name="181 FM" URL="http://listen.181fm.com/181-party_64k.aac"/> <station name="The Vibe of Vegas" URL="http://listen.181fm.com/181-vibe_64k.aac"/> <station name="Power 181" URL="http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls"/> <station name="Star 90's" URL="http://relay.181.fm:8012/"/> <station name="Awesome 80's" URL="http://relay.181.fm:8000/"/> <station name="Rock 181" URL="http://listen.181fm.com/181-rock_64k.aac"/> <station name="UK Top 40" URL="http://listen.181fm.com/181-uktop40_64k.aac"/> </stations> </settings> client.lua local xml = xmlLoadFile ( "settings.xml" ) local nodeColor = xmlFindChild ( xml, "color", 0 ) local nodeFont = xmlFindChild ( xml, "font", 0 ) local nodeRealism = xmlFindChild ( xml, "realism", 0 ) local nodeStations = xmlFindChild ( xml, "stations", 0 ) local label = guiCreateLabel ( 0, 0, 1, 0.1, "Radio Off", true ) guiLabelSetColor ( label, xmlNodeGetAttribute ( nodeColor, "r" ), xmlNodeGetAttribute ( nodeColor, "g" ), xmlNodeGetAttribute ( nodeColor, "b" ) ) guiLabelSetHorizontalAlign ( label, "center" ) guiSetFont ( label, xmlNodeGetValue ( nodeFont ) ) guiSetVisible ( label, false ) addEventHandler ( "onClientResourceStart", getResourceRootElement (), function () setPlayerHudComponentVisible ( "radio", false ) setElementData ( getLocalPlayer (), "liveradio.radio", 0 ) for k, v in ipairs ( getElementsByType ( "vehicle" ) ) do setElementData ( v, "liveradio.radio0", false ) setElementData ( v, "liveradio.radio1", false ) setElementData ( v, "liveradio.radio2", false ) setElementData ( v, "liveradio.radio3", false ) end end ) addEventHandler ( "onClientResourceStop", getResourceRootElement (), function () setPlayerHudComponentVisible ( "radio", true ) end ) addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer (), function ( vehicle, seat ) setRadioChannel ( 0 ) setElementData ( getLocalPlayer (), "liveradio.seat", seat ) if sound then if isElement ( sound ) then destroyElement ( sound ) end end if xmlNodeGetAttribute ( nodeRealism, "enabled" ) == "true" then if getElementData ( vehicle, "liveradio.radio0" ) then setElementData ( getLocalPlayer (), "liveradio.radio", getElementData ( vehicle, "liveradio.radio0" ) ) else for k, v in ipairs ( xmlNodeGetChildren ( nodeStations ) ) do setElementData ( getLocalPlayer (), "liveradio.radio", k ) end setElementData ( getLocalPlayer (), "liveradio.radio", math.random ( getElementData ( getLocalPlayer (), "liveradio.radio" ) ) ) setElementData ( vehicle, "liveradio.radio0", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( vehicle, "liveradio.radio1", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( vehicle, "liveradio.radio2", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( vehicle, "liveradio.radio3", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) end else if getElementData ( vehicle, "liveradio.radio" .. seat ) then setElementData ( getLocalPlayer (), "liveradio.radio", getElementData ( vehicle, "liveradio.radio" .. seat ) ) else for k, v in ipairs ( xmlNodeGetChildren ( nodeStations ) ) do setElementData ( getLocalPlayer (), "liveradio.radio", k ) end setElementData ( getLocalPlayer (), "liveradio.radio", math.random ( getElementData ( getLocalPlayer (), "liveradio.radio" ) ) ) setElementData ( vehicle, "liveradio.radio" .. seat, getElementData ( getLocalPlayer (), "liveradio.radio" ) ) end end local nodeStation = xmlFindChild ( nodeStations, "station", getElementData ( vehicle, "liveradio.radio" .. seat ) - 1 ) if nodeStation then local radioName = xmlNodeGetAttribute ( nodeStation, "name" ) local radioURL = xmlNodeGetAttribute ( nodeStation, "URL" ) sound = playSound ( radioURL ) guiSetText ( label, radioName ) guiSetVisible ( label, true ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) else guiSetText ( label, "Radio Off" ) guiSetVisible ( label, true ) setElementData ( getLocalPlayer (), "liveradio.radio", 0 ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) end timerVehicle = setTimer ( function ( vehicle ) if isPedInVehicle ( getLocalPlayer () ) == false or getPedOccupiedVehicle ( getLocalPlayer () ) ~= vehicle or getElementHealth ( getLocalPlayer () ) <= 0 then if sound then if isElement ( sound ) then destroyElement ( sound ) end end killTimer ( timerVehicle ) guiSetVisible ( label, false ) setElementData ( getLocalPlayer (), "liveradio.radio", 0 ) end end , 50, 0, vehicle ) end ) addEventHandler ( "onClientPlayerRadioSwitch", getLocalPlayer (), function ( station ) if station ~= 0 then cancelEvent () end if xmlNodeGetAttribute ( nodeRealism, "enabled" ) ~= "true" or getElementData ( getLocalPlayer (), "liveradio.seat" ) == 0 or getPedOccupiedVehicle ( getLocalPlayer () ) == false then if station == 1 then setElementData ( getLocalPlayer (), "liveradio.radio", getElementData ( getLocalPlayer (), "liveradio.radio" ) + 1 ) elseif station == 12 then setElementData ( getLocalPlayer (), "liveradio.radio", getElementData ( getLocalPlayer (), "liveradio.radio" ) - 1 ) if getElementData ( getLocalPlayer (), "liveradio.radio" ) == -1 then for k, v in ipairs ( xmlNodeGetChildren ( nodeStations ) ) do setElementData ( getLocalPlayer (), "liveradio.radio", k ) end end end if sound then if isElement ( sound ) then destroyElement ( sound ) end end if getPedOccupiedVehicle ( getLocalPlayer () ) then setElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio" .. getElementData ( getLocalPlayer (), "liveradio.seat" ), getElementData ( getLocalPlayer (), "liveradio.radio" ) ) end local nodeStation = xmlFindChild ( nodeStations, "station", getElementData ( getLocalPlayer (), "liveradio.radio" ) - 1 ) if nodeStation then local radioName = xmlNodeGetAttribute ( nodeStation, "name" ) local radioURL = xmlNodeGetAttribute ( nodeStation, "URL" ) sound = playSound ( radioURL ) guiSetText ( label, radioName ) guiSetVisible ( label, true ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) else guiSetText ( label, "Radio Off" ) guiSetVisible ( label, true ) setElementData ( getLocalPlayer (), "liveradio.radio", 0 ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) end if xmlNodeGetAttribute ( nodeRealism, "enabled" ) == "true" and getPedOccupiedVehicle ( getLocalPlayer () ) then setElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio0", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio1", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio2", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) setElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio3", getElementData ( getLocalPlayer (), "liveradio.radio" ) ) triggerServerEvent ( "onPlayerRadioSwitch", getLocalPlayer (), getPedOccupiedVehicle ( getLocalPlayer () ) ) end end end ) addEventHandler ( "onClientVehicleStartExit", getRootElement (), function ( player ) if player == getLocalPlayer () then if sound then if isElement ( sound ) then destroyElement ( sound ) end end if isTimer ( timerVehicle ) then killTimer ( timerVehicle ) end guiSetVisible ( label, false ) setElementData ( player, "liveradio.radio", 0 ) end end ) addEvent ( "switchRadioChannel", true ) addEventHandler ( "switchRadioChannel", getLocalPlayer (), function () if sound then if isElement ( sound ) then destroyElement ( sound ) end end local nodeStation = xmlFindChild ( nodeStations, "station", getElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio0" ) - 1 ) if nodeStation then local radioName = xmlNodeGetAttribute ( nodeStation, "name" ) local radioURL = xmlNodeGetAttribute ( nodeStation, "URL" ) sound = playSound ( radioURL ) guiSetText ( label, radioName ) guiSetVisible ( label, true ) setElementData ( getLocalPlayer (), "liveradio.radio", getElementData ( getPedOccupiedVehicle ( getLocalPlayer () ), "liveradio.radio0" ) ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) else guiSetText ( label, "Radio Off" ) guiSetVisible ( label, true ) setElementData ( getLocalPlayer (), "liveradio.radio", 0 ) if isTimer ( timerLabel ) then killTimer ( timerLabel ) end timerLabel = setTimer ( guiSetVisible, 5000, 1, label, false ) end end ) server.lua addEvent ( "onPlayerRadioSwitch", true ) addEventHandler ( "onPlayerRadioSwitch", getRootElement (), function ( vehicle ) for k, v in ipairs ( getElementsByType ( "player" ) ) do if getPedOccupiedVehicle ( v ) == vehicle and v ~= source then triggerClientEvent ( v, "switchRadioChannel", v ) end end end )
-
i have this code: addEvent( "eszakirablas", true ) addEventHandler( "eszakirablas", root, function (thePlayer) if ( idozito [ thePlayer ] ~= nil ) then outputChatBox ( "#01AC41[SuperFun] #FFffFFA következő széfrablásig várnod kell #01AC41".. math.floor ( getTimerDetails ( idozito [ thePlayer ] ) / 60000+1 ) .." percet.", thePlayer, 255, 0, 0, true ); else setElementFrozen(thePlayer, true) setPedAnimation(thePlayer , "rob_bank", "cat_safe_rob", 10000, true, true, true, false) setTimer(setElementFrozen,10000,1,thePlayer,false) randomM = math.random(500000,1500000) setTimer(function() givePlayerMoney(thePlayer,randomM) end,10000,1) setTimer(outputChatBox, 10000,1,"#01AC41[SuperFun] #FFffFFÖsszesen raboltál #01AC41"..randomM.." #ffffffforintot.",thePlayer,255,255,255,true) setTimer(outputChatBox, 900000, 1,"#01AC41[SuperFun - #8C8C8CÉszaki] #FFffFFAz #01AC41északin #FFffFFújra kirabolhatod a széfet! #01AC41(/eszaki)",thePlayer,255,255,255,true) setTimer(Boltrablas,900000,1) idozito [ thePlayer ] = setTimer ( function ( thePlayer ) idozito [ thePlayer ] = nil; end, 900000, 1, thePlayer); end end ) and when the animation stop, and i change my skin, start off the animation.. how to fix this bug??
-
i added this line to a nametag script: if isChatBoxInputActive() then dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, "logo.png" ) end but when i press 't', the image show in all players nametag.. how to fix this?
-
So I am making a vehicle shop system. I want some vehicles to have changed handling when they spawn. There's a problem, 'cause a 'for loop' that sets handlings isn't executed. I don't know what could cause this. Here's the code: local vehSale = {} vehSale["premier"] = {426, 2000, {}} vehSale["blista-compact"] = {496, 2400, {}} hdl_blista_compact_rwd = {} hdl_blista_compact_rwd["driveType"] = "rwd" hdl_blista_compact_rwd["mass"] = 1040 vehSale["blista-compact-rwd"] = {496, 2800, hdl_blista_compact_rwd} hdl_blista_sport = {} hdl_blista_sport["driveType"] = "rwd" hdl_blista_sport["mass"] = 1100 hdl_blista_sport["engineAcceleration"] = 12.8 hdl_blista_sport["engineInertia"] = 4 hdl_blista_sport["collisionDamageMultiplier"] = 0.55 hdl_blista_sport["steeringLock"] = 35 vehSale["blista-sport"] = {496, 4500, hdl_blista_sport} function buyVehicle(source, cmdName, vName) if not vehSale[vName] then outputChatBox("There is no such vehicle for sale", source) return false end if getPlayerMoney(source) < vehSale[vName][2] then outputChatBox("You don't have money for that", source) return false end local veh = createVehicle(vehSale[vName][1], 0, 0, 0) spawnVehicle(veh, -1706, 13, 5) for k, v in ipairs(vehSale[vName][3]) do print(k) setVehicleHandling(veh, k, v) end setPlayerMoney(source, getPlayerMoney(source)-vehSale[vName][2]) outputChatBox("Vehicle bought", source) end addCommandHandler("buy", buyVehicle) So I made a table (vehSale) where I put all avaliable cars. Under key premier at 1st index is vehicle ID, 2nd - price, 3rd - Handlings to change. I wrote a function that lets players buy vehicles. It's named buyVehicle(). First it checks if vehicle is avaliable and if player can afford it. Next it spawns vehicle at San Fierro docks and then applies handling. And that part of code doesn't work. After loop subtracts player money and outputs "Vehicle bought". Anything but that loop does work. I tried this code at the beggining of program: for k, v in ipairs(getOriginalHanling(496)) do print(k) print(v) end And this doesn't work too. Man, f*ck this. I've just changed ipairs() to pairs() and ANYTHING is WORKING. Lol
-
After R4 (build 11428) - Updated 16th June 2017 when delete LS CIty hall, object delete not correct.
-
I have been trying to bindkeys to a command clientside and save them inside a xml file. But the mta binding cache is stacking up. Keys: 'x', 'u', 'x' See screenshot bellow. The problem shows up when you edit the bindkey in the settings menu and load the xml file after saving it. To use the bindkeys, you have to bind it with any key on your keyboard. To know which bindkeys are bound to a command with your previous visit, you have to bind any key of your keyboard to that command in order to use: getBoundKeys / getKeyBoundToCommand If you use unbindKey, it will unbind the command for all other keys, but not remove it from the cache. And another problem, I can't remove keys/'alternative keys' from the cache unless I click on the 'Load defaults button on the right bottom'. This is the code I have been testing with:
-
I have a bug on my server. The Rhinos have an extra wheel, In Grand Theft Auto San Andreas , When you write HESOYAM this wheel appears and in appearsMTA it always, I was researching and I did not find anything about this since I had two options, Download a model that has no wheels but use the Rhino Tracks cleo or disappear the extra wheel, For obvious reasons I preferred to disappear the extra wheel but still I have not found how to do it help me pls. (#)
-
now the radar "move" but... not the way I want it bug video: this is the code: local movingOffsetX, movingOffsetY = 0, 0 local isMoving = false bindKey('m', 'down', function() showCursor(not isCursorShowing()); end ) function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then if (isCursorShowing() and isMoving) then local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * sx; cursorY = cursorY * sy; xFactor = cursorX - movingOffsetX; yFactor = cursorY - movingOffsetY; end local mW, mH = dxGetMaterialSize(rt) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxSetRenderTarget(rt, true) if alwaysRenderMap or getElementInterior(localPlayer) == 0 then dxDrawRectangle(xFactor, yFactor, worldW, worldH, 0xFF5E656B) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (184)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255)) local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*yFactor local cX, cY = (rB+lB)/2, (tB+bB)/2 +(35)*yFactor local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, bB-cY for k, v in ipairs(getElementsByType("blip")) do local bx, by = getElementPosition(v) local actualDist = getDistanceBetweenPoints2D(x, y, bx, by) local maxDist = getBlipVisibleDistance(v) if actualDist <= maxDist and getElementDimension(v)==getElementDimension(localPlayer) and getElementInterior(v)==getElementInterior(localPlayer) then local dist = actualDist/(6000/((worldW+worldH)/2)) local rot = findRotation(bx, by, x, y)-camZ local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.min(dist, math.sqrt(toTop^2 + toRight^2)), rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local bid = getElementData(v, "customIcon") or getBlipIcon(v) local _, _, _, bcA = getBlipColor(v) local bcR, bcG, bcB = 255, 255, 255 if getBlipIcon(v) == 0 then bcR, bcG, bcB = getBlipColor(v) end local bS = getBlipSize(v) dxDrawImage(bpx -(blip*bS)*xFactor/2, bpy -(blip*bS)*yFactor/2, (blip*bS)*xFactor, (blip*bS)*yFactor, "image/blip/"..bid..".png", 0, 0, 0, tocolor(bcR, bcG, bcB, bcA)) end end if renderNorthBlip then local rot = -camZ+180 local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.sqrt(toTop^2 + toRight^2), rot) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case dxDrawImage(bpx -(blip*2)/2, bpy -(blip*2)/2, blip*2, blip*2, "image/blip/4.png", 0, 0, 0) --draw north (4) blip end end dxDrawImage(cX -(blip*2)*xFactor/2, cY -(blip*2)*yFactor/2, (blip*2)*xFactor, (blip*2)*yFactor, "image/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, drawRadar) addEventHandler('onClientClick', getRootElement(), function(button, state, cursorX, cursorY) if (not isPlayerMapVisible()) then if (button == 'left' and state == 'down') then if (cursorX >= xFactor and cursorX <= xFactor + worldW and cursorY >= yFactor and cursorY <= yFactor + worldH) then isMoving = true; movingOffsetX = cursorX - xFactor; movingOffsetY = cursorY - yFactor; end else isMoving = false; end end end ) how to fix this bug?
-
function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] end end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Sometimes working the "asay xy" cmd, sometimes not working. How to fix this bug?
- 26 replies
-
- bug
- interesting
- (and 10 more)
-
Hi, i have problem, when i play long on server i can see rainbow ped model on screen and then game crashes.
-
i have this script, and does not update online players number, why? local online = #getElementsByType("player") local messagesList = { online.."/30", "SF", } local currentMessage = 0 addEventHandler("onClientPreRender", getRootElement(), function() local online = #getElementsByType("player") dxDrawText(messagesList[currentMessage + 1], screenW * 0.6014+3, screenH * 0.9656+3, screenW * 0.6556, screenH * 0.9978, tocolor(0, 0, 0, 255), 2.20, "default-bold", "center", "bottom", false, false, false, false, false) dxDrawText(messagesList[currentMessage + 1], screenW * 0.6014, screenH * 0.9656, screenW * 0.6556, screenH * 0.9978, tocolor(255, 255, 255, 255), 2.20, "default-bold", "center", "bottom", false, false, false, false, false) end ) function updateMessage() if (currentMessage == 1) then currentMessage = 0 else currentMessage = currentMessage + 1 end end setTimer(updateMessage, 2000, 0)
-
Hey community, I need some help. I host my server Today and everything was perfect. Then restart my server and there was a problem. For your information I have all the ports activated and verified, the firewall allows it A friend wanted to enter my server and could not. My server was not listed on the Internet. Right now I do not know what to do. I hope you can help me. In mtaserver.conf everything is perfect, try to verify it with another problem of another user and still not working. Thanks
-
function findPlayer(name) local matches = {} for i,v in ipairs(getElementsByType("player")) do if getPlayerName(v) == name then return v end local playerName = getPlayerName(v):gsub("#%x%x%x%x%x%x", "") playerName = playerName:lower() if playerName:find(name:lower(), 0) then table.insert(matches, v) end end if #matches == 1 then return matches[1] end return false end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("#FFffFF Átutaltál neki: #c8c8c8" .. getPlayerName(target) .. " #0088ff" .. amount .. " Forintot.", player, 0, 255, 0, true) outputChatBox("#c8c8c8 " .. getPlayerName(player) .. " #FFffFFutalt neked #0088ff" .. amount .. " Forintot.", target, 0, 255, 0, true) else outputChatBox("#FFffFF Nincs elég pénzed.", target, 255, 0, 0, true) end end end ) why can i 'pay' minus amount? how to fix this?
-
my client: function coronaa() triggerServerEvent ("szoveg", root, getLocalPlayer()) end addEventHandler ( "onClientMarkerHit", ajtomegilyenek, coronaa ) and the server: addEvent( "szoveg", true ) addEventHandler( "szoveg", root, function(thePlayer) outputChatBox("Text", thePlayer, r,g,b, true) end) how to fix this?
-
Help me pls, i need your help. i dont know where's the problem. pls man function playerDropAItem(itemName) local x,y,z = getElementPosition(source) local item,itemString = getItemTablePosition(itemName) local itemPickup = createItemPickup(item,x+math.random(-1.25,1.25),y+math.random(-1.25,1.25),z,itemString) end addEvent( "playerDropAItem", true ) <export function="playerDropAItem" type="server" />
-
Necesito ayuda!!!! Alguién podria ser TAN AMABLE de decirme o enseñarme como puedo hacer que cuando dentro de mi server (Day-Z) monto la famosa (TENT O TIENDA DE CAMPAÑA) ésta no se aleje tanto del personaje al igual que cuando la desmonto. Ósea, mi intención es usar las tent o tienda de campaña para colocarla en la pared y luego retirarla sin que se pierda dentro de la pared. Estuve revisando los archivos del (Dayz) login y el survivorSystem.lua Y en login encontré esto que fué lo que más me llamo la ATENCIÓN: tent = createObject(3243, getAccountData(tentData, "last_x"), getAccountData(tentData, "last_y"), getAccountData(tentData, "last_z"), 0, 0, getAccountData(tentData, "last_rz") or 0) setObjectScale(tent, 1.3) tentCol = createColSphere(getAccountData(tentData, "last_x"), getAccountData(tentData, "last_y"), getAccountData(tentData, "last_z"), 4) attachElements(tentCol, tent, 0, 0, 0) setElementData(tentCol, "parent", tent) setElementData(tent, "parent", tentCol) setElementData(tentCol, "tent", true) setElementData(tentCol, "vehicle", true) setElementData(tentCol, "MAX_Slots", 100) for i, data in ipairs(vehicleDataTable) do setElementData(tentCol, data[1], getAccountData(tentData, data[1])) end end end --------------------------------------------------------------------- Yen el survivorSystem.lua encontré esto: function onPlayerPitchATent(itemName) setElementData(source, itemName, getElementData(source, itemName) - 1) setPedAnimation(source, "BOMBER", "BOM_Plant", -1,false,false,false,false) local source = source setTimer(function() local x, y, z = getElementPosition(source) local xr, yr, zr = getElementRotation(source) px, py, pz = getElementPosition(source) prot = getPedRotation(source) local offsetRot = math.rad(prot + 90) local vx = px + 5 * math.cos(offsetRot) local vy = py + 5 * math.sin(offsetRot) local vz = pz + 2 local vrot = prot + 180 tent = createObject(3243, vx, vy, z - 1, 0, 0, vrot) setObjectScale(tent, 1.3) tentCol = createColSphere(x, y, z, 4) attachElements(tentCol, tent, 0, 0, 0) setElementData(tentCol, "parent", tent) setElementData(tent, "parent", tentCol) setElementData(tentCol, "tent", true) setElementData(tentCol, "vehicle", true) setElementData(tentCol, "MAX_Slots", 100) triggerClientEvent(source, "refreshInventoryManual", source) end, 1500, 1) end ------------------------------------------------------------------------------ No se si me explico, pero deseo saber cúal de los dos debo editar para que cuando monte una (tienda de campaña-tent) no se me aleje del personaje y quede en la misma posición que el personaje, así puedo "bugearla" dentro de la pared y luego desmontarla. Como el server THE LONE SURVIVOR, que tienen esa misma configuracón.. MUCHAS GRACIAS PORL EER ESTO ESPERO ME AYUDES ME HARÁS FELIZ!!!!
- 8 replies
-
- tent
- tienda de campaña
-
(and 2 more)
Tagged with:
-
Hey guys. Im a developer of a roleplay server and some players can duplicate items by lagging their internet. How can i fix this problem? Maybe i should use: getNetworkStats but i dont know which value goes up when they have lag. Thx for help!
-
Hello, When I try To Connect to a Server It Shows Me a Message Says "To Join this server you must update MTA" But i Already Have The Latest Version Of Game I tried to Reinstall The Game, but still The Same Problem. Please! Tell me How to solve this Problem. Photos Of The Problem
-
Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.