Jump to content

JanKy

Members
  • Posts

    62
  • Joined

  • Last visited

1 Follower

Details

  • Gang
    Vaggos

Recent Profile Visitors

1,578 profile views

JanKy's Achievements

Snitch

Snitch (10/54)

4

Reputation

  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]
×
×
  • Create New...