Jump to content

ds1-e

Scripting Moderators
  • Posts

    636
  • Joined

  • Days Won

    8

Everything posted by ds1-e

  1. ds1-e

    Shader problem.

    Hey, so can you help me with it?
  2. ds1-e

    Shader problem.

    local screenWidth, screenHeight = guiGetScreenSize() local firstShader = dxCreateShader("shader2.fx") local secondShader = dxCreateShader("shader.fx") local screenSource = dxCreateScreenSource(screenWidth, screenHeight) local blurAmount = 50 local uvAmount = 400 local blendAmount = 6 function onClientRender() dxUpdateScreenSource(screenSource) dxSetShaderValue(firstShader, "colorAmount", 0.50) dxSetShaderValue(firstShader, "coloredTexture", screenSource) dxDrawImage(0, 0, screenWidth, screenHeight, firstShader) dxSetShaderValue(secondShader, "ScreenSource", result) dxSetShaderValue(secondShader, "OverlayTexture", result) dxSetShaderValue(secondShader, "BlurStrength", blurAmount) dxSetShaderValue(secondShader, "UVSize", screenWidth - uvAmount, screenHeight - uvAmount) dxSetShaderValue(secondShader, "Blend", blendAmount) dxDrawImage(0, 0, screenWidth, screenHeight, secondShader) end addEventHandler("onClientRender", getRootElement(), onClientRender)
  3. ds1-e

    Shader problem.

    Hey, thanks for answer. But didn't really understand what i should to do. Can you explain it better?
  4. bump. I just tried 2 different events related with colshapes, and probably i shoud use OnClientElementColShapeHit/OnClientElementColShapeLeave. Because onClientColShapeLeave doesn't trigger after jumping out of car. function onClientElementColShapeHit(theShape, sameDimension) colShape = "onClientElementColShapeHit" end addEventHandler("onClientElementColShapeHit", getRootElement(), onClientElementColShapeHit) -- function onClientElementColShapeLeave(theShape, sameDimension) colShape = "onClientElementColShapeLeave" end addEventHandler("onClientElementColShapeLeave", getRootElement(), onClientElementColShapeLeave) Added little state in onClientRender to be sure which event triggers. But, still i need some help. I would like to know which way will be best for get colshape into table (only if it doesn't exist in table). Any advices?
  5. ds1-e

    Shader problem.

    To make things simpler, and focus on main problem. - I have shader which change colors of player screen. - I have second shader which blur player screen. - After applying both shaders, only one works. So i need solution: - Maybe i make it wrong? Or there's possibility to get result: - Use first shader, get result. - Use second shader on result from first shader.
  6. ds1-e

    Shader problem.

    And one more problem. How can i mix shader effect in one result? I mean that if one shader works, second don't wanna work. local screenWidth, screenHeight = guiGetScreenSize() local firstShader = dxCreateShader("shader.fx") local secondShader = dxCreateShader("shader2.fx") local screenSource = dxCreateScreenSource(screenWidth, screenHeight) function onClientRender() dxUpdateScreenSource(screenSource) dxDrawImage(0, 0, screenWidth, screenHeight, firstShader) dxDrawImage(0, 0, screenWidth, screenHeight, secondShader) end addEventHandler("onClientRender", getRootElement(), onClientRender)
  7. Hey, i'm not experienced with shaders so i have a problem on my way. I don't know can i apply screenSource for this shader texture, something is wrong because i have black screen instead of shader. texture gTexture0 < string textureState="0,Texture"; >; sampler Sampler0 = sampler_state { Texture = (gTexture0); };
  8. Is there anyway to hide scrollbar which creates automatically?
  9. Hey. How can i switch to other column after adding rows? After adding teams, it adds player names, but i want player names be under "Name" column, not in "Team" column. local scoreBoardGridList = guiCreateGridList(0, 0.0450, 1.30, 0.98, true, scoreBoard) local scoreBoardColumn = {} scoreBoardColumn[1] = guiGridListAddColumn(scoreBoardGridList, "Team", 0.16) local teams = getElementsByType("team") for k, v in pairs(teams) do local r, g, b = getTeamColor(v) local row = guiGridListAddRow(scoreBoardGridList, getTeamName(v)) guiGridListSetItemColor(scoreBoardGridList, row, scoreBoardColumn[1], r, g, b) end scoreBoardColumn[2] = guiGridListAddColumn(scoreBoardGridList, "Name", 0.16) local players = getElementsByType("player") for k, v in pairs(players) do local row = guiGridListAddRow(scoreBoardGridList, getPlayerName(v)) end
  10. Oh i didn't noticed that, changed sizes to less and everything works Thank you.
  11. Hey. I have encountered two problems on my way. 1. Checkboxes doesn't trigger (if i set parent to nil everything works normal) local userPanel = guiCreateWindow(0, 0.70, 0.30, 0.30, "User panel", true) local guiPanel = {} local guiPanelTexts = {} guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel) guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel) guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel) guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel) guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel) guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel) guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel) guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel) guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel) guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel) guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel) 2. Scrollbar freeze after loading data from JSON file. guiSetText(guiPanelTexts[2], playerData.playerSettings.settings[5].."%") guiScrollBarSetScrollPosition(guiPanel[4], tonumber(playerData.playerSettings.settings[5])) guiSetText(guiPanelTexts[4], playerData.playerSettings.settings[6].."%") guiScrollBarSetScrollPosition(guiPanel[5], tonumber(playerData.playerSettings.settings[6])) guiSetText(guiPanelTexts[6], playerData.playerSettings.settings[7].."%") guiScrollBarSetScrollPosition(guiPanel[6], tonumber(playerData.playerSettings.settings[7])) Value of scrollbar is correct however, i can't use it. I need to click this to unfreeze it.
  12. ds1-e

    xml vs json

    I need ask you once again. Last question. I want to store additional data for (each) item. Something like item_1, data_1, item_2, data_2. What will be the best way to do it? + It's possible to add another table to same file, and read this data?
  13. ds1-e

    xml vs json

    Okay nevermind. I got this to work somehow. Rewrited functions again. And now file content is correct. If something will change, or i will need help in something else, i'll let you know, thank you once again.
  14. ds1-e

    xml vs json

    Ehm, i tried to do it, on ClientResourceStop i saved data from file to variable, then delete a file, and create it again. But this don't wanna work. I hate using file functions. function onClientResourceStart() if not fileExists("settings") then local settingsFile = fileCreate("settings") if settingsFile then local jsonData = toJSON(playerData.playerItems) fileWrite(settingsFile, jsonData) fileFlush(settingsFile) fileClose(settingsFile) end end if fileExists("settings") then local settingsFile = fileOpen("settings") if settingsFile then local loadSettings = fileRead(settingsFile, fileGetSize(settingsFile)) local loadedData = fromJSON(loadSettings) fileFlush(settingsFile) fileClose(settingsFile) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) function onClientResourceStop() if fileExists("settings") then local settingsFile = fileOpen("settings") if settingsFile then local jsonData = toJSON(playerData.playerItems) fileWrite(settingsFile, jsonData) fileClose(settingsFile) outputDebugString(jsonData) end end end addEventHandler("onClientResourceStop", resourceRoot, onClientResourceStop) This is how it looks for now, it's full code.
  15. ds1-e

    xml vs json

    OnClientResourceStart creates a good file, but when file saves onClientResourceStop it have this typo (or i don't know...). I should re-create file in script?
  16. ds1-e

    xml vs json

    Ah yes, i forget about that. But that isn't something wrong in the settings file? I mean how it looks inside, it's different from debug string.
  17. ds1-e

    xml vs json

    function onClientResourceStop() if fileExists("settings") then local settingsFile = fileOpen("settings") if settingsFile then local jsonData = toJSON(playerData.playerItems) outputDebugString(tostring(jsonData)) fileWrite(settingsFile, jsonData) fileClose(settingsFile) end end end addEventHandler("onClientResourceStop", getRootElement(), onClientResourceStop) Can't be my typo. File looks like i sent above. And settings file: [ [ false, false, false, false, false, false, false, false, false, false ] ]se ] ]
  18. ds1-e

    xml vs json

    Maybe something wrong is here. Cannot edit my post above. function onClientResourceStop() if fileExists("settings") then local settingsFile = fileOpen("settings") if settingsFile then local jsonData = toJSON(playerData.playerItems) fileWrite(settingsFile, jsonData) fileClose(settingsFile) end end end addEventHandler("onClientResourceStop", getRootElement(), onClientResourceStop)
  19. ds1-e

    xml vs json

    [ [ false, false, false, false, false, false, false, false, false, false ] ]se ] ] And this is result. :v Maybe i should use XML?
  20. ds1-e

    xml vs json

    By the way i probably learned how to load data from JSON file, but i'm thinking if this thing which are you talking about can broke file.
  21. ds1-e

    xml vs json

    It returns a table. I am a bit confused, sorry if i misunderstood you. -- an other table playerItems = { fastkey_1 = false, fastkey_2 = false, fastkey_3 = false, fastkey_4 = false, fastkey_5 = false, fastkey_6 = false, fastkey_7 = false, fastkey_8 = false, fastkey_9 = false, fastkey_10 = false } And result.. [ { "fastkey_7": false, "fastkey_10": false, "fastkey_1": false, "fastkey_5": false, "fastkey_4": false, "fastkey_6": false, "fastkey_8": false, "fastkey_3": false, "fastkey_9": false, "fastkey_2": false } ]se } ]
  22. ds1-e

    xml vs json

    Well, i want this file without a format (i think it's possible, i saw settings files without format), it saves normal, load normal, but i don't know how to retrieve data after loading it. For some reason sometimes json file without any changes looks like that, you should look at the end of line, is it intended? -- settings json file [ { "7": false, "1": false, "2": false, "4": false, "8": false, "9": false, "5": false, "10": false, "3": false, "6": false } ]se } ] Maybe something wrong is in saving? This is the same onClientResourceStart, just first lines. function onClientResourceStart() if not fileExists("settings") then local settingsFile = fileCreate("settings") if settingsFile then local jsonData = toJSON(playerData.playerItems) fileWrite(settingsFile, jsonData) fileClose(settingsFile) end end -- later loading function. addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)
  23. ds1-e

    xml vs json

    Well looks like i almost finished it in JSON, but it shows me nil, whenever i want to retrieve data. Can u help me with that? -- onClientResourceStart if fileExists("settings") then local settingsFile = fileOpen("settings") if settingsFile then local loadSettings = fileRead(settingsFile, fileGetSize(settingsFile)) local loadedData = fromJSON(loadSettings) fileClose(settingsFile) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) -- settings json file [ { "7": false, "1": "Test item", "2": false, "4": false, "8": false, "9": false, "5": false, "10": false, "3": false, "6": false } ] -- table structure which is saved playerData = {playerItems = {[1] = false, [2] = false, [3] = false, [4] = false, [5] = false, [6] = false, [7] = false, [8] = false, [9] = false, [10] = false}}
  24. Hmm what do u think about finding block and name of this animation, and then make a check onClientPlayerDamage if player got this animation resets it? Shouldn't it work?
  25. Check for errors/warning in debugscript 3 Most likely it's something related with login script/functions.
×
×
  • Create New...