Jump to content

drk

Members
  • Posts

    1,607
  • Joined

  • Last visited

Everything posted by drk

  1. \õ/ I want to made a script that appear on the local player screen with percentage of distance missing to reach hunter. Understand?
  2. I want to turn this distance between two points: function drawDistance ( ) local x, y, sx, sy loadHunterPosition ( ) local playerX, playerY, playerZ = getElementPosition ( getLocalPlayer( ) ) -- Get player position local distFromVehicleToHunter = getDistanceBetweenPoints3D ( playerX, playerY, playerZ, hunterX, hunterY, hunterZ ) -- Calculate distance x, y = AbsoluteToRelativ(1920-721, 1080-55) sx, sy = AbsoluteToRelativ( 1920-515,1080-36 ) dxDrawText (" Distance:",x, y, sx, sy,tocolor(192,255,62,255),0.6,"bankgothic","left","top",false,false,false) -- Create DX Text x, y = AbsoluteToRelativ(1920-699, 1080-31) sx, sy = AbsoluteToRelativ( 265, 30 ) dxDrawImage( x, y, sx, sy,"images/DistToHunter-Logo.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) x, y = AbsoluteToRelativ(1920-494, 1080-54) sx, sy = AbsoluteToRelativ( 1920-366,800-10 ) dxDrawText( string.format("%.0f",distFromVehicleToHunter).."m",x, y, sx, sy,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,false) end into a percentage. It can be done? If it can be done anyone can help me how to do
  3. drk

    Why don't work?

    Aww .... Ok. Thanks for helping.
  4. drk

    Why don't work?

    LOL dont need # ?
  5. drk

    Why don't work?

    What u have changed ? Nothing ? Code is correct?
  6. drk

    Why don't work?

    Anyone can help and say to me if this code is correct: function getAliveCount () aliveAmount = 0 for i,v in ipairs (getAlivePlayers()) do aliveAmount = aliveAmount +1 end return aliveAmount end function rewardIfWin(source) local alive = getAliveCount() local money = getElementData ( source, 'Money' ) if ( isPedDead(source) ~= false ) and ( alive == 1 ) then grana = math.random ( 100, 2000 ) setElementData ( source, 'Money', money+#grana ) outputChatBox ( "#ABCDEF* #ffffffYou gain #00ff00" .. tostring(grana) .. "$ for winning the deathmatch !", source, 255, 255, 255, true ) end end function ifPlayerQuitSaveTheMoney(source) saveTheMoney = executeSQLInsert ( 'Money', getElementData ( source, 'Money' ) ) if ( type (saveTheMoney) == 'table' and #saveTheMoney == 1 ) then outputDebugString (getPlayerName(source) .. " money saved in SQL database.") end end addEventHandler ( "onPlayerQuit", getRootElement(), ifPlayerQuitSaveTheMoney )
  7. drk

    Why don't work?

    Hey, now it worked, SciTE has some bugs
  8. drk

    Why don't work?

    Now, I get this error: ERROR: server.lua:8: attempt to call global 'getThisResource' (a nil value) In debug I get: stack traceback: server.lua:8: in main chunk [C]: ? quitting debugger Line 8 is local gRR_Element = getResourceRootElement(getThisResource())
  9. drk

    Why don't work?

    -- money / points reward function reward() getPlayerWithSerial = executeSQLSelect( 'Money', 'player_serial', 'player_serial = "' .. getPlayerSerial() ..'"' ) if ( type (getPlayerWithSerial) == 'table' and #getPlayerWithSerial == 0 ) or not getPlayerWithSerial then setElementData ( source, 'Money', "0" ) else getMoneyFromPlayer = executeSQLSelect ( 'Money', 'money', 'money = "' .. getMoneyFromThePlayer .. '"' ) if ( type (getMoneyFromPlayer) == 'table' and #getMoneyFromPlayer == 1 ) then setElementData ( source, 'Money', getMoneyFromThePlayer ) end end end end '' expected near 'end'. I don't know why it gives me this. I have the four end's to close if, else and the function.
  10. drk

    Why don't work?

    myonlake you saved my life '-' It worked, thanks.
  11. drk

    Why don't work?

    I've tried first getResourceRootElement and don't work. Thanks for trying to help. The complete code is: --[[ -- made by Shick -- credits to -------- for helping -- 22/12/2011 --]] -- getResourceRootElement local gRR_Element = getResourceRootElement(getThisResource()) -- SQL Database function database:SQLTable() executeSQLCreateTable ( 'Money', 'player_serial STRING, money INT' ) executeSQLCreateTable ( 'Points', 'player_serial STRING, points INT' ) addEventHandler('onResourceStart', gRR_Element, database:SQLTable ) -- Dx Scoreboard function scoreboard:addAColumn() call(getResourceFromName('dxscoreboard'), "addScoreboardColumn", "Money") call(getResourceFromName('dxscoreboard'), "addScoreboardColumn", "Points") end addEventHandler('onResourceStart', gRR_Element, scoreboard:addAColumn )
  12. drk

    How to do........

    Finally i've tried with (sres/yres)*sx, (sres/yres)*sy and it worked. ( local sx, sy = guiGetScreenSize() ) Anyone lock this post.
  13. drk

    Why don't work?

    Line 14 wih the complete code, line 14 is line 6 here.
  14. drk

    Why don't work?

    Hey, i've made a point system for my race server but it gives me a error: ERROR: server.lua:14: function arguments expected near ')' The code is: function database:SQLTable() local gRR_Element = getResourceRootElement(getThisResource()) executeSQLCreateTable ( 'Money', 'player_serial STRING, money INT' ) executeSQLCreateTable ( 'Points', 'player_serial STRING, points INT' ) end addEventHandler('onResourceStart', gRR_Element, database:SQLTable )
  15. drk

    How to do........

    Yeaaah, because isn't what I want, what u said in other topics it only work in 1280 x 720.
  16. drk

    How to do........

    Thanks for trying to help, but how it helps?
  17. Hi ! I need help in changing absolute position's to relative. I don't understand how to do this. Example: I have a image and I have absolute position and I want to change absolute to relative to appear in all resolutions. Understand? If anyone want to help me ... If you don't want to help, don't reply please.
  18. OK OK OK OK OK I'm noob! I just posted here the code to help some people and forgot about copyright. Any problems?
  19. LOL, I will not reply to noob's.
×
×
  • Create New...