Jump to content

JanKy

Members
  • Posts

    62
  • Joined

  • Last visited

Everything posted by JanKy

  1. Oh dude. Yes, that solved my problem, but i spent 5 minutes trying to notice what was i doing wrong because the debug script showed me this error "unexpected symbol near ' ", and it was pointing me to this line end) And when i was replying to you i noticed that you inserted ( by mistake i may guess ) a weird invisible character. Anyway, thank you for your kind help ^^ Have a nice day
  2. Hello, i get this error in my script. "ERROR : Server triggered clientside event setTheObjectUnbreakable, but event is not added clientside". It is a base-building script and i have some objects which are by default breakable, so i added a function to make them unbreakable, which looks like this function setTheObjectUnbreakable(object) setObjectBreakable(object,false) end addEvent("setTheObjectUnbreakable",true) addEventHandler("setTheObjectUnbreakable",root,setTheObjectUnbreakable) and then i use the event to the server sided script, when an object is created function createBuildObject(coords,model,id,health) if not coords or #coords ~= 6 or not model or not objectsList[model] or not id or idToObjects[id] then return true end if objectsList[model] then idToObjects[id] = {} local col = createColSphere(coords[1],coords[2],coords[3],2) colshapeElements[col] = id setElementData ( col, "build:shape", true ) setElementData ( col, "build:model", model ) setElementData ( col, "build:id", id ) setElementData ( col, "build:health", health or objectsList[model].damageTreshold or 0 ) for i, v in ipairs (objectsList[model].objects) do local obj = createObject(v.model,coords[1]+v.offset[1],coords[2]+v.offset[2],coords[3]+v.offset[3],coords[4]+v.offset[4],coords[5]+v.offset[5],coords[6]+v.offset[6]) triggerClientEvent("setTheObjectUnbreakable",root,obj) -- Here it is setElementData ( obj, "build:model", model ) setElementData ( obj, "build:id", id ) setElementData ( obj, "build:num", i ) setElementData ( obj, "build:object", true ) setElementData ( obj, "build:parent", col ) if v.scale then setObjectScale(obj,v.scale) end objectsElements[obj] = id table.insert(idToObjects[id],obj) end return col end end Everything works fine, the objects are unbreakable.. until i restart the resource and i get that error. The only part of the script which calls the createBuildObject function ( besides of course when the player starts building, but i am certain that has nothing to do with this ) is when the resource starts, the script loads the buildings from the database, and that makes sense, but i dont know why this is happening. Here is that part of the script db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS ObjectsList (ID INTEGER, model INTEGER, X REAL, Y REAL, Z REAL, RotX REAL, RotY REAL, RotZ REAL, inter INTEGER, dim INTEGER, additInfo1 TEXT, additInfo2 TEXT, additInfo3 TEXT, health INTEGER)") local data = dbPoll(dbQuery(db, "SELECT * FROM ObjectsList"), -1) for i, v in ipairs ( data ) do local col = createBuildObject({v.X,v.Y,v.Z,v.RotX,v.RotY,v.RotZ},v.model,v.ID,v.health) -- Here Thank you in advance ^^
  3. Oh, damn, thank you ^^. Here's how i did it. function onPlayerQuit ( ) local playeraccount = getPlayerAccount(source) setAccountData ( playeraccount, "dayzteam", getElementData(source,"gang") ) setAccountData ( playeraccount, "dayzrank", getElementData(source,"gang_leader") ) end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local oldTeam = getAccountData ( playeraccount, "dayzteam") local oldRank = getAccountData ( playeraccount, "dayzrank") setElementData(source,"gang",oldTeam) setElementData(source,"gang_leader",oldRank) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin )
  4. Hello, and sorry for asking so many questions. ( Yeah, i feel bad for making so many mistakes ) But i am trying to save a player's team name and rank in that team, before quiting, and load it back up when he joins. Here's my try : function saveBeforeQuit () oldTeam = getElementData(thePlayer,"gang"); idkrang = getElementData(thePlayer,"gang_leader"); end addEventHandler ( "onPlayerQuit", root, saveBeforeQuit) function loadOnJoin () if oldTeam ~= "None" and getElementData(thePlayer,"gang") ~= "None" then setElementData(thePlayer,"gang",oldTeam) setElementData(thePlayer,"gang_leader",idkrang) else setElementData(thePlayer,"gang","None") setElementData(thePlayer,"gang_leader","not") end end addEventHandler ( "onPlayerJoin", getRootElement(), loadOnJoin ) ( Where "gang_leader" stands for the rank ) And i get the following errors : Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Bad argument @ 'setElementData' [Expected element at argument 1, got nil] Bad argument @ 'setElementData' [Expected element at argument 1, got nil] I tried adding "source" instead of "thePlayer" but in that case, whenever a player joins, their team is set to the player that left before.
  5. Oh, damn. Thank you, all of you. Sometimes i don't see these "little" things. Problem solved ^^
  6. Absolutely no error in the debugscript. It is server sided, and all looks right. I changed the timer from "1000" which is a second to "100" ( which i believe it's the minimum ) and it almost works, but still flickers. But i don't think this is the right thing to do, tho'.
  7. I got the same thing but it flashes faster than in my video. I want it to be transparent continuously, not flickering or something.
  8. So, i've been working on this resource, and i want it to do the following thing : when a player wears a ghillie suit and stands still for 3 seconds, his player model goes a little bit transparent, like "blending with the environment". Here is the code : Client Side : function getPlayerStance () currentskin = getElementData (localPlayer, "skin") if currentskin == 285 then if getPedMoveState (localPlayer) == "stand" or getPedMoveState (localPlayer) == "crouch" then triggerServerEvent ("onPlayerGhillieStateOn", localPlayer) else triggerServerEvent ("onPlayerGhillieStateOff", localPlayer) end else triggerServerEvent ("onPlayerGhillieStateOff", localPlayer) end end setTimer (getPlayerStance, 3000,0) Server Side : function onPlayerGhillieStateOn () setElementAlpha (client, 50) end addEvent ("onPlayerGhillieStateOn" , true) addEventHandler ("onPlayerGhillieStateOn", root, onPlayerGhillieStateOn) function onPlayerGhillieStateOff () setElementAlpha (client, 255) end addEvent ("onPlayerGhillieStateOff", true) addEventHandler ("onPlayerGhillieStateOff", root, onPlayerGhillieStateOff) And i managed to only get this working : Thanks in advance ^^
  9. Thank you very much. It solved my problem ^^
  10. I know what a boolean is. True or false. But i don't understand how the variable "Radio Device", which changes, because it's a dayz server and that thing is an item and it is a *number*, was converted ( somehow ? ) to a boolean. Here is that specific part of the code. addCommandHandler("radiochat", function(player, _, ...) if (getElementData(player, "Radio Device") >= 1) then for _,v in ipairs(getElementsByType("player")) do if (getElementData(v, "Radio Device") >= 1) then if (getElementData(v, "radiochannel") == getElementData(player, "radiochannel")) then outputChatBox("#BCC643[Radio] "..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").." : #d0e1e1"..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true); end end end else return end end); The thing is that i don't get the error on the first if which compares almost the same way the variable "Radio Device", but on the second if. And i don't know what is the problem. I bet it is something stupid and i don't see it.. ;/ Thanks in advance ^^
  11. JanKy

    Gang Kick

    Solved it, thanks anyway ^^
  12. Hello, How do i remove non-collidable world objects, especially night lights in buildings, such as this one? By the way, i know the object is either burgershotneon, or burgershotneon02. I tried adding this code in server-side ( i believe that is correct ) but no effect. removeWorldModel(7944,1000,2474,2020,13) removeWorldModel(7943,1000,2474,2020,13) And also, i knew there existed a resource which remove all these types of objects. But i forgot to download it, and also forgot its name. Does anyone know it?
  13. JanKy

    Gang Kick

    I don't think i need to add an element data. I mean, my only question for you all i why does this work if (intention == "leave") then local team = getPlayerGang(client); local rank = getPlayerGangRank(client); if (rank == "Sub Leader") then dbExec(db, "UPDATE `teams` SET `subleader`=? WHERE `name`='"..team.."'", ""); end outputTeamChat(getPlayerName(client).." left the team.", team); removeElementData(client, "gang"); removeElementData(client, "gang.rank"); local acc = getPlayerAccount(client); setAccountData(acc, "gang", nil); dbExec(db, "DELETE FROM `team_acc` WHERE `username`=?", getAccountName(acc)); gangUpdate(team); triggerClientEvent(client, "gang.close", client); and this does not work elseif (intention == "kick") then for _,acc in ipairs(getAccounts()) do local accName = getAccountName(acc); if (accName == player) then local accRank = getAccountGangRank(accName); if (accRank ~= "Sub Leader") then if (accRank ~= "Leader") then outputTeamChat(player.." was kicked from the team by #ffffff"..getPlayerName(client), team); removeElementData(player, "gang"); removeElementData(player, "gang.rank"); local accp = getPlayerAccount(player); setAccountData(accp, "gang", nil); dbExec(db, "DELETE FROM `team_acc` WHERE `username`=?", getAccountName(accp)); gangUpdate(team); end end end end *PS : I am sorry, by "the name of the player i try to kick" i mean "the name of the account of the player i try to kick", so that works all fine
  14. JanKy

    Gang Kick

    So, i did this elseif (intention == "kick") then for _,acc in ipairs(getAccounts()) do local accName = getAccountName(acc); if (accName == player) then local accRank = getAccountGangRank(accName); if (accRank ~= "Sub Leader") then if (accRank ~= "Leader") then outputTeamChat(player.." was kicked from the team by #ffffff"..getPlayerName(client), team); removeElementData(player, "gang"); removeElementData(player, "gang.rank"); local accp = getPlayerAccount(player); setAccountData(accp, "gang", nil); dbExec(db, "DELETE FROM `team_acc` WHERE `username`=?", getAccountName(accp)); gangUpdate(team); end end end end Which i think it is very correct, i mean the leave intention, which mentioned before, is pretty close to this one. But that one still works, and this one not. And i get these in debugscript Bad argument @ 'removeElementData' [Expected element at argument 1, got string 'the name of the player i try to kick'] Bad argument @ 'removeElementData' [Expected element at argument 1, got string 'the name of the player i try to kick'] Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'the name of the player i try to kick'] Bad argument @ 'setAccountData' [Expected element at argument 1, got boolean] Bad argument @ 'getAccountName' [Expected element at argument 1, got boolean]
  15. Oh, silly me. Wasn't on client side. But now it is, like this : addEventHandler("onPlayerVehicleEnter", root, function() if getRadioChannel() ~= 0 then setRadioChannel(0) cancelEvent() end end); No errors, but the radio still works. Any ideas to make it stop?
  16. Umm, hey guys. I don't understand why i get this error in the debugscript : "attempt to call 'getRadioChannel' ( a nil value )" Also, even if i use setRadioChannel alone, i get the same error : "attempt to call 'setRadioChannel' ( a nil value )" Also, here's the code if getRadioChannel() ~= 0 then setRadioChannel(0) cancelEvent() end
  17. Ohhh.. Nevermind, guys. I solved it.
  18. JanKy

    Gang Kick

    Hi guys, Can someone help me understand what am i doing wrong? I mean, i have a gang resource for my DayZ server and the kick function wont work properly. I mean, the leave function works fine But, when i try to kick a friend, it gets kicked out of the gang but it still remains in tab as in that gang, and can open the gang panel ( F2 ) but it is empty. I even tried to replace nil with "None" because that's the default value for every player which isn't part of any group. Thanks in advance.
  19. Hi guys, So I have this DayZ server, and i noticed that no vehicle is working. I mean, even though they have the parts needed, their engine wont start. I thought it was because setVehicleEngineState. *Also, i have commented out the backup part of the script, because firstly i thought it was because of that vehicles.lua :
  20. Its kilLDayZPlayer on my gamemode too, but it didnt removed the effect after i died. Also, i fixed the 15 min problem. Apparently, after you handcuff someone you cant handcuff them again. This and, you cant handcuff multiple players at the same time. Can this be fixed too? EDIT : Yep, i tested. For some reason, you can handcuff a person once in a lifetime, even tho you have multiple handcuffs on you.
  21. Hi guys, So, someone helped me make an handcuff function, but it has some issues. Like, if someone dies handcuffed he has that effect even when he respawns. putAnotherPlayerInCuffsS = function(playa) if not getElementData(playa,"inCuffs") and not getElementData(playa,"isDead") and getElementData(source,"Handcuffs") >= 1 then setElementData(source,"Handcuffs",getElementData(source,"Handcuffs")-1) setPedAnimation(playa,"ped","IDLE_tired",-1,true,false,false) toggleAllControls(playa,false,true,false) toggleControl(playa,"jump",false) setElementData(playa,"inCuffs",true) outputChatBox("You were handcuffed for 90 seconds!",playa,150,50,100) setTimer(function(player) if isElement(player) then if getElementData(player,"inCuffs") then setElementData(player,"inCuffs",false) if not getElementData(player,"inComa") then toggleAllControls(player,true) setPedAnimation(player,false) end end end end, 90000, 1,playa) end end addEvent("putAnotherPlayerInCuffs", true) addEventHandler("putAnotherPlayerInCuffs", getRootElement(), putAnotherPlayerInCuffsS) Also, i wanted to make it last like 5 minutes, or 15, but if i change that, it doest work anymore. EDIT: It works for 5 minutes now, but im still not sure about 15. And i was thinking about adding some keys for the handcuffs. Any ideas? Thanks in advance.
  22. It is already on server-side, and i changed the event from onClientPlayerWeaponSwitch to onPlayerWeaponSwitch and its the same thing
  23. oh, thanks, half done, it works for me and for others but i see other players running with the normal animation, but faster. ( and they see me the same ) i mean it works but it looks glitchy
  24. Hey guys, does someone know what can you do to sprint with main weapons like m4/ak47/sniper? i mean i've seen it on other servers and somehow i got it bugged on mine but it works only for my character, and that thing remembered me of that bug, and i know i can do it somehow. Thanks in advance
×
×
  • Create New...