Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. Depends on the method, for the most part, youtube links all have the video name in the web page name. This is mine (Kinda old, but still works): Server addCommandHandler('ls',function(player,cmd,url) local url = url:gsub("www.", "") local url = url:gsub("https://", "") local url = url:gsub("http://", "") if string.find(url:lower(), "youtube.com") then local url = url:gsub('youtube.com','') local url = url:gsub('/watch%?v%=','') if string.find(url,'%&list%=') then outputChatBox('#ff0000youtube playlists are not allowed!',player,255,255,255,true) return end outputChatBox('sending '..url) triggerClientEvent(root,'LoadClientSong',resourceRoot,getPlayerName(player), url) else outputChatBox('#ff0000Please use a youtube song!',player,255,255,255,true) end end) Client local x,y = guiGetScreenSize() local browser = createBrowser(x,y,false,false) local currentSong = '' local Player = '' local newTitle = '' local text = 'Random Crappy Text' local g_Font = dxCreateFont('hvrom.otf',15,false,"antialiased") local scale = 10 local maxW = x*0.1 local w = dxGetTextWidth(text,scale,g_Font) while w > maxW do scale = scale - 0.01 local w = dxGetTextWidth(text, scale, g_Font) if w < maxW then break end end addEvent('LoadClientSong',true) addEventHandler('LoadClientSong',root,function(player,url) if browser then Player = player local newURL = 'https://youtube.com/embed/'..url..'?autoplay=1' loadBrowserURL(browser,newURL) outputChatBox('loading '..newURL) currentSong = newURL end end) addEventHandler('onClientBrowserNavigate',root,function(url) if source == browser then if url ~= currentSong then outputChatBox('unallowed!') cancelEvent() end end end) local start = getTickCount() addEventHandler('onClientRender',root,function() dxDrawImageSection(x*0.5,y*0.75 + (y*0.2)*0.15,x*0.2,(y*0.2)*0.85,0,y*0.05,x,y*0.85,browser) local title = getBrowserTitle(browser) if title ~= newTitle then newTitle = title local width = dxGetTextWidth(title.." ",1*scale,g_Font) target = nil target = dxCreateRenderTarget(width, dxGetFontHeight(1*scale,g_Font),true) targetX,targetY = width,dxGetFontHeight(1*scale,g_Font) outputChatBox(targetX*10) start = getTickCount() end if title then if target then dxSetRenderTarget(target) dxSetBlendMode('modulate_add') dxDrawRectangle(0,0,targetX,targetY,tocolor(0,0,0,255)) dxDrawText(' ' ..title,0,0,targetX,targetY,tocolor(255,255,255,255),1*scale,g_Font) dxSetRenderTarget() dxSetBlendMode('add') local now = getTickCount() local p = (now-start)/(targetX*100) if p >= 1 and p < 2 then p = 0 elseif p >= 2 then start = getTickCount() end local calx = p*targetX local calx2 = x*0.2 if calx >= targetX - x*0.2 then calx2 = targetX - calx end dxDrawRectangle(x*0.5,y*0.95,x*0.2,y*0.05,tocolor(0,0,0,255)) dxDrawImageSection(x*0.5,y*0.95,calx2,targetY,calx,0,calx2,targetY,target) dxSetBlendMode('blend') end if Player and Player ~= '' then dxDrawText(' Player: '..Player:gsub('#%x%x%x%x%x%x',''),x*0.5,y*0.965,x,y,tocolor(255,255,255,255),1*scale,g_Font) end end end)
  2. I'm working out an IA which will control a helicopter, and mostly will just keep its rotation within the angles specified. So far said IA does fine when rotation is applied and height, keeping the helicopter suprisingly quiet. However, whenever i add any angle to the X or Y axis.. it works fine for the first.. 3 seconds? then the rotation axis of Y kicks in and it goes to whatever number and the maths no longer check out. (When the Y axis is flipped the X axis is affected aswell) so i'd like to know how can i properly keep them stable in a 0-360 basis.. and not have them flipping arround whenever another axis alternates (Why is this even a thing?!) Greetz.
  3. I found the issue. It was quite a dumb mistake.
  4. While it probably works, it doesnt apply to my case. It checks if anything is in the missile path, but if an object is moving and enters the path after it was fired, it wouldnt work. I.e. It doesnt take into consideration the target's movement.
  5. .:HyPeX:.


    I think id need to run tests, but i belive this should work due to how lua works.
  6. TL;DR, this script calculates two objects and their trajectory and checks if they intersect in any given point, however, it just works sometimes... and sometimes it doesnt. As you can see, the code DOES work, since it creates a marker where it is expected to hit the target (Where the collision warning was triggered), however, i'm able sometimes to just hit the target with my missiles flawlessly and the warning wont trigger. http://i.imgur.com/ha7hS6r.jpg EDIT: Some more images here and here . Script: local pos = localPlayer.position local veh = createVehicle(411, pos.x + 10, pos.y, pos.z) setElementFrozen(veh,true) function calculateTrajectory(Object1,Object2,time) local p = {} p[1] = Vector3(Object1.position) p[2] = Vector3(Object2.position) local v = {} v[1] = (Vector3(Object1.velocity) * 50) v[2] = (Vector3(Object2.velocity) * 50) for i=1, math.floor(time/50) do local time = time + i * 50 local nP = {} nP[1] = p[1] + ((v[1]) * (time/1000)) nP[2] = p[2] + ((v[2]) * (time/1000)) d = nP[1] - nP[2] if (math.abs(d.x) > 20) or (math.abs(d.y) > 20) or (math.abs(d.z) > 20) then else outputChatBox(math.abs(d.x) .. " " .. math.abs(d.y).. " "..math.abs(d.z)) end if math.abs(d.x) < 5 and math.abs(d.y) < 5 and math.abs(d.z) < 5 then outputChatBox("Collision warning!") createMarker(nP[1],"corona",4,255,0,0) return end end end addEventHandler("onClientProjectileCreation",root,function() calculateTrajectory(source,veh,getProjectileCounter(source)) outputChatBox('projectile',255,0,0) end) PD: i know there should be a correct formula for calculating this, bear with my lazyness to make it with a loop.
  7. I dont remember (It was over a year ago rofl), but on the new VPS i got this on i didnt have to touch anything and it worked fine. Probably that old one wasnt well set up?
  8. Values are correctly set, so far discovered its some sort of shader issue, 255,0,0 RGB will be red, 255,75,75 will turn blank
  9. Well, for some reason my shaders wont have the colors assigned.. script: dY = -5.3499999046326 dX = -4.4745998382568 Colors = { {255,75,75}, {75,255,75}, {75,75,255}, {255,255,255}, {0,0,0}, {255,255,75}, {255,75,255} } Shaders = {} for i=1,#Colors do Shaders[i] = dxCreateShader("colorShader.fx") local r,g,b = unpack(Colors[i]) --local r,g,b = tostring(r),tostring(g),tostring(b) dxSetShaderValue(Shaders[i],"r",r,g,b,1) dxSetShaderValue(Shaders[i],"g",r,g,b,1) dxSetShaderValue(Shaders[i],"b",r,g,b,1) dxSetShaderValue(Shaders[i],"a",r,g,b,1) end function test() local x,y,z = getElementPosition(localPlayer) local x,y,z = x,y+5,z-1 for i=1, #Colors do local obj = createObject(1697,x + dX*(i-1),y,z,32,0,0) engineApplyShaderToWorldTexture ( Shaders[i], "solar_panel_1", obj ) end end addEventHandler('onClientResourceStart',resourceRoot,function() test() end) Shader: // // tex_names.fx // float Time : TIME; float4 r; float4 g; float4 b; float4 a; //----------------------------------------------------------------------------- // Techniques //----------------------------------------------------------------------------- technique tec0 { pass P0 { MaterialAmbient = r; MaterialDiffuse = g; MaterialEmissive = b; MaterialSpecular = a; AmbientMaterialSource = Material; DiffuseMaterialSource = Material; EmissiveMaterialSource = Material; SpecularMaterialSource = Material; ColorOp[0] = SELECTARG1; ColorArg1[0] = Diffuse; AlphaOp[0] = SELECTARG1; AlphaArg1[0] = Diffuse; Lighting = true; } } Result: (Even there's a cyan shader, but there is no cyan color made? wtf? http://imgur.com/sR3JyEx.png
  10. Well ive struggled with text quality for a while now and ive found something weird: Shaders increase text quality. Now, what i want to know is how big the performance impact is. And for those wondering, do a simple try, draw a text into a render target and then place the render target as a texture of the simple shader example. Then proceed to draw both the render and the shader, and the shader will have better quality. (In fact increasing the shader sub pixel increases the quality even a bit more, tho is barely noticeable). So anyone has an idea of how bad the performance impact is of doing this?
  11. Okay, so i got this working, but for some reason i get very big FPS drops on the first 1-4 loops (starting over), and this affects me becouse i just wanna draw one loop of out if, any idea on this? PD: Just checked, this thingie makes the GTA process go from 800mb to 1800mb RAM usage
  12. And i'm telling you i'm not using them.
  13. I'm not, i looked at them and asked a friend to make something similar, EPG's files are meant to use patters wich i do not want to. But, yeah becouse someone is using a similar shader name tag they're using your files, right?
  14. Indeed ill try that. Btw, amazing login
  15. Well i tried loading a WebM video wich on my VLC player players softly at 60fps, ingame CEF somehow makes it look laggy, like if it was at 30 fps.. any idea on this? Original:
  16. So i tried, and apparently the shader @hite affects this, but i think this is rather a bug, becouse @hite is not the specified shader, i mean, before i managed to make it work using the 'map' texture, but not it does not work anymore and i dont know why. Probably the vehicle dff and txd corrupted?
  17. I'm using the infernus (411) and the texture 'map'. The texture 'map' is returned when i use the function engineGetModelTextureNames.
  18. Well, the custom texture i'm wanting to replace is visible when i use the function to get the model textures, however, when i use the engineApplyshaderToWorldTexture the texture is not replaced. Even more funny, if i use the "?*" to apply shaders, the texture i want to replace is replaced.. I tried going to the middle of nowhere with the vehicle (freeze + setelementposition) and these were the "visible" texture names: @hite bfori cloudhigh cloudmasked collisionsmoke coronastar custom_car_plate fist font1 font2 plateback3 radar_centre radar_north radardisc seabd32 shad_car unnamed vehicledash32 vehiclegeneric256 vehiclelights128 vehiclesteering128 vehicletyres128 waterclear256
  19. When a player leaves his car is still left there sometimes, what function should i be checking for? destruction derby mode btw.
  20. Oh yeah, just noticed that anyways, now i've no idea how to get my database info into this place here, how could i do so? Tried using the
  21. Thats why im saying its a only one theme, the christmas one is just a palette wich changes forums colors and doesnt have any possibility to edit code itself.
  22. Are you using default theme? There is no other theme..
  23. I tried to add <li class='ipsResponsive_hidePhone ipsType_break'> Server Monitor 2.0 </li> But after clicking on save and reloading a topic page, there isnt any change visible, do i need to reload from somewhere else to see changes?
  • Create New...