Jump to content

Addlibs

Members
  • Posts

    1,060
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Addlibs

  1. You do not need to kill the timer. Once the timer finishes executing code it kills itself, that is, unless it is indefinite.
  2. Addlibs

    Chat type

    Those numbers aren't chat types, but rather the parameters sent by onPlayerChat. And yes, I suppose it is possible if you trigger that event yourself with your own parameters.
  3. http://www.catb.org/esr/faqs/smart-questions.html
  4. Seriously do some research before asking for help. The community won't help you with every single script for your (allegedly cloned) server.
  5. Show the code with 'bindKey' function.
  6. I hope you do realise a meta.xml isn't actually scripting.
  7. First of all, to change it from being a black square, into a transparent-background square, add true as the 3rd parameter on dxCreateRenderTarget (line 3) Secondly, on line 11, you should change the positions of the text, since your render target is 800x700, and your text starts on Y 790, it is 90 pixels below the cut-off point. It should start at (0,0) and end at (800,700) to fill up the whole render target material, which will later be drawn in the correct position.
  8. If you're using localPlayer variable I assume the code is client side. bindKey clientside does not take first argument as the player who's key to bind. Just remove "localPlayer" argument from first argument.
  9. Which version of DayZ are you using? The new open-source version or the older one?
  10. function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) local r, g, b = getPlayerNametagColor(thePlayer) local fromHex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) local tr, tg, tb = getPlayerNametagColor(toPlayer) local toHex = string.format("#%.2X%.2X%.2X", tr, tg, tb) -- converts R, G, B to HEX value if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("(WHISPER) To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) outputChatBox("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) setElementData(thePlayer,"pmPartner",toPlayer) triggerClientEvent(toPlayer,"onBeep",getRootElement ()) setElementData(toPlayer,"pmPartner",thePlayer) outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) -- outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. " To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) -- what even is this? else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF You cannot whisper yourself", thePlayer, 255, 255, 255, true) return false end else outputChatBox("(WHISPER) Player not found "..sendToName, thePlayer, 255, 0, 90, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("w", privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
  11. Then push an argument when calling that event - don't expect the script to know what vehicle you're talking about without informing it.
  12. On line 4 of 2nd code you should put vehicle as the first parameter.
  13. The obfuscation, as I believe, is an RSA (or some other) encryption. As you probably know, nothing is instantaneous - decryption takes some time and I guess it can take quite a while to decrypt very large scripts before they're loaded into memory. This might be a reason as to why it isn't forced.
  14. Addlibs

    Rank emblem

    Images in scoreboard are defined in element data in the format of a table, such as the following (applies only to default scoreboard resource) { ["type"] = "image", ["src"] = ":resource/file.ext", -- must include ':resource' part as the scoreboard resource will otherwise look within its own directory for the image (afaik). ["color"] = tocolor(255,255,255,255), ["width"] = 20, ["height"] = 20, } -- Code adapted from 'voice' resource.
  15. Line 4-5 — You're just collecting the Hex of the sender, never the recipient's Line 17 — May I know what that is for? Line 28 — How do you even want to use hex on the name of a player who doesn't exist when a non-existent player doesn't have name colour. Here's the corrected code: function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) local r, g, b = getPlayerNametagColor(thePlayer) local fromHex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) local tr, tg, tb = getPlayerNametagColor(thePlayer) local toHex = string.format("#%.2X%.2X%.2X", tr, tg, tb) -- converts R, G, B to HEX value if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("(WHISPER) To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) outputChatBox("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) setElementData(thePlayer,"pmPartner",toPlayer) triggerClientEvent(toPlayer,"onBeep",getRootElement ()) setElementData(toPlayer,"pmPartner",thePlayer) outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. ":#FFFFFF " .. pmMessage, toPlayer, 255, 0, 90, true) -- outputServerLog("(WHISPER) From " ..fromHex.. getPlayerName(thePlayer) .. " To " ..toHex.. getPlayerName(toPlayer) .. ":#FFFFFF " .. pmMessage, thePlayer, 255, 0, 90, true) -- what even is this? else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF You cannot whisper yourself", thePlayer, 255, 255, 255, true) return false end else outputChatBox("(WHISPER) Player not found "..sendToName, thePlayer, 255, 0, 90, true) return false end else outputChatBox("#E8037E(WHISPER)#FFFFFF Invalid syntax! Usage:#FFFFFF /w [player name] [message]", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("w", privateMessage) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
  16. 1) mysql_escape_string needs the connection handler as first argument, the string-to-escape goes second 2) It's better to use db* functions in my opinion.
  17. Multiply the duration by another 60 again (duration is in second by default, 1 second * 60 * 60 = 3600 seconds = 1 hour). If you want banning in hours exclusively, use math.abs() to covert the given value to an absolute number, that is, a whole, non-negative number. That way, the given value will have to be always a full hour (0.5 hours won't work as 30 minutes). Otherwise, be sure to check whether the give value is over 0 as you don't want to give bans for 0 or -1 or less hours.
  18. As iMr.Omar said, isTransferBoxActive will tell you whether a download is in progress, but you may want to use onClientResourceStart to know whether a specific resource has finished downloading and has been loaded.
  19. 1) By 'incorrect', I did not mean 'incorrect way' I mean that your statement was incorrect - you do not have to add 'and true' 2) The proper way is the most efficient way — don't add unnecessary bytes by adding redundant parts to a script. That is called being inefficient.
  20. Change 'text' to 'message' in both outputChatBox (line 11 and 14)
  21. That's pretty incorrect. You don't have to do that.
  22. Addlibs

    help

    engineApplyShaderToWorldTexture?
  23. bool setWorldSoundEnabled( int group, [ int index = -1, ] bool enable )If index is not specified, it assumes it's -1, and -1 means 'all of the group.' If you want to block a specific sound, use development mode function to find the exact sound group and index, and just disable it using the above function.
  24. Addlibs

    Pm problem

    Line 11 and 19 shouldn't be local. If you want them to be local on the function scope only (so that the variable is forgotten once function is executed), just declare local toColor after line 3
  25. It it's 'onPlayerChat' now, you need to edit the function intake arguments - there's no thePlayer (it's the source in this case) Delete local message = table.concat({ ... }, " ") -- line 4 Change local name = getPlayerName(thePlayer) -- line 6 local r, g, b = getPlayerNametagColor(thePlayer) --line 7 to local name = getPlayerName(source) local r, g, b = getPlayerNametagColor(source) And change function localMessage (thePlayer, cmd, ...) -- line 3 to function localMessage(message, chatType)
×
×
  • Create New...