Overkillz
Members-
Posts
545 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Overkillz
-
@XaskeL Well, I've just understood more less. Assuming that I want to add a rectangle and an image and apply the shader effect to both of them it doesn't work correctly. Its near of reaching the goal, but it does weird things. imagePath is defined. local sX,sY = guiGetScreenSize() local gradientShader = dxCreateShader("files/shader/gradient.fx") local rt1 = dxCreateRenderTarget(sX*0.3, sY*0.05, true) local rt2 = dxCreateRenderTarget(sX*0.3, sY*0.05, true) function drawThings() -- ##RENDER TARGET #1 dxSetRenderTarget(rt1) dxDrawRectangle(0,0,sX*0.3, sY*0.05) dxDrawImage(0,15,sY*0.02,sY*0.02,imagePath) dxDrawImage(0,0,sX*0.3, sY*0.05, gradientShader) dxSetRenderTarget() dxSetShaderValue(gradientShader, "startColor", 207/255, 22/255, 124/255,1) dxSetShaderValue(gradientShader, "endColor", 239/255, 56/255, 48/255,1) dxSetShaderValue(gradientShader, "tex", rt1) -- ##RENDER TARGET #2 dxSetRenderTarget(rt2) dxDrawRectangle(0,0,sX*0.3, sY*0.05) dxDrawImage(0,15,sY*0.02,sY*0.02,imagePath) dxDrawImage(0,0,sX*0.3, sY*0.05, gradientShader) dxSetRenderTarget() dxSetShaderValue(gradientShader, "startColor", 207/255, 22/255, 124/255,1) dxSetShaderValue(gradientShader, "endColor", 239/255, 56/255, 48/255,1) dxSetShaderValue(gradientShader, "tex", rt2) addEventHandler("onClientRender",root,renderThings) end function renderThings() dxDrawImage(sX*0.05,sY*0.1,sX*0.3, sY*0.05, rt1) dxDrawImage(sX*0.05,sY*0.4,sX*0.3, sY*0.05, rt2) end drawThings()
-
@XaskeL Yes, that was a big mistake by me. Anyways, If I want to create mulitple rectangles with different gradient colours, Am I forced to create multiple shaders ? Regards.
-
@XaskeL Thanks, it worked, but ... Now Im trying to merge it with renderTargets and later convert that renderTarget into a texture to later apply the effect. But the draw doesn't take any effect. CODE I really don't know what could be wrong. No errors in debug. Regards.
-
Hello dear community. Im doing some researchs about shaders and I'm trying to applying a grradient effect to the bell photo. But the problem is that I know that I don't know how to apply it to the image. I can create a rectangel by drawing the shader, but applying the effect to the texture ..etc its giving me some troubles. Here is the shader SCRIPT And here it is what I've just reached drawing it. I know I can use HUDMASK script to reach it, but I want to try to simplify the things Thanks for reading. Regards.
-
Thats all what you need (If I didnt forget anything) local theTime = getRealTime() local secondsToAdd = 4500 local timeForPlayer = theTime.timestamp+(secondsToAdd) setAccountData (acc, "time", timeForPlayer ) --Your checker funciton local theTime = getRealTime() if theTime.timestamp > getAccountData(acc,"time") then -- DO WHATEVER YOU WANT end
-
Im not sure about this, but try to use set as gravity 0.8 Btw, Im not understanding what do you really want.
-
Hello dear guys, today I've just got an issue index-ing some values inside a table. More than an issue, its a question. Why Index-ing is not working properly. Sometimes I need to edit the layer-1 (Position 1) and sometimes I need to edit the 15th (Position 15) and might form 2-14 they arre not exists addLayer(1,"arrowdown") addLayer(2,"arrows") addLayer(3,"curve") local tableTest1 = {} function addLayer(slotNo,layerName) if not slotNo or not layerName then return end tableTest1[tonumber(slotNo)] = {name = layerName, active = true} iprint(tableTest1) end I need to keep them in the order that Im adding them to the table. Sometimes the index is visible in the table and idk when I add a layer from client.Lua to addLayerClient.Lua Sometimes even the first index isn't appeared and the rest of them yes. and the structure in this case would be INFO {{ active = true, name = "addowdown" }, [2] = { active = true, name = "whatever" }, [8] = { active = true, name = "whatever2" } I know there are several ways to fix it like adding an id to each table inserted and later use table.sort or things like that, but I would like to know whats wrong with this. I hope you can bring me a hand. Best Regards.
-
If you are trying to add a crosshair in the groun. You can use dxDrawMaterialLine3D() Read carefully the arguments to draw it correctly.
-
Probably getTickCount() Will solve your problem. Just when the "Bomb" reach the point where you want it, get the timer using local startTick = getTickCount() --When the bomb reach the point just get the time local timeVariable = getTickCount() - startTick Regards.
-
@IIYAMA Well, assuming that I will chose the way of dxDrawMaterialLine3D. Will I be forced to use shaders if I want to reach a similar effect for uneven grounds right ?
-
@IIYAMA Yes, the right word woluld be a shadow (But an image as shadow) I have been several Topics around the community and I have been reading that adding a shadow to the COL could solve my problem even more. But could someone tell how do COLS work ? Thanks for answering
-
@Awang @IIYAMA I have been doing some researchs about it and ... Well, I think instead of getGroundPosition() onPlayerContact I could use isLineOfSightClear() Due to what about if the player enter in a vehicle (I want to keep the image) under the car. Also. I have been reading some shaders code which were previously mentioned by Awang and I have seen that all of them have a list of textures added to apply the effect over them. (This might could solve the problem for the uneven grounds) And might the best way to take reference for my goal is to read carefully the code of @Ren_712 The Dynamic Lights Script (https://community.multitheftauto.com/index.php?p=resources&s=details&id=9398) But I have a question. Do Im still needing to use dxDrawMaterialLine3D() to reach the goal ? Might create a texture would be a better option if I just want to draw an image. What do you think about this ? Thanks for reading. Best regards.
-
Hello guys, Im planning to create an script which draw whatever I want(For example an image) under my PED, but when i have been thinking about it a lot of questions came to me. First of all I know that I will have to use shaders to reeach my goal. But here are my main question. How do I get the elements that are under me. I have been thinking for a vehicle with onClientVehicleCollision but i want with the peds. Another question is, what about if Im in the middle of 2 objects like on this image Otherwise, What about if the ped is flying or whatever (It is supossed that he is not touching the ground) so how could I deal with it. I don't know where to start with this, I hope you can bring me a hand. Thanks for reading. Regards.
-
Wasn't aware about it. I thought server side could change it, even if it wasn't created there. Thanks for answering.
-
Hello guys, today I've found an issue on my code that when the map starts, it doesn't remove the vehicle Upgrade server side, but if I do it client side, it works. First of all, I need to tell you that Im creating the vehicle at the server side, but Im giving it the upgrade at client side. Im storing all the player vehicles into a table to identify all of them easily and the format is simple arenaSrv.vehicles[thePlayer] Well, I can rotate, set a new position ...whatever for the vehicle at server side, except, remove that vehicle upgrade (1010) setElementPosition(arenaSrv.vehicles[thePlayer],x,y,z) setElementRotation(arenaSrv.vehicles[thePlayer],0,0,rz) removeVehicleUpgrade(arenaSrv.vehicles[thePlayer], 1010) --THIS IS NOT WORKING I have some events that could solve that problem but I wont extend the code and I would like to know why does it happen. I have ensured that the upgrade is the 1010 and Im not getting any debug message. It is an MTA Bug or something ? Thanks for reading. Regards.
-
@IIYAMA Oh ! Wasn't aware about it. I thought that game elements needed to be like a normal draw (Rendered each frame). Thats are even better news for me respecting the CPU Usage I have the last question. onClientRestore must be present on the code when the player minimize and restore to prevent issues ?
-
Network has sent you a code that is server side. Be aware of that. Otherwise, with a simple comment which says "doesn't work" we can not do anything. You could bring more info about the issue like the debug messages or whatever. Regards.
-
@IIYAMA Yes, its working pretty well, but Im not sure if that its causing the problem about what Im talking at the following lines @Awang Well, basically I have been doing what you have just said. But I have a weird bug. I tried to do a simple (very simple) version of the code. Why the image is being drawn on the car and the screen ? I just want to draw it on the car but, weird ... function loadMain() theVehicle = createVehicle(411,0,0,5) theShader = dxCreateShader("lights.fx") theRenderTarget = dxCreateRenderTarget(960, 540, true) engineApplyShaderToWorldTexture(theShader, "decalmap", theVehicle) drawContentInRT(theRenderTarget) end function drawContentInRT(rt) if rt then dxSetRenderTarget(rt, true) dxDrawImage(480,220,210,210,"img/test1.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage(510,220,210,210,"img/test2.png",0,0,0,tocolor(255,255,255,255)) dxSetRenderTarget() dxSetShaderValue(theShader, "gTexture", rt) addEventHandler("onClientRender",root,renderContent) end end function renderContent() if theRenderTarget then dxDrawImage(0,0,960,540,theRenderTarget,0,0,0,tocolor(255,255,255,255)) end end loadMain() --## SHADER texture gTexture; technique hello { pass P0 { Texture[0] = gTexture; } }
-
Hello guys, today I've just started to work with shaders and renderTargets. I want to draw individually on each rendertarget but my question is: Do I have to create inside the table each shader or create a global one for all of them ? Which one is the best way ? Here is a example about what I say -- METHOD #1 { player = player, shader = dxCreateShader(shaderFile), renderTarget = dxCreateRenderTarget(arg1, arg2, true) } { player = player2, shader = dxCreateShader(shaderFile), renderTarget = dxCreateRenderTarget(arg1, arg2, true) } { player = player3, shader = dxCreateShader(shaderFile), renderTarget = dxCreateRenderTarget(arg1, arg2, true) } -- METHOD #2 globalShader = dxCreateShader(shaderFile) { player = player, renderTarget = dxCreateRenderTarget(arg1, arg2, true) } { player = player2, renderTarget = dxCreateRenderTarget(arg1, arg2, true) } { player = player3, renderTarget = dxCreateRenderTarget(arg1, arg2, true) } Thanks for reading. Regards.
-
Read what I've just told you carefully.
-
You have a good example at the wiki triggerClientEvent Just when the trigger is done. On the client change the variable 'showingImage' to false and that should be enought
-
local showingImage = true function drawContent() if showingImage then dxDrawImage(0,0,300,300,"imageURL.png",0,0,0,tocolor(255,255,255,255)) end end addEventHandler("onClientRender",root,drawContent) To hide it you need to change the variable 'showingImage'. You need another funcition like a bind, command, event or whatever you considere for it. Regards.
-
What are you trying to do ?
-
getSoundFFTData
-
Practically he gave you the whole code. Merge it with your "supossed DB Code" and it should be done.