Other Languages Moderators
  • Content Count

  • Joined

  • Last visited

  • Days Won


Patrick last won the day on March 14

Patrick had the most liked content!

Community Reputation

202 Celebrity

About Patrick


  • Gang
  • Location

Recent Profile Visitors

2,413 profile views
  1. Oh.. you can't cancel client sided commands. Then, here is one way, how to limit commands on client side: local EXEC = {} function canUse(cmd, limit_sec) if not EXEC[cmd] then EXEC[cmd] = 0 end local lastuse = EXEC[cmd] local tick = getTickCount() if lastuse + ((limit_sec or 2) * 1000) > tick then return false end EXEC[cmd] = tick return true end -- EXAMPLE function yourFunction(cmd) -- Need to add this part to your functions if not canUse(cmd, 2) then return outputChatBox("#FF0000[ANTISPAM]#FFFFFF You can use this command once, in every 2 sec!") end -- your code ... end addCommandHandler("asd", yourFunction)
  2. First of all... stop spamming... And provide more informations about what are you doing, because it has to work.
  3. Here is my solution, I hope its good for you. local LIMITED_COMMANDS = { -- ["COMMAND_NAME"] = TIME_LIMIT_IN_SEC ["something"] = 5, -- Can use this command only once in every 5 sec ["spam"] = 10, -- Can use this command only once in every 10 sec } local EXEC = {} addEventHandler("onPlayerCommand", root, function(cmd) local limit_sec = LIMITED_COMMANDS[cmd] if not limit_sec then return end local tick = getTickCount() if not EXEC[source] then EXEC[source] = {} end if not EXEC[source][cmd] then EXEC[source][cmd] = 0 end if EXEC[source][cmd] + (limit_sec * 1000) > tick then cancelEvent() return outputChatBox("#FF0000[ANTISPAM]#FFFFFF You can use this command once, in every "..limit_sec.." sec.", source, 255, 255, 255, true) end EXEC[source][cmd] = tick end) addEventHandler("onPlayerQuit", root, function() EXEC[source] = nil end)
  4. This code from onPlayerCommand's wiki page, I just edited and put the command name check inside it. Hmm, looks like unnecessary.
  5. local CMD_INTERVAL = 200 --// The interval that needs to pass before the player can execute another cmd local KICK_AFTER_INTERVAL = 50 --// Kick the player if they execute more than 20 cmds/sec local limitedCommands = { ["something"] = true, ["othercommand"] = true, -- list of limited commands } local executions = setmetatable({}, { --// Metatable for non-existing indexes __index = function(t, player) return getTickCount()-CMD_INTERVAL end }) addEventHandler("onPlayerCommand", root, function(command) if limitedCommands[command] then if (executions[source]-getTickCount()<=CMD_INTERVAL) then if (executions[source]-getTickCount()<=KICK_AFTER_INTERVAL) then outputChatBox("Don't flood", source) end cancelEvent() end executions[source] = getTickCount() end end )
  6. Just replace kickPlayer function to your outputChatBox.
  7. Check example on onPlayerCommand
  8. Every time when player skin's change, you need to modify the walking style too.
  9. onMarkerHit, getElementType, setElementPosition, setElementInterior and setElementDimension
  10. Patrick

    Global Cheat

    I hope you think chat and not cheat Something like that. (its not the full code, you need to finish it!) -- SERVER function sendMessageToCustomChat(player, cmd, ...) -- TODO: check if `player` can use this command local text = table.concat({...}, " ") for i, target in ipairs(getElementsByType("player")) do -- TODO: check if `target` can see this message outputChatBox(text, target) end end addCommandHandler("chatcommand", sendMessageToCustomChat)
  11. And you try to use it on client side, right? (and on client side you can't use 10th argument of createMarker, because player who can see the marker, can be only localPlayer, so just remove it)
  12. Patrick


    Hi! You can find every information in previous post, where you wrote a comment. Please don't start new conversation about it..
  13. Some tutorial: (Check the whole channel)