-
Posts
1,255 -
Joined
-
Last visited
Everything posted by .:HyPeX:.
-
Returns nil..
-
bump, how can i make that it will not get the same player here? (If 2 players have the same value, i want to make it random whos better.) TableReturn = {} for i,v in ipairs(PTable) do for k,s in pairs(PTableValues) do if v == s then TableReturn[k] = i break end end end
-
So we're again at the start of the topic..
-
Tried this, but nothing is drawn. function DrawTableString() local x,y = guiGetScreenSize() for i,v in ipairs(DrawStringTable) do local str = v local vals = string.split(str,",") local a,b,c,d,e = unpack(vals) dxDrawRectangle(a,b,c,d,e) outputChatBox(a..","..b..","..c..","..d..","..e) end end addEventHandler("onClientRender", getRootElement(), DrawTableString) Output: 0.19117647409439 * x, 0.15885417163372 * y,( 0.64191174507141 * x ) - ( 0.19117647409439 * x ), ( 0.421875 * y - 0.15885417163372 * y ), -1275068416 PD: no errors in debug
-
dxDrawRectangle(vals) vals is a table, how can i split the table into numbers, like the string was? else dxDrawRectangle cant do it.
-
ah, so ab was the string, i get it now, thanks!
-
But, it shouldnt be always sorting them from bigger to smaller as specified?
-
i dont understand what str = "a,b,c" does.
-
Yeah, but it only worked with onClientPreRender, onClientRender did nothing.
-
Yeah,i get it, but i want to remove the string, make it back usable.
-
Well, i aswell as other 2 players see me correctly (Stable), but the other 2 just flash, i had to record it shortly to show it: (They also see me stable whilst they are flashing) Code: function DrawLobby() start = 0 if DrawedLobby then GlobalPlayerDrawTable = PositionOrdering(GlobalPlayerDrawTable) for i,v in pairs(TableReturn) do local Kills = getElementData(i, "Kills") local x,y = guiGetScreenSize() dxDrawText(getPlayerNametagText(i), x*0.23, y*0.3 + (v * (y*0.056)), x, y, tocolor(255,255,255, 255),2, "default-bold","left", "top", false,false,true,true) dxDrawText(" #FFFFFF"..Kills, x*0.45, y*0.3 + (v * (y*0.056)), x, y, tocolor(0,50,150, 255),2, "default-bold","left", "top", false,false,true,true) if getElementData(getLocalPlayer(), "Squad") == getElementData(i, "Squad") then color = tocolor(0, 176, 21, 180) else color = -1275068416 end if i == getLocalPlayer() then color = tocolor(250, 225, 40, 180) end dxDrawRectangle(0.22205881774426 * x, 0.29036459326744 * y + (v * (y*0.056)),( 0.50661766529083 * x ) - ( 0.22205881774426 * x ), ( 0.34635415673256 * y - 0.29036459326744 * y ), color) start = start + 1 end end end function PositionOrdering(Table) PTableValues = {} PTable = {} if ( Table ) then for i,v in pairs(Table) do PTableValues[i] = v table.insert(PTable, v) end table.sort(PTable, function(a,b) return a>b end) TableReturn = {} for i,v in ipairs(PTable) do for k,s in pairs(PTableValues) do if v == s then TableReturn[k] = i break end end end return TableReturn else return false end end function SetLobbyDraw(v) if draw then draw = nil removeEventHandler("onClientRender", getRootElement(), DrawLobby) else draw = true addEventHandler("onClientRender", getRootElement(), DrawLobby) end end bindKey( "tab", "down", SetLobbyDraw) bindKey( "tab", "up", SetLobbyDraw)
-
This is basically the add, how could it NOT be a string? table.insert(DrawStringTable,CursorTable.X1.." * x, "..CursorTable.Y1.." * y,( "..EndX.." * x ) - ( "..CursorTable.X1.." * x ), ( "..EndY.." * y - "..CursorTable.Y1.." * y ), "..color)
-
how can this return "Error, expected number at argument 2, returned none" dxDrawRectangle(v) But outputChatbox(v) returns: 0.14191175997257 * x, 0.15364582836628 * y,( 0.37794119119644 * x ) - ( 0.14191175997257 * x ), ( 0.62109375 * y - 0.15364582836628 * y ), -1275068416
-
Worked, but how can i turn off the test?
-
the whole code is @first post.
-
Not working
-
Hey guys, i'm trying to create a compass, how could i update the image on every frame? it draws it up on the pixels 400-500 always.. idk why. function dxDrawImageX() local rotz = getElementRotation(getLocalPlayer()) local now = rotz local End = 360 local progress = now / End local DrawX = interpolateBetween(0,0,0,400, 0,0,progress, "Linear") image = dxDrawImageSection(65, 516,165, 50, DrawX, 0, 100, 50, "360.png") end addEventHandler("onClientRender", getRootElement(), dxDrawImageX) Help pls. Image: http://imgur.com/wlCwvyO PD: Image size is 500x50 (0-400, 400-500 is a replica of 0-100)
-
i'd just add some functions, not the dangerous ones, imo.
-
Bump still need help, tried to use runcode with crun and got this.. Executing client-side command: function DrawRectangle() local x,y = guiGetScreenSize() dxDrawRectangle(0.26397058367729 * x, 0.24869792163372 * y,( 0.80588233470917 * x ) - ( 0.26397058367729 * x ), ( 0.43098959326744 * y - 0.24869792163372 * y ), -1275068416) end addEventHandler( Error: [string "function DrawRectangle() local x,y = guiGetScreenSize() dxDrawR..."]:1: unexpected symbol near '<eof> To make it work i did string like this: TestString = "function DrawRectangle() local x,y = guiGetScreenSize() dxDrawRectangle("..CursorTable.X1.." * x, "..CursorTable.Y1.." * y,( "..EndX.." * x ) - ( "..CursorTable.X1.." * x ), ( "..EndY.." * y - "..CursorTable.Y1.." * y ), "..color..") end addEventHandler('onClientRender', getRootElement(), DrawRectangle)" Gives same result as original string try..
-
Yes. (Read the first post: Random test.)
-
Moved it down, with no result. function TestRec() if not DrawString then outputChatBox("#00aaffPlease do the function first, Draw string doesnt exist.", 255,255,255,true) return end loadstring(DrawString) outputChatBox("#00aaffRunning the string.", 255,255,255,true) end addCommandHandler("TestRec", TestRec) i get the output thought.. (running)
-
well loadstring is not doing anything, and color returned is just crazy values, like -168586 outputChatBox("#00aaffdxDrawRectangle Script by HyPeX Started", 255,255,255,true) function TurnRectangle(cmd,shit) if DxRectangleDraw then outputChatBox("#00aaffPlease finish the steps or restart the script.", 255,255,255,true) return end DxRectangleDraw = true outputChatBox("#00aaffPlease Do '/color R G B A' now", 255,255,255,true) end addCommandHandler("dxRec", TurnRectangle) function SetRecColour(cmd,valA, valB, valC, valD) if not valD then outputChatBox("#00aaffPlease Do '/color R G B A' -> You're missing R G B A", 255,255,255,true) return end if not DxRectangleDraw then outputChatBox("#00aaffPlease Do '/dxRec' first!", 255,255,255,true) return else outputChatBox("#00aaffPlease Draw an Area now. (Press and hold)", 255,255,255,true) color = tocolor(valA, valB, valC, valD) showCursor(true) end end addCommandHandler("color", SetRecColour) function OnClientCursorClick(button, state) if not DxRectangleDraw then outputChatBox("#00aaffPlease Do '/dxRec' first!", 255,255,255,true) return end if not color then outputChatBox("#00aaffPlease Do '/color R G B A' first!", 255,255,255,true) return end if state == "down" then CursorTable = {} CursorTable.X1, CursorTable.Y1 = getCursorPosition() outputChatBox("#00aaffPlease Hold and Drag the cursor.", 255,255,255,true) addEventHandler("onClientRender", getRootElement(), DrawExampleRec) end if state == "up" then CursorTable.X2, CursorTable.Y2 = getCursorPosition() removeEventHandler("onClientRender", getRootElement(), DrawExampleRec) showCursor(false) outputChatBox("#00aaffRectangle Selection is over, Please do '/CopyRec' to copy to clipboard", 255,255,255,true) end end addEventHandler("onClientClick", getRootElement(), OnClientCursorClick) function DrawExampleRec() if not CursorTable then return end if not color then outputChatBox("#00aaffColor error, please check the setps.", 255,255,255,true) removeEventHandler("onClientRender", getRootElement(), DrawExampleRec) return end local x,y = guiGetScreenSize() EndX, EndY = getCursorPosition() dxDrawRectangle(CursorTable.X1 * x, CursorTable.Y1 * y,( EndX * x ) - ( CursorTable.X1 * x ), ( EndY * y - CursorTable.Y1 * y ), color) end function CopyRec(cmd) if not color then outputChatBox("#00aaffPlease check the function, color missing", 255,255,255,true) return end if not CursorTable.X2 then outputChatBox("#00aaffPlease check the function, end corner of rectangle is missing.", 255,255,255,true) return end DrawString = "function DrawRectangle()".."\r\n".."local x,y = guiGetScreenSize()".."\r\n".."local color = "..color.."".."\r\n".."local EndY = "..EndY.."".."\r\n".."local EndX = "..EndX.."".."\r\n".."local CursorTableY1 = "..CursorTable.Y1.."".."\r\n".."local CursorTableX1 = "..CursorTable.X1.." ".."\r\n".."dxDrawRectangle(CursorTableX1 * x, CursorTableY1 * y,( EndX * x ) - ( CursorTableX1 * x ), ( EndY * y - CursorTableY1 * y ), color)".."\r\n".."end ".."\r\n".."addEventHandler('onClientRender', getRootElement(), DrawRectangle)" setClipboard(DrawString) outputConsole(DrawString) outputChatBox("#00aaffDraw string was saved, you can now test it with '/TestRec'.", 255,255,255,true) end addCommandHandler("CopyRec", CopyRec) function TestRec() if not DrawString then outputChatBox("#00aaffPlease do the function first, Draw string doesnt exist.", 255,255,255,true) return loadstring(DrawString) end end addCommandHandler("TestRec", TestRec) Random test: function DrawRectangle() local x,y = guiGetScreenSize() local color = 1677721600 local EndY = 0.40234375 local EndX = 0.6860294342041 local CursorTableY1 = 0.25260415673256 local CursorTableX1 = 0.28529411554337 dxDrawRectangle(CursorTableX1 * x, CursorTableY1 * y,( EndX * x ) - ( CursorTableX1 * x ), ( EndY * y - CursorTableY1 * y ), color) end addEventHandler('onClientRender', getRootElement(), DrawRectangle) PD: Somehow, that crazy number colour, works as if tocolor, lol.
