Jump to content

Dzsozi (h03)

Members
  • Posts

    696
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Dzsozi (h03)

  1. Thanks, I'll try to edit this and make something like in the picture! I have one more question: How can I get the position of all the default light source of GTA SA? I mean lamps, buildings' windows, etc. or how can I attach this shader light elements to them?
  2. And is there any shader that has functions like this, or possibility to edit to get a result like this?
  3. Hello everybody! I have a question for professionals. Is this possible to get a result like this with shaders? I mean the bokeh lights in the distance:
  4. Hello community! I want to make script which is removes health if you crash with your vehicle and I don't want to use setElementHealth, I want to define it as a PlayerDamage and use onPlayerDamage event, because I have other scripts which are works with onPlayerDamage, and if I use setElementHealth they wont work. So how can I define something as a player damage? I've tried this, but I have headshot resource running and if I crash a little bit I die immediately, but if I define bodypart for example as torso (number 3) the crash script is not working. Debugscript doesn't show me errors, but I can't fix it. I would be happy if someone could help me! function lossHealthOnHurt(loss) if getVehicleOccupant(source) then player = getVehicleOccupant(source) health = getElementHealth(player) if loss >= 50 and loss < 349 then --setElementHealth(player, health - loss/10) triggerEvent("onPlayerDamage", player, nil, nil, 9, loss/10) elseif loss >= 350 then killPed(player) end end end addEventHandler("onVehicleDamage", getRootElement(), lossHealthOnHurt) Thanks in advance!
  5. Hello community! Today I found a script on community which is replaces the crosshair depends on the target, so if the target element is a player and if it's in your team then the crosshair becomes green, but if it's not on your team then it becomes red. I tried to edit it, but I can't find out what's the problem. I want to set a different crosshair for some weapon slots, but it's not working, the crosshair is being replaced, but for every weaponslot the same. What's the problem? Here's the community script: Click Here's my code (there's no error in debugscript): local shader = dxCreateShader ( "crosshair/replace.fx" ) local dot = dxCreateTexture("crosshair/img/dot.png") local assault = dxCreateTexture("crosshair/img/assault.png") local pistol = dxCreateTexture("crosshair/img/pistol.png") local shotgun = dxCreateTexture("crosshair/img/shotgun.png") local smg = dxCreateTexture("crosshair/img/smg.png") function replaceCrosshair() if getControlState("aim_weapon") then if getPedWeaponSlot( getLocalPlayer(), 2 ) then engineRemoveShaderFromWorldTexture(shader, "siteM16") dxSetShaderValue(shader, "gTexture", pistol) engineApplyShaderToWorldTexture(shader, "siteM16") elseif getPedWeaponSlot( getLocalPlayer(), 3 ) then engineRemoveShaderFromWorldTexture(shader, "siteM16") dxSetShaderValue(shader, "gTexture", shotgun) engineApplyShaderToWorldTexture(shader, "siteM16") elseif getPedWeaponSlot( getLocalPlayer(), 4 ) then engineRemoveShaderFromWorldTexture(shader, "siteM16") dxSetShaderValue(shader, "gTexture", smg) engineApplyShaderToWorldTexture(shader, "siteM16") elseif getPedWeaponSlot( getLocalPlayer(), 5 ) then engineRemoveShaderFromWorldTexture(shader, "siteM16") dxSetShaderValue(shader, "gTexture", assault) engineApplyShaderToWorldTexture(shader, "siteM16") else engineRemoveShaderFromWorldTexture(shader, "siteM16") dxSetShaderValue(shader, "gTexture", dot) engineApplyShaderToWorldTexture(shader, "siteM16") end end end addEventHandler("onClientRender", root, replaceCrosshair)
  6. You might have to edit this a little bit, but I think you got it. local camID = 0 local viewPosition = {} viewPosition[1] = {369.0364074707, -2058.7250976563, 33.059700012207, 369.44738769531, -2057.8530273438, 32.79430770874} -- just an example, you can add more by copying this and change the number to a bigger one, for example -- viewPosition[2] = {369.0364074707, -2058.7250976563, 33.059700012207, 369.44738769531, -2057.8530273438, 32.79430770874} local stageTime = 6500 local fadeTime = 1000 local fadeDelay = 0 function showViews() fadeCamera ( false, fadeTime/1000 ,0,0,0) setTimer(function() local camID = math.random(1,#viewPosition) local camX = viewPosition[camID][1] local camY = viewPosition[camID][2] local camZ = viewPosition[camID][3] local lookX = viewPosition[camID][4] local lookY = viewPosition[camID][5] local lookZ = viewPosition[camID][6] setCameraMatrix(camX, camY, camZ, lookX, lookY, lookZ) newView = setTimer(function() showFerrisViews() end, stageTime, 1) fadeCamera( true, fadeTime/1000) end, fadeTime+fadeDelay , 1) end function endViews() if isTimer(newView) then killTimer(newView) newView = nil end end EDIT: Use onPlayerJoin to start the camera matrix views and use onPlayerSpawn to remove it.
  7. Thank you, it's solved the problem, thanks!
  8. I have to get back to this post. I've found a problem that I can't solve and can't manage to find out what's the problem. If I write for example say asd in console then I get these errors in debugscript: What is this? And how could I solve this problem? Here's my code (not the full, but the part that could contain the errors): local localChatDistance = 30 local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second function timeFormat() local realtime = getRealTime() return string.format("%02d:%02d:%02d", realtime.hour, realtime.minute, realtime.second) end function sendMessageToNearbyPlayers(thePlayer, cmd, ...) local x, y, z = getElementPosition( thePlayer ) local nr, ng, nb = getPlayerNametagColor(thePlayer) local name = getPlayerName(thePlayer) local affectedPlayers = { } local msgTable = { ... } local message = table.concat ( msgTable, " " ) local message = string.gsub ( message, '#%x%x%x%x%x%x', '' ) local chatTime = timeFormat() local first = msgTable[1] table.remove(msgTable, 1) if getElementData(thePlayer, "chat:spam") == 1 then sendServerMessage("Másodpercenként egy üzenetet küldhetsz.", thePlayer) else if string.sub(first,1,1) == "/" then if getElementData(thePlayer, "chat.command:spam") == 1 then sendServerMessage("Másodpercenként egy parancsot használhatsz.", thePlayer) else local command = string.sub(first, 2, string.len(first)) local arguments = table.concat(msgTable, " ") executeCommandHandler( command, thePlayer, arguments ) triggerClientEvent(thePlayer, "executeClientCommand", thePlayer, command, arguments) setElementData(thePlayer, "chat.command:spam", 1) setTimer(function(thePlayer) setElementData(thePlayer, "chat.command:spam", 0) end, 1000, 1, thePlayer) outputServerLog("[LOCAL][PARANCS]: ".. name ..": /"..command.." "..arguments) end else local shownto = 0 for index, nearbyPlayer in ipairs(getElementsByType("player")) do if isElement(nearbyPlayer) and getDistanceBetweenPoints3D(x, y, z, getElementPosition(nearbyPlayer)) < ( localChatDistance or 20 ) then if not isPedDead(nearbyPlayer) and getElementDimension(thePlayer) == getElementDimension(nearbyPlayer) then outputChatBox("[" .. chatTime .. "] " .. "[LOCAL]" .. RGBToHex(nr, ng, nb) .. " " .. name .. "#FFFFFF: " .. message, nearbyPlayer, 245, 140, 20, true ) outputServerLog("[LOCAL]: ".. name ..": "..message) table.insert(affectedPlayers, nearbyPlayer) shownto = shownto + 1 end end end setElementData(thePlayer, "chat:spam", 1) setTimer(function(thePlayer) setElementData(thePlayer, "chat:spam", 0) end, 1000, 1, thePlayer) end end end addCommandHandler("Local",sendMessageToNearbyPlayers) function blockChatMessage(message) cancelEvent() sendMessageToNearbyPlayers(message) end addEventHandler("onPlayerChat", getRootElement(), blockChatMessage) addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","Local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","Local") end end) addEventHandler("onPlayerQuit",getRootElement(), function () unbindKey(source,"t","down","chatbox","Local") end) addEventHandler("onResourceStop",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do unbindKey(player,"t","down","chatbox","Local") end end)
  9. Sorry, it's not element data, it's account data!! So my question is: Is this possible to get ACCOUNT DATA from client side?
  10. If it's syncronized then what could cause this? What could be the problem? Here's the part of my client side code: local fontSize = 1.15 local money = getPlayerMoney(getLocalPlayer()) local bankMoney = getElementData(getLocalPlayer(), "bank.balance") if money < 0 then moneyColor = tocolor(175, 30, 30, 255) -- piros (red) bankMoneyColor = tocolor(215,100,100,255) else moneyColor = tocolor(35, 130, 50, 255) -- zöld (green) bankMoneyColor = tocolor(115,235,140,255) end dxDrawBorderedText("$"..money,x*1850, y*50, x*1850, y*40,moneyColor, fontSize,"pricedown","right","top",false,false,false) -- készpénz (money in pocket) dxDrawBorderedText("$"..bankMoney,x*1850, y*80, x*1850, y*40,bankMoneyColor, fontSize,"pricedown","right","top",false,false,false) -- bank egyenleg (money in bank) I've even tried write tostring and tonumber before bankMoney, but if I leave it like this or write tonumber then it gives me this error, if I write tostring it writes $false.
  11. Ohh, forgot this one. I have one more question: How can I get an element data on client side which was set on server side? I use 50p's bank system and I want to make a custom HUD which is draws the current bank balance, but the "bank.balance" elementdata was set on server side. How could I get this element data on client side?
  12. Thank you! You helped me alot in other things as well!
  13. Hello community! I have a question. How can I check if the player is in the ACL admin group on client side? I've made an export function for this, but it only works on server side. How could I make this work on client side as well? function isPlayerAdmin(player) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Admin" ) ) then return true end return false end
  14. I've made something, but it's not working, well for the first frame it makes the effect, but after that there's gonna be a huge frame drop, and the text just bugs. It's not even above my head after my name. local typingTextGroups = {{ r=20, b=70, g=200, a=0 }, {r=20, g=70, b=200, a=0}, {r=20,g=70,b=200,a=0}} local typingText = "• " addEventHandler("onClientRender", root, function ( ) dxDrawText(typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[1].r, typingTextGroups[1].g, typingTextGroups[1].b, typingTextGroups[1].a),additionalScale,font,"left","top",false,false,false,true,true) dxDrawText(typingText .. "" .. typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[2].r, typingTextGroups[2].g, typingTextGroups[2].b, typingTextGroups[2].a),additionalScale,font,"left","top",false,false,false,true,true) dxDrawText(typingText .. "" .. typingText .. "" .. typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[3].r, typingTextGroups[3].g, typingTextGroups[3].b, typingTextGroups[3].a),additionalScale,font,"left","top",false,false,false,true,true) if typingTextGroups[1].a == 0 and typingTextGroups[2].a == 0 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 0 typingTextGroups[3].a = 0 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 0 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 255 typingTextGroups[3].a = 0 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 255 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 255 typingTextGroups[3].a = 255 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 255 and typingTextGroups[3].a == 255 then typingTextGroups[1].a = 0 typingTextGroups[2].a = 0 typingTextGroups[3].a = 0 end end)
  15. I don't understand what or how do you mean. Could you write an example or explain it please?
  16. I don't want the text to fade, I just want to simulate the loading effect, that the dots are "growing" and if they reach 3 then it restarts. But how could I make this using getTickCount?
  17. Hello community! I want to create my own dxDraw nametags, but I have one problem. Is this possible to make a loading dots effect? Like this one: I mean the black dots are go to 3 from 1, then it restarts. How is this possible? Can't find out how should I make this without problem.
  18. Thank you! I've managed out how to do this, and it's working! Thanks everybody again!
  19. Okay, so now I can get the number of the accounts in the server with this code right? It outputs 4. One is mine, other one is my friend's, the other 2 are test accounts I think. But now I want to get all the accounts name and set their account data to false. But the getAccounts function only returns to numbers. How can I get all the account's names? To set their data and delete them. Here's my current code, as I've mentioned it outputs the number of the accounts right now: function deleteAllData ( ) local accountTable = getAccounts () for i=1, #accountTable, 1 do outputChatBox(i) end end addCommandHandler( "delallacc", deleteAllData )
  20. Thanks! You helped me alot! I'll read through the page you have linked, thanks again!
  21. Still waiting for help if someone knows the solution.
×
×
  • Create New...