-
Posts
1,255 -
Joined
-
Last visited
Everything posted by .:HyPeX:.
-
Custom level system is not working, help me please! :(
.:HyPeX:. replied to Dzsozi (h03)'s topic in Scripting
Try checking whats the output of getElementData(playerSource, "hoursplayed"). -
Its pretty easy, this should just return the Unix time from just now and outputit into chatbox when pressing F5: (Then it will just display current time, date and the unix obtained by getRealTime (wich should be same to the first one) function time() local time = getRealTime() time.month = time.month + 1 time.year = time.year + 1900 local unix = getTimestamp(time.year,time.month,time.monthday,time.hour,time.minute,time.second) outputChatBox("TimeStamp Unix: "..unix) if time.second < 10 then time.second = "0"..time.second end if time.minute < 10 then time.minute = "0"..time.minute end if time.hour < 10 then time.hour = "0"..time.hour end outputChatBox("Real TimeStamp: "..time.timestamp) outputChatBox("Time: "..time.hour..":"..time.minute..":"..time.second) outputChatBox("Date: "..time.monthday.."/"..time.month.."/"..time.year) end bindKey("F5", "down", time) Note that they wont be exactly the same, as there's a delay between them in the code.
-
Well i got a problem, the rotationCenterOffset X,Y,Z seems to have no effect, why? local x,y = guiGetScreenSize() addEventHandler("onClientResourceStart", root, function() shader = dxCreateShader("shader.fx") image = dxCreateTexture("Image1.jpg") dxSetShaderValue(shader, "gTexture", image) end) local Images = { --[[ Start ]] { {0,0,0,x*0.1,y*0.5,x*0.5}, 1 }, --[[ End ]] { {90,0,0,x*0.1,y*0.5,x*0.5}, 2 }, --[[ Current ]] { {0,0,0}, {1,1} } } function onClientRenderTest() if not shader then return outputChatBox("Shader error") end if not image then return outputChatBox("Image error") end dxSetShaderTransform(shader, Images[3][1][1],Images[3][1][2], Images[3][1][3],Images[3][1][4],Images[3][1][5],Images[3][1][6]) dxDrawImage(x*0.1, y*0.1, x*0.6, y*0.6, shader) end function toggle() if toggle then toggle = nil removeEventHandler("onClientPreRender", root, onClientRenderTest) else toggle = true outputChatBox("True") addEventHandler("onClientPreRender", root, onClientRenderTest) end end bindKey("F2", "down", toggle) function MoveAsd() --[[ Check if start or end ]] if Images[3][2][2] == 1 then Images[3][2][1] = 2 start = getTickCount() addEventHandler("onClientRender", root, AnimationProcess) unbindKey("F3", "down", MoveAsd) -- Stop it from being triggered before animation ends setTimer(function() Images[3][2][2] = 2 removeEventHandler("onClientRender", root, AnimationProcess) bindKey("F3", "down", MoveAsd) -- Bind it back after animation ends end, 1000, 1) else Images[3][2][1] = 1 start = getTickCount() addEventHandler("onClientRender", root, AnimationProcess) unbindKey("F3", "down", MoveAsd) -- Stop it from being triggered before animation ends setTimer(function() Images[3][2][2] = 1 removeEventHandler("onClientRender", root, AnimationProcess) bindKey("F3", "down", MoveAsd) -- Bind it back after animation ends end, 1000, 1) end end bindKey("F3", "down", MoveAsd) function AnimationProcess() if Images[3][2][1] == Images[3][2][2] then return end local now = getTickCount() local ending = start + 1000 local elapsed = now - start local duration = ending - start local progress = elapsed / duration for i=1, #Images[3][1] do if i == 7 then else Images[3][1][i] = interpolateBetween(Images[ Images[3][2][2] ][1][i],0,0,Images[ Images[3][2][1] ][1][i],0,0, progress, "Linear") end end end
-
Thats just a FPS counter, but you should just check the team/class parameters with an if as you are showing there.
-
You both guys are doing a typo. dxDrawImage ([b]0:44 x *[/b], x * 0.3, 100, 100, "images/timer.png", 0,0,0, tocolor (0,255,0), rot)
-
Simple, but it will be very laggy each access and search into that database to save/load the values.
-
I know you're good at scripting, could you show us some small part of the code so we get what you actually want to do? Or if you're going to start one, please specify a little better how you want to use/save the element data But i myself cant simply explain XML since i dont handle it so well.
-
How a multi language userpanel made by xiti is yours?
-
You get a boolean becouse thats what dxDrawText returns from it. You can change the colours from the dxDrawText by using variables. Also, if he does create the labels every frame, he should be deleting them too.
-
Maybe you should just read a little bit.. https://wiki.multitheftauto.com/wiki/Sc ... troduction
-
I guess some ped stats should do this, but idk, never heared of this. (And handlings are for vehicles so..)
-
Trust me, XML will only cause problems, and it isnt that hard to learn SQL compared to XML either. (I myself have hard times at XML) If you need some help about SQL/JQery, just check this webpage, its pretty awesome. http://www.w3schools.com/
-
Woops my bad, about the render target, i'm using it for other purpouses for now i wont mention . @Gallardo: I think it wont give the desired effect, as it will probably just stretch it out. I'll test it tomorrow, gotta study today, thanks for the help guys! (Btw, i'm quite ashamed of not even checking the image draw) The idea was ineeded to load the shader with the texture loaded. (but looks like i messed up)
-
Just use madex's code server side.
-
You could use fileCreate functions, i find them pretty interesting.. i dont like xml tbh honest, and at a refresh of every min, you'll need something faster, where i'd suggest MTA's SQL integrated functions.
-
i'll be short: I'm trying to create a windows 8 effect where the image should rotate 90° not clock-wise until dissapearing (becouse its being looked from the side and it hasnt got any width) but nothing is happening. No errors in debug. Image is drawn normally without problems. local x,y = guiGetScreenSize() addEventHandler("onClientResourceStart", root, function() shader = dxCreateShader("shader.fx") image = dxCreateTexture("Image1.jpg") dxSetShaderValue(shader, "Texture0", image) RenderTarget = dxCreateRenderTarget(x*0.6,y*0.6) end) local Images = { --[[ Start ]] { {0,0,0,0, y*0.5,0,true,0,y*0.5}, 1 }, --[[ End ]] { {0,90,0,0, y*0.5,0,true,0,y*0.5}, 2 }, --[[ Current ]] { {0,0,0,0, y*0.5,0,true,0,y*0.5}, {1,1} } } function onClientRenderTest() if not shader then return outputChatBox("Shader error") end if not image then return outputChatBox("Image error") end if not RenderTarget then return outputChatBox("Target error") end dxSetRenderTarget(RenderTarget) dxSetShaderTransform(shader, Images[3][1][1],Images[3][1][2], Images[3][1][3], Images[3][1][4],Images[3][1][5],Images[3][1][6],Images[3][1][7],Images[3][1][8], Images[3][1][9]) dxDrawImage(0, 0, x*0.6, y*0.6, image) dxSetRenderTarget() dxDrawImage(x*0.3, y*0.3, x*0.6, y*0.6, RenderTarget) end function toggle() if toggle then toggle = nil removeEventHandler("onClientPreRender", root, onClientRenderTest) else toggle = true outputChatBox("True") addEventHandler("onClientPreRender", root, onClientRenderTest) end end bindKey("F2", "down", toggle) function MoveAsd() --[[ Check if start or end ]] if Images[3][2][2] == 1 then Images[3][2][1] = 2 start = getTickCount() addEventHandler("onClientRender", root, AnimationProcess) unbindKey("F", "down", MoveAsd) -- Stop it from being triggered before animation ends setTimer(function() Images[3][2][2] = 2 removeEventHandler("onClientRender", root, AnimationProcess) bindKey("F", "down", MoveAsd) -- Bind it back after animation ends end, 1000, 1) else Images[3][2][1] = 1 start = getTickCount() addEventHandler("onClientRender", root, AnimationProcess) unbindKey("F", "down", MoveAsd) -- Stop it from being triggered before animation ends setTimer(function() Images[3][2][2] = 1 removeEventHandler("onClientRender", root, AnimationProcess) bindKey("F", "down", MoveAsd) -- Bind it back after animation ends end, 1000, 1) end end bindKey("F3", "down", MoveAsd) function AnimationProcess() if Images[3][2][1] == Images[3][2][2] then return end local now = getTickCount() local ending = start + 1000 local elapsed = now - start local duration = ending - start local progress = elapsed / duration for i=1, #Images[3][1] do if i == 7 then else Images[3][1][i] = interpolateBetween(Images[ Images[3][2][2] ][1][i],0,0,Images[ Images[3][2][1] ][1][i],0,0, progress, "Linear") end end end shader: // // image.fx // //--------------------------------------------------------------------- // texture settings //--------------------------------------------------------------------- texture Texture0; //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { Texture[0] = Texture0; } } // Fallback technique fallback { pass P0 { } } Meta: (little bit extense, i'm only using C.lua, shader.fx and Image1.jpg, the others are just becouse i found out that it is faster for scripting to just have everything there and change names .) <meta> <file src="mta-helper.fx" type="client" /> <info author="HyPeX" name="LxGRadio" type="script" version="1.0" /> <script src="Radio.lua" type="server" /> <file src="fonts/podium.ttf" /> <file src="fonts/asd.ttf" /> <script src="C.lua" type="client"/> <script src="S.lua" type="server"/> <file src="container.col"/> <file src="shader.fx" /> <file src="container.dff"/> <file src="container.txd"/> <file src="fonts/BF3.ttf" /> <file src="hud.png" /> <file src="settings.png" /> <file src="loading.png" /> <file src="img/deploy.png" /> <file src="achivements.png" /> <file src="plus.png" /> <file src="ranking.png" /> <file src="360.png" /> <file src="back.jpg" /> <file src="backg.jpg" /> <file src="Image1.jpg" /> <file src="Image2.jpg" /> <file src="Image3.jpg" /> <file src="Image4.jpg" /> <file src="img/Lobby.png" /> <file src="img/chapa.png" /> <file src="txd/nbball.txd" /> <min_mta_version client="1.3.0-9.04431" /> <settings> <setting name="*Labels" value="{Kills, Deaths, Headshots, PlayTime, EXP, Level, Rank}" friendlyname="Dashboard Labels" group="" accept="" examples="cash, kills" desc="" /> </settings> </meta>
-
Just somewhere in your client.. local FpsTickCount = getTickCount() local FpsCount = 0 local FpsResult = 0 function FPS() local now = getTickCount() FpsCount = FpsCount + 1 if now - FpsTickCount > 1000 then FpsTickCount = getTickCount() FpsResult = FpsCount FpsCount = 0 end end addEventHandler("onClientRender", root, FPS)
-
Thanks!, i'm doing the tables one, but it is getting somehow ridiculously hard to explain and long, i'm covering every small aspect of them from my knowledge, trying to not leave anything. (I do each part on notepad and then take it to forum where i organize it and colour it)
-
Just replace the one you have with the one i pasted, it should work.
-
You're sending the player as source, but not as argument. You should also send it as argument for as the function to recive the argument. You should change this one, or edit the other script to make it use source instead of the argument. function sexo() showCursor(true) wal = -- Walpaper \/ guiCreateStaticImage(0, 0, 1, 1, "images/wal.jpg", true) fundo = -- Imagem de fundo onde irá ficar a opção de escolha \/ guiCreateWindow(313, 173, 412, 331, "SELECT YOUR SPAWN - ELITE ZOMBIE", false, wal) guiWindowSetMovable(fundo, false) guiWindowSetSizable(fundo, false) click = -- bagulho escrito la poha guiCreateLabel(9, 30, 316, 16, "Click a button to select your spawn | Do not Spawn Kill |", false, fundo) guiSetFont(click, "default-bold-small") bony = -- botau de bony guiCreateButton(10, 75, 130, 72, "-- Bone County --", false, fundo) guiSetFont(bony, "default-bold-small") tierra = guiCreateButton(150, 75, 130, 72, "-- Tierra Robada --", false, fundo) guiSetFont(tierra, "default-bold-small") area51 = guiCreateButton(290, 75, 108, 72, "-- Área 51 --\n*Proximidades*", false, fundo) guiSetFont(area51, "default-bold-small") sf = guiCreateButton(9, 157, 130, 72, "-- San Fierro --", false, fundo) guiSetFont(sf, "default-bold-small") angel = guiCreateButton(150, 157, 130, 72, "-- Angel Pine --", false, fundo) guiSetFont(angel, "default-bold-small") montanha = guiCreateButton(290, 157, 108, 72, "-- Montanhas --\n*Los Santos*", false, fundo) guiSetFont(montanha, "default-bold-small") praia = guiCreateButton(9, 239, 130, 72, "-- Praia de LS --\n*LS = Los Santos*", false, fundo) guiSetFont(praia, "default-bold-small") aero = guiCreateButton(150, 239, 130, 72, "-- Aeroporto --\n*Los Santos*", false, fundo) guiSetFont(aero, "default-bold-small") ls = guiCreateButton(290, 239, 108, 72, "-- Los Santos --\n*Interior*", false, fundo) guiSetFont(ls, "default-bold-small") addEventHandler("onClientGUIClick", bony, spawnbony) -- função de bony county addEventHandler("onClientGUIClick", tierra, spawntierra) -- função de tierra robada addEventHandler("onClientGUIClick", area51, spawn51) -- função da área 51 addEventHandler("onClientGUIClick", sf, spawnsf) -- função de san fierro addEventHandler("onClientGUIClick", angel, spawnangel) -- função de angel pine addEventHandler("onClientGUIClick", montanha, spawnmontanha) -- função das montanhas addEventHandler("onClientGUIClick", praia, spawnpraia) -- função da praia de ls addEventHandler("onClientGUIClick", aero, spawnaero) -- função do aero krl addEventHandler("onClientGUIClick", ls, spawnls) -- função de ls interior --[[ for i, data in ipairs(playerDataTable) do if data[1] == "skin" then setElementModel(localPlayer, 73) end end ]] end addEvent("sex",true) addEventHandler("sex",root,sexo) ----------------------------------------------------------------------- -- FUNÇÕES DOS BOTÕES - EDITAVEIS NO OUTRO ARQUIVO function spawnbony () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "bonyconty", getLocalPlayer(),getLocalPlayer() ) end end function spawntierra () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "tierrarobada", getLocalPlayer(),getLocalPlayer() ) end function spawn51 () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "poha51", getLocalPlayer(),getLocalPlayer() ) end function spawnsf () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "sfpoha", getLocalPlayer(),getLocalPlayer() ) end function spawnangel () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "angelpinepoha", getLocalPlayer(),getLocalPlayer() ) end function spawnmontanha () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "montanhamarota", getLocalPlayer(),getLocalPlayer() ) end function spawnpraia () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "lspraia", getLocalPlayer(),getLocalPlayer() ) end function spawnaero () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "aeru", getLocalPlayer(),getLocalPlayer() ) end function spawnls () showCursor(false) destroyElement(wal) destroyElement(fundo) destroyElement(click) destroyElement(bony) destroyElement(tierra) destroyElement(area51) destroyElement(sf) destroyElement(angel) destroyElement(montanha) destroyElement(praia) destroyElement(aero) destroyElement(ls) triggerServerEvent ( "interioacre", getLocalPlayer(),getLocalPlayer() ) end -----------------------------------------------------------------------
-
Read correctly, that will make it static, i dont think it will be able to move at all then..
