Advertisement
FL1K3R

cursor.lua (client side script for CitizenMP) v2.0 (FINAL)

Jan 11th, 2015
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. -- put this code in your gamemode folder and don`t forget add 'cursor.lua' in your '__resource.lua'
  2. -- MOUSE CURSOR SCRIPT BY M.V.
  3. --------[ GLOBALS ] -----
  4. mousedrw = 0                -- mousedrw- is mouse drawing
  5. mouseloaded = 0             -- mouseloaded - is mouse TXD loaded
  6. mousex, mousey = 0.0,0.0            -- default position (the left-top corner of the screen)
  7.  
  8. scalex, scaley = 0.1000, 0.2500 -- change this scale x and y from types from below
  9. -- 0.1000, 0.2500 - huge cursor
  10. -- 0.1000, 0.1200 - norm cursor
  11. -- 0.0500, 0.0700 - mini cursor
  12. -------------------------
  13. function LoadCursor()
  14.     if mousedrw == 0 then
  15.         cursortxd = LoadTxd('computer')
  16.         curstexture = GetTexture(cursortxd, 'mousepointer')
  17.         mousedrw = 1
  18.     end
  19. end
  20.  
  21. function UnLoadCursor()
  22.     if mousedrw == 1 then
  23.         ReleaseTexture(curstexture)
  24.         RemoveTxd(cursortxd)
  25.         mousedrw = 0
  26.     end
  27. end
  28.  
  29. function CursorInZone(zonex, zoney, zonex1, zoney1)
  30.     if mousedrw == 1 and mousex > zonex and mousex < zonex1 and mousey > zoney and mousey < zoney1 then
  31.         return true
  32.     else
  33.         return false
  34.     end
  35. end
  36.  
  37. CreateThread(function()           --key pressing and texture drawing
  38.     while true do
  39.         Wait(0)
  40.         if mousedrw == 1 then
  41.             if mousex > 0.999 then
  42.                 mousex = 0.999
  43.             end
  44.             if mousey > 0.999 then
  45.                 mousey = 0.999
  46.             end
  47.             mousex, mousey = GetMousePosition(_f,_f)
  48.             DrawSprite( curstexture, mousex, mousey, scalex, scaley, 0.0, 255, 255, 255, 255)  
  49.         end
  50.         if IsGameKeyboardKeyJustPressed(76) then -- SCANCODE_KEYPAD5
  51.             if mouseloaded == 0 then
  52.                 LoadCursor()
  53.                 mouseloaded = 1
  54.             elseif mouseloaded == 1 then
  55.                 UnLoadCursor()
  56.                 mouseloaded = 0
  57.             end
  58.         end
  59.     end
  60. end)
  61. -- End Of File - :D  Just like scilled programmers write       
  62. -- script v1.2
  63. -- 1.1: bug with bottom and left side of the screen is fixed))
  64. -- 1.2: added CursorInZone(x,y,x1,y1)
  65. -- 2.0: fixed completely all bugs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement