-
Posts
696 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Dzsozi (h03)
-
It works now, I just have to fix some of the colshapes' sizes now, thank you so much for your help guys!
-
Still nothing happens, and I don't get any errors in the debugscript.
-
local districtName = "" local district = {} local districts = { -- x, y, width, height, name { 164.4404296875, -341.79296875, 1500, 2750, "Vice Point", 255, 225, 150 }, { -87.556640625, -941.6962890625, 1875, 900, "Washington Beach", 0, 180, 0 }, { -287.2763671875, -1803.3896484375, 2175, 1300, "Ocean Beach", 255, 0, 0 }, { -1200.1083984375, -1803.3896484375, 1375, 1355, "Vice Port", 255, 255, 0 }, { -2082.09765625, -1803.3896484375, 1325, 2675, "Escobar International Airport", 0, 255, 255 }, { -1199, -900.8515625, 665, 1000, "Little Havana", 100, 255, 100 }, { -1199, -235, 900, 975, "Little Haiti", 255, 255, 255 }, { -1337.470703125, -20, 207, 400, "City Scrap", 200, 0, 100 }, { -1575, 415, 2075, 2000, "Downtown", 255, 180, 0 }, { -755, -725.953125, 1000, 735, "Starfish Island", 200, 0, 100 }, { -190, -240, 530, 1560, "Leaf Links", 0, 0, 255 }, { -190, 798.7958984375, 530, 700, "Prawn Island", 0, 0, 0 }, } function createDistricts() for k, v in ipairs(districts) do createRadarArea(v[1], v[2], v[3], v[4], v[6], v[7], v[8], 75) table.insert(district, {createColCuboid(v[1], v[2], -50, v[3], v[4], 1000)}) end end createDistricts() local lastDistrictKey function getCurrentDistrictKey(element) for k, v in ipairs(district) do if v == element then return k end end return false end function outputDistrictName() lastDistrictKey = getCurrentDistrictKey(source) if lastDistrictKey then outputChatBox("" .. districts[lastDistrictKey][5] .. ".") end end addEventHandler("onClientColShapeHit", root, outputDistrictName)
-
Nothing happens, I don't get any output.
-
I changed addEventHandler("onClientColShapeHit", colShape, outputDistrictName) to addEventHandler("onClientColShapeHit", root, outputDistrictName) as well, since colShape variable got removed and I got errors about it being nil, but I also get errors with root. 'attempt to index field '?' (a nil value) What should I change it to? EDIT: 'attempt to index field '?' (a nil value) refers to --> outputChatBox("" .. districts[lastDistrictKey][5] .. ".")
-
No, you can't.
-
Hello! I am trying to do custom district names for a custom map, but I can't figure it out why is it not working and how to solve the problem. I would like it to work like the default zones, I would like to make a function for that to get the zone name of an element, so maybe a function like getDistrictName(element), like the default getZoneName() function. But when I am trying to check if it is working when I hit a col shape then the chatbox doesn't output anything. I am also having an error with the table.insert function, debugscript says bad argument #2 to 'insert' (number expected, got table), but when I add the k (index value) letter it is not working either. How can I do a function like the default getZoneName of an element, but with custom zones and zone names? I'm not so familiar with tables, I always fail when I try to do something with tables. Here's my script: local colShape local districtName = "" local district = {} local districts = { -- x, y, width, height, name { 164.4404296875, -341.79296875, 1500, 2750, "Vice Point", 255, 225, 150 }, { -87.556640625, -941.6962890625, 1875, 900, "Washington Beach", 0, 180, 0 }, { -287.2763671875, -1803.3896484375, 2175, 1300, "Ocean Beach", 255, 0, 0 }, { -1200.1083984375, -1803.3896484375, 1375, 1355, "Vice Port", 255, 255, 0 }, { -2082.09765625, -1803.3896484375, 1325, 2675, "Escobar International Airport", 0, 255, 255 }, { -1199, -900.8515625, 665, 1000, "Little Havana", 100, 255, 100 }, { -1199, -235, 900, 975, "Little Haiti", 255, 255, 255 }, { -1337.470703125, -20, 207, 400, "City Scrap", 200, 0, 100 }, { -1575, 415, 2075, 2000, "Downtown", 255, 180, 0 }, { -755, -725.953125, 1000, 735, "Starfish Island", 200, 0, 100 }, { -190, -240, 530, 1560, "Leaf Links", 0, 0, 255 }, { -190, 798.7958984375, 530, 700, "Prawn Island", 0, 0, 0 }, } function createDistricts() for k, v in ipairs(districts) do createRadarArea(v[1], v[2], v[3], v[4], v[6], v[7], v[8], 75) table.insert(district, {createColCuboid(v[1], v[2], -50, v[3], v[4], 1000)}, {v[5]}) end end createDistricts() function checkDistrict() for k, v in ipairs(district) do colShape = v[1] districtName = v[2] end end addEventHandler("onClientRender", root, checkDistrict) function outputDistrictName() outputChatBox("" .. districtName .. ".") end addEventHandler("onClientColShapeHit", colShape, outputDistrictName)
-
Could somebody help me with the tables? I would like to have a table where I have the model of the cloth defined, the original texture defined and a table inside the table with the custom textures for that cloth, and the clothing id, but I don't know how to do that and then replace/apply shaders to these things.
-
What do you mean by how?
-
I think the way it works is using different dimensions. So the map is started for everyone, no matter where they are, they just can't see it, since it is in a different dimension. So you must set the different types of gamemodes to different dimensions. Whenever a player chooses a gamemode, he is being sent to dimension #24 for example, and the #24 dimension would have the zombie map (you can set objects' to different dimensions as well). I would do that like this, use the setElementDimension function.
-
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
No problem, glad you could fix it! -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open (hitElement) if hitElement and getElementType ( hitElement ) == 'player' then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitElement)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", hitElement, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) local veh = getPedOccupiedVehice(hitElement) if veh then setElementFrozen(veh, true) end setElementFrozen( hitElement, true ) toggleAllControls( hitElement, false ) setTimer ( function( player ) local veh = getPedOccupiedVehice(player) if veh then setElementFrozen(veh, false) end setElementFrozen( player, false ) toggleAllControls( player, true ) end, 3000, 1, hitElement ) outputChatBox ( "Aguarde o portão se abrir.", hitElement, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", hitElement, 255, 0, 0, true ) end end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open (hitElement) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitElement)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", hitElement, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) local veh = getPedOccupiedVehice(hitElement) if veh then setElementFrozen(veh, true) end setElementFrozen( hitElement, true ) toggleAllControls( hitElement, false ) setTimer ( function( player ) local veh = getPedOccupiedVehice(player) if veh then setElementFrozen(veh, false) end setElementFrozen( player, false ) toggleAllControls( player, true ) end, 3000, 1, hitElement ) outputChatBox ( "Aguarde o portão se abrir.", hitElement, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", hitElement, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open (hitElement) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitElement)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", hitElement, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) setElementFrozen( hitElement, true ) toggleAllControls( hitElement, false ) setTimer ( function( player ) setElementFrozen( player, false ) toggleAllControls( player, true ) end, 3000, 1, hitElement ) outputChatBox ( "Aguarde o portão se abrir.", hitElement, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", hitElement, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) Sorry, I just realised that the source of the "onColShapeHit" event is the colshape, not the player or the vehicle. Try this one please. -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
Edited the previous one -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", source, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) local veh = getPedOccupiedVehicle ( source ) if veh then setElementFrozen( veh, true ) end setElementFrozen( source, true ) toggleAllControls( source, false ) setTimer ( function( player ) local veh = getPedOccupiedVehicle ( player ) if veh then setElementFrozen( veh, false ) end setElementFrozen( player, false ) toggleAllControls( player, true ) end, 3000, 1, source ) outputChatBox ( "Aguarde o portão se abrir.", source, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) Try this ** EDITED THE SCRIPT, I MISSED SOMETHING, REPLACE YOURS WITH THIS ONE -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", source, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) setElementFrozen( source, true ) toggleAllControls( source, false ) setTimer ( function( player ) setElementFrozen( player, false ) toggleAllControls( player, true ) end, 3000, 1, source ) outputChatBox ( "Aguarde o portão se abrir.", source, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) -
freeze How to freeze a player for a few seconds when he "onColShapeHit"
Dzsozi (h03) replied to Lord Henry's topic in Scripting
gateilhaFA1 = createObject ( 968, -3341.7001953125, 458.5, 10.5, 0, 270, 270 ) ZonailhaFA1 = createColCuboid ( -3356.7001953125, 459.89999389648, 9.6999998092651, 15.0, 5, 5.0 )--Zona em cubo de colisão. function GateIlha1Open (source, player) local player = getLocalPlayer() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("MapEditor")) then outputChatBox ( "Acesso permitido.", source, 0, 255, 0, true ) moveObject ( gateilhaFA1, 3000, -3341.7001953125, 458.5, 10.5, 0, 90, 0 ) setElementFrozen( player, true ) toggleAllControls( player, false ) setTimer ( function( thePlayer ) setElementFrozen( thePlayer, false ) toggleAllControls( thePlayer, true ) end, 3000, 1, player ) outputChatBox ( "Aguarde o portão se abrir.", source, 0, 255, 0, true ) else outputChatBox ( "Acesso negado.", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", ZonailhaFA1, GateIlha1Open ) function GateIlha1Close () moveObject ( gateilhaFA1, 1000, -3341.7001953125, 458.5, 10.5, 0, -90, 0 ) end addEventHandler ( "onColShapeLeave", ZonailhaFA1, GateIlha1Close ) Try this -
How can I do that with tables? Could you help me with that please?
-
Hello! I was thinking about how I could make more weapon types or weapons, dayz gamemode could do that, and valhalla gamemode also has these taser guns, but (if I'm not mistaken) they kept the default weapons as well. The taser just had a different look and functionalities done via scripting, but it was a weapon. How I could do similar things, so I could make for example a grenade launcher with custom projectiles, but also keep the rocket launchers or any other weapon and the ability to use them normally. How can dayz have m1911, m9, m9 sd and so much more pistols and other kind of weapons with different sounds, different damage and etc etc?
-
And if I want for example 10 types of one t-shirt, so with different patterns for example, I should do a new texture 10 times and then set the shader value of the tshirt shader 10 times? If so, wouldn't it be possible to do that with tables? So if I want to make a new type of t-shirt then I could just add one more line to the table and that's it. Then I could even make a function to get the table so I could do the shops I guess.
-
So that means that I have to replace every clothing I want to use with shaders? If so, what would be the most efficient way to do that? Or to do the whole script.
-
Yes, but I would also like to do a skin colour change, so players could have a white and a black character (CJ) and also could change face textures. I already made the black and the white textures, but I have a little problem. Here's the script: local torsoType = "torso" addEventHandler("onClientRender", root, function() if getPedStat(localPlayer, 21) >= 500 then torsoType = "torso_fat" elseif getPedStat(localPlayer, 23) >= 500 then torsoType = "torso_ripped" elseif getPedStat(localPlayer, 21) >= 500 and getPedStat(localPlayer, 23) >= 500 then torsoType = "torso_fat" elseif getPedStat(localPlayer, 21) < 500 and getPedStat(localPlayer, 23) >= 500 then torsoType = "torso_ripped" elseif getPedStat(localPlayer, 21) >= 500 and getPedStat(localPlayer, 23) < 500 then torsoType = "torso_fat" elseif getPedStat(localPlayer, 21) < 500 and getPedStat(localPlayer, 23) < 500 then torsoType = "torso" else torsoType = "torso" end end) addCommandHandler("change", function(cmd, col) if not tonumber(col) or tonumber(col) < 0 or tonumber(col) > 2 then return end local shader = dxCreateShader( "files/shader.fx", 0, 0, false, "ped" ) local texts = {"black", "white"} local torso = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. "/" .. torsoType .. ".png" ) engineApplyShaderToWorldTexture ( shader, "cj_ped_torso", localPlayer, true ) dxSetShaderValue ( shader, "gTexture", torso ) local face = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. "/face.png" ) engineApplyShaderToWorldTexture ( shader, "cj_ped_head", localPlayer, true ) dxSetShaderValue ( shader, "gTexture", face ) local legs = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. "/legs.png" ) engineApplyShaderToWorldTexture ( shader, "cj_ped_legs", localPlayer, true ) dxSetShaderValue ( shader, "gTexture", legs ) local foot = dxCreateTexture ( "files/" .. texts[tonumber(col)] .. "/foot.png" ) engineApplyShaderToWorldTexture ( shader, "cj_ped_feet", localPlayer, true ) dxSetShaderValue ( shader, "gTexture", foot ) end) And this is how my character looks like when I change between the skin colours: http://imgur.com/a/W8UDR I really don't understand this and the methods and ways of doing that.
-
It is set to true in the script you sent me, but I don't really understand it. What is the DepthBias? And when I put on a shirt (a default shirt, I don't have modded shirts yet) I still see only the torso texture, not the texture of the shirt. It is kinda hard for me right now, since I don't really understand shaders as I already told you, sorry for asking much, I have never worked with shaders before.