ShayF

Members
  • Content count

    163
  • Joined

  • Last visited

  • Days Won

    1

ShayF last won the day on January 11

ShayF had the most liked content!

Community Reputation

38 Good

2 Followers

About ShayF

  • Rank
    Busta

Details

  • Gang
    Grove
  • Location
    Grove St
  • Occupation
    Drifting
  • Interests
    Scripting

Recent Profile Visitors

938 profile views
  1. [Help]Moving camera

    local camera = createCamera(0,0,0) setElementPosition(camera,1,1,1) Tadaa
  2. Smooth moving health bar

    Yes, you set the progress bar progress to the players health, like I showed.. of course it doesn't have borders around it, but you can add borders in the self.draw function.
  3. [Help] DX Centering

    show me example that is tested to work.
  4. [Help] DX Centering

    dont worry about the debug errers i took care of dem, i just cant get the dam thing centered under the hud with custom width calculated by text length.
  5. [Question] New IDs to objects

    Uh I wouldn't because a lot of id's are used, uh you would have to grab 2 id's and swap them, or use 5 digits. But uh, good bro.
  6. [Help] DX Centering

    I want to center the dx elements in a certain space via math with text length and max text length. Here is my code as well as a picture to show its status. local messagesList = { '----------- Coming Soon!', 'Visit the site! http://---------/', 'Let your voice be heard! http://---------/forum/', 'READ F9!' } local sx,sy = guiGetScreenSize() local sw,sh = 1360,768 local currentMessage = 1 function dxRect(...) arg[1],arg[2],arg[3],arg[4] = arg[1]/sw*sx,arg[2]/sh*sy,arg[3]/sw*sx,arg[4]/sh*sy return dxDrawRectangle(unpack(arg)) end function dxText(...) arg[2],arg[3],arg[4],arg[5],arg[7] = arg[2]/sw*sx,arg[3]/sh*sy,(arg[4]+arg[2])/sw*sx,(arg[5]+arg[3])/sh*sy,(arg[7] or 1)/sw*sx return dxDrawText(unpack(arg)) end addEventHandler('onClientPreRender',root,function() local width = dxGetTextWidth(messagesList[currentMessage]) dxRect(1068-8,107,width+16,21,tocolor(0,0,0,192),false) dxText(messagesList[currentMessage],1068,107,width,21,tocolor(0,255,255,255),1,'default-bold','center','center',false,false,false) end) setTimer(function() if currentMessage ~= #messagesList then currentMessage = currentMessage+1 else currentMessage = 1 end end,5000,0)
  7. Health bar moving backwards

    My code for his other thread that I posted above has everything you'll ever need. If he wants to draw lines around it then he can. My code is Auto relative, he puts in his resolution then positions it and sizes it, it will resize and reposition for other resolutions. He can also change the colors of it. Mainly the progress of the progress bar, which is controlled when player loses health. styles = {} styles['progressBar'] = { ['default'] = { bgColor = tocolor(0,0,0,180), barColor = tocolor(255,255,255,200), textColor = tocolor(255,0,0,255) } } local sx,sy = guiGetScreenSize() local sw,sh = 1360,768-- Change this to your resolution and use absolute values when creating elements. local draw = {} local validTypes = {'progressBar'} function dxRect(...) arg[1],arg[2],arg[3],arg[4] = arg[1]/sw*sx,arg[2]/sh*sy,arg[3]/sw*sx,arg[4]/sh*sy return dxDrawRectangle(unpack(arg)) end function dxText(...) arg[2],arg[3],arg[4],arg[5],arg[7] = arg[2]/sw*sx,arg[3]/sh*sy,(arg[4]+arg[2])/sw*sx,(arg[5]+arg[3])/sh*sy,(arg[7] or 1)/sw*sx return dxDrawText(unpack(arg)) end function dx(type,theme,x,y,w,h,visible) for i=1,#validTypes do if type == validTypes[i] then local self = {} self.type = type self.x = x or 0 self.y = y or 0 self.w = w or 0 self.h = h or 0 self.style = styles[self.type][theme] or styles[self.type]['default'] self.visible = visible or true self.destroy = function() for i=1,#draw do if draw[i] == self then table.remove(draw,i) end end end return self end end return false end function dxCreateProgressBar(text,x,y,w,h) local self = dx('progressBar','default',x,y,w,h,true) if self then self.progress = 0 local pbText = text self.draw = function() dxRect(self.x,self.y,self.w,self.h,self.style.bgColor) if string.find(pbText,'%progress%',1,true) then pbText = string.gsub(pbText,'%progress%',tostring(math.floor(self.progress))..'%') end dxText(pbText,self.x,self.y,self.w,self.h,self.style.textColor) dxRect(self.x,self.y,(self.w/100)*self.progress,self.h,self.style.barColor) end table.insert(draw,self) return self end end addEventHandler('onClientRender',root,function() for i=1,#draw do if draw[i].visible then draw[i].draw() end end end) local progressBar = dxCreateProgressBar('Health %progress%',500,500,600,200)-- create a progress bar like this setTimer(function() local health = getPlayerHealth(localPlayer)-- if its 100 then use it, if its 200 then divide it by 2 if getPlayerMaxHealth(localPlayer) > 100 then health = health/2 end progressBar.progress = health -- then set the progress end,50,0) -- you can also set colors like this progressBar.style.barColor = tocolor(255,0,0,200) progressBar.style.bgColor = tocolor(255,255,255,160)
  8. Health bar moving backwards

    I posted code that may help here, please do not make multiple threads here.
  9. Smooth moving health bar

    styles = {} styles['progressBar'] = { ['default'] = { bgColor = tocolor(0,0,0,180), barColor = tocolor(255,255,255,200), textColor = tocolor(255,0,0,255) } } local sx,sy = guiGetScreenSize() local sw,sh = 1360,768-- Change this to your resolution and use absolute values when creating elements. local draw = {} local validTypes = {'progressBar'} function dxRect(...) arg[1],arg[2],arg[3],arg[4] = arg[1]/sw*sx,arg[2]/sh*sy,arg[3]/sw*sx,arg[4]/sh*sy return dxDrawRectangle(unpack(arg)) end function dxText(...) arg[2],arg[3],arg[4],arg[5],arg[7] = arg[2]/sw*sx,arg[3]/sh*sy,(arg[4]+arg[2])/sw*sx,(arg[5]+arg[3])/sh*sy,(arg[7] or 1)/sw*sx return dxDrawText(unpack(arg)) end function dx(type,theme,x,y,w,h,visible) for i=1,#validTypes do if type == validTypes[i] then local self = {} self.type = type self.x = x or 0 self.y = y or 0 self.w = w or 0 self.h = h or 0 self.style = styles[self.type][theme] or styles[self.type]['default'] self.visible = visible or true self.destroy = function() for i=1,#draw do if draw[i] == self then table.remove(draw,i) end end end return self end end return false end function dxCreateProgressBar(text,x,y,w,h) local self = dx('progressBar','default',x,y,w,h,true) if self then self.progress = 0 local pbText = text self.draw = function() dxRect(self.x,self.y,self.w,self.h,self.style.bgColor) if string.find(pbText,'%progress%',1,true) then pbText = string.gsub(pbText,'%progress%',tostring(math.floor(self.progress))..'%') end dxText(pbText,self.x,self.y,self.w,self.h,self.style.textColor) dxRect(self.x,self.y,(self.w/100)*self.progress,self.h,self.style.barColor) end table.insert(draw,self) return self end end addEventHandler('onClientRender',root,function() for i=1,#draw do if draw[i].visible then draw[i].draw() end end end) local progressBar = dxCreateProgressBar('Health %progress%',500,500,600,200)-- create a progress bar like this setTimer(function() local health = getPlayerHealth(localPlayer)-- if its 100 then use it, if its 200 then divide it by 2 if health > 100 then health = health/2 end progressBar.progress = health -- then set the progress end,50,0) -- you can also set colors like this progressBar.style.barColor = tocolor(255,0,0,200) progressBar.style.bgColor = tocolor(255,255,255,160) This is a bit of code from my dx library, maybe it'll help ya.
  10. Smooth moving health bar

    setTimer is not a good way to do it, it's different if you are using the default hud or your own. Best way to do it is using increments (maybe decimals) in the onClientRender event that changes the health to what it's suppose to be but using a slow motion, animation like movement.
  11. Help with custom chat commands

    You can make it do what you want.
  12. [Help] Vehicle Collision || Destroy

    local vehicle = getPedOccuipiedVehicle(localPlayer) for i,v in pairs(getElementsByType('vehicle')) do setElementCollidableWith(vehicle,v,false) end This code is an example on client side, it will disable collision between vehicles, this works as like a ghostmode type script.
  13. [Help] Vehicle Collision || Destroy

    Disabling collision to a vehicle will prevent anything colliding with it, even the world. What you'd want to do is set what it can collide with, other vehicles, players, obects etc.. Using setElementCollidableWith()
  14. question

    Using API's with fetchRemote is the best way to use website services like youtube or gmail. However these API's need keys, you get keys from registering yourself up to use the api and it will give you a key. It's not that difficult to use an api with fetchRemote either, you can send the api information and the fetch remote will grab any info that the api sends back. However with fetchRemote things are not instant, they are fast but not instant. So you don't want to grab things from fetch remote until you know for sure it's finished uploading and downloading that data. I hope that I have helped you. Good luck.
  15. [HELP] Freeroam GUI

    Recreate the entire script either with gui or dx. The main script is way too complicated to edit. best of luck mate.