Jump to content

Chaos

Members
  • Posts

    299
  • Joined

  • Last visited

Everything posted by Chaos

  1. Well, i know how to attach it with normal function such as dxDrawImage but this kind complicated to me
  2. Hi, i was messing with dxDrawGifImage function on wiki and it works good but how can i attach it on element like this https://wiki.multitheftauto.com/wiki/File:DxDrawImageOnElement.png function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, startID = iStart, imgID = iStart, imgType = iType, speed = effectSpeed, tick = getTickCount ( ) }, false ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do local gifData = getElementData ( gif, "gifData" ) if ( gifData ) then if ( currentTick - gifData.tick >= gifData.speed ) then gifData.tick = currentTick gifData.imgID = ( gifData.imgID + 1 ) if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then gifData.imgID = gifData.imgID setElementData ( gif, "gifData", gifData, false ) else gifData.imgID = gifData.startID setElementData ( gif, "gifData", gifData, false ) end end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) end end end )
  3. it works great thanks a lot
  4. Actually that's the code i posted
  5. it's still the same nothing has changed http://image.prntscr.com/image/f14f5945dae24f908d27600a081e9d7a.png
  6. Hi, i'm trying to draw DX Rectangle and fit it with all screen resolutions but i can't figure what's wrong with rectangle it seems doesn't fit, here's the code : local sWidth, sHeight = guiGetScreenSize() local sx, sy = sWidth/1280, sHeight/720 addEventHandler("onClientRender", root, function() dxDrawRectangle(sx*506, sy*616, sx*297, sy*76, tocolor(0, 0, 0, 133),true) dxDrawText("Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false) end ) as you can see here it's fine with res 1280 * 720 http://image.prntscr.com/image/402d0c42b10341c2be6bc64d90498aca.png and here with res 800 * 600 http://image.prntscr.com/image/24f660b05d2243a6916d4d42d392bf96.png
  7. triggerServerEvent ("penzhp", getLocalPlayer())
  8. Chaos

    Vehicle's name

    The source of the event is the vehicle that the player entered. Try this function carName () local vehicleName = getVehicleName ( source ) dxDrawText ( vehicleName , 320, 380+115, 2500, 150, tocolor ( 255, 255, 255, 255 ), 1.5, "bankgothic" ) end addEventHandler( "onClientVehicleEnter", getRootElement(), carName )
  9. Chaos

    Bot issue

    Hi, so i tried to make change in slothbot script that Bot could use Rocket launcher but the problem is when he shoots on ground or nearby he'll die and message appears as a player has killed him, how can i fix this kind of issue ? function mon (killer) if killer and killer ~= source and isElement( killer ) and getElementType(killer) == "player" then if source == Nemesis then outputChatBox ("[NEMESIS-ANNOUNCEMENT] "..getPlayerName(killer):gsub('#%x%x%x%x%x%x', '').." has killed a Nemesis.",root,0,255,0) end end boss() end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), mon )
  10. check this one made by xXMADEXx https://community.multitheftauto.com/in ... ls&id=7330
  11. hi, i have a question how do i get max days of a month like this month has 31 max day ?
  12. hi, i got problem with this code, i'm trying to get ID from event name but it seems not working and every time it gives random number and the event names is containing space any idea? addEvent('nextEventVoteResult') addEventHandler('nextEventVoteResult', getRootElement(), function(eventName) local eventID = getIDFromEventName(eventName) outputChatBox(eventID,root) end ) function getIDFromEventName(eventName) for i,v in ipairs(events) do if v.name == eventName then return i end end return false end
  13. Rly thanks. working One more question. How I can add here blowVehicle? after setElementPosition. function warent ( posX, posY, posZ ) for i ,v in ipairs (getElementsByType("player")) do if getElementData(v,"state") == "alive" then local vehicles = getPedOccupiedVehicle ( v ) if vehicles then setElementPosition ( vehicles, 200, 150, 15 ) blowVehicle(vehicles) end end end end bindKey("enter","down",warent)
  14. try something like that function warent ( posX, posY, posZ ) for i ,v in ipairs (getElementsByType("player")) do if getElementData(v,"state") == "alive" then local vehicles = getPedOccupiedVehicle ( v ) if vehicles then setElementPosition ( vehicles, 200, 150, 15 ) end end end end bindKey("enter","down",warent)
  15. Chaos

    events issue

    Thanks a lot Saml1er
  16. Chaos

    events issue

    Last code it worked fine. Last question how can i convert time to mins and secs like 300000 mili secs to 4:59 > 4:58 ... and times should including zero beside one number 4:09 > 4:08...
  17. Chaos

    events issue

    fair enough but i made a script for quit is that will working fine? function onQuit() local c = EventCore.GetPlayersInEvent ( ) if ( #c == 1 ) then for i, v in pairs ( c ) do EventCore.WinPlayerEvent ( v ) break end end end
  18. Chaos

    events issue

    hi, i have issue with events sometimes when last player standing the reward will give both last one and another one was dead before or the same player himself in event like: in dm event it had 2 winners someone called Lesly ( the last standing) and another one called samsulee who died at 5th place reward will give to them both in the same time can i set timer or something can fix this, any idea ? function thisEventFunctions.OnPlayerWasted ( _, killer ) local plrs = EventCore.GetPlayersInEvent ( ) local winner = nil if ( table.len ( plrs ) == 0 ) then winner = source elseif ( table.len ( plrs ) == 1 ) then for i, v in pairs ( plrs ) do winner = v end end if winner then EventCore.WinPlayerEvent ( winner ) end end addEventHandler ( "onPlayerWasted", root, thisEventFunctions.OnPlayerWasted )
  19. Hi, i got stuck on script. I'm trying to make a command out put position as sequentially so when first time i do /count should out put the first position which is -2390,-2199,33,296 and when i do it again should out put second one and continue as like that, any idea ? warpPoses = { {-2390,-2199,33,296}, {-2389,-2200,33,296}, {-2389,-2202,33,296}, {-2388,-2203,33,296}, {-2387,-2205,33,296}, {-2386,-2206,33,296}, {-2390,-2207,33,296}, {-2391,-2206,33,296}, {-2392,-2204,33,296}, {-2393,-2203,33,296}, {-2393,-2201,33,296}, {-2395,-2199,33,296}, {-2397,-2202,33,296}, {-2396,-2204,33,296}, {-2395,-2206,33,296}, {-2394,-2207,33,296}, {-2393,-2209,33,296}, {-2397,-2209,33,296}, {-2399,-2207,33,296}, {-2400,-2204,33,296} } function table.len ( tb ) local c = 0 for i, v in pairs ( tb ) do c = c + 1 end return c end function test() local x, y, z, r = unpack ( warpPoses [ ( table.len ( warpPoses ) ) ] ) outputChatBox(x..","..y..","..z..","..r,root) end addCommandHandler("count",test)
  20. directly trigger it triggerClientEvent(source,"gridlist",source,nick)
  21. why do you store it in table ?
  22. Chaos

    Killed by

    onPlayerWasted Check Wiki for more information.
×
×
  • Create New...