-
Posts
1,255 -
Joined
-
Last visited
.:HyPeX:.'s Achievements
Lil' G (37/54)
2
Reputation
-
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)
-
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.
-
I found the issue. It was quite a dumb mistake.
-
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.
-
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.
-
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?
-
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
-
Shader is float4, check
-
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
-
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?
-
Good idea, i'll try that!
-
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
-
And i'm telling you i'm not using them.
-
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?