Jump to content

myonlake

Members
  • Posts

    2,312
  • Joined

  • Days Won

    41

Everything posted by myonlake

  1. Solidsnake, I know you like to help, but I am preferring to let the first answerer solve the situation - this is not a competition, even though you and Kenix make it look like one.
  2. myonlake

    Skin

    Hello, not sure if you're new around here, but welcome anyways. First I'd like to show you these functions. engineReplaceModel engineLoadTXD engineLoadDFF
  3. Copy the script again, let me know.
  4. Try this. I had to remove the lua-tags since they're bugged. local admins = "" local SuperModerator = "" function processAdminList() players = getElementsByType("player") for k,v in ipairs(players) do local accountname = "" if not isGuestAccount(getPlayerAccount(v)) then local accountname = getAccountName(getPlayerAccount(v)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then if admins == "" then admins = admins .. " | " .. getPlayerName(v) end end if isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) then if SuperModerator == "" then SuperModerator = SuperModerator .. " | " .. getPlayerName(v) end end end end outputChatBox("* Admins: #307D7E" .. tostring(admins), root, 255, 255, 0, true) outputChatBox("* SuperModerator: #307D7E" .. tostring(SuperModerator), root, 255, 255, 0, true) end
  5. It's server-side, and it needs to be server-side if your service scripts are using MTA money server-side. Client-side given money will not work in server-side.
  6. Command: /givemoney Function: Gives specified amount (see "local cash") of money to all online players with a specified amount of cooldown. local cash = 1000 -- Cash amount local cooldown = false local cooldowntime = 1 -- Seconds before cooldown ends addCommandHandler("givemoney", function(player, cmd) if cooldown then for i,v in ipairs(getElementsByType("player")) do if player ~= v then givePlayerMoney(v, tonumber(cash)) cooldown = true outputChatBox(getPlayerName(player) .. " has given you $" .. tonumber(cash), v, 220, 220, 0, false) setTimer(function() cooldown = false end, tonumber(cooldowntime) * 1000, 1) end end outputChatBox("Gave " .. tonumber(cash) .. " to all online players.", player, 0, 255, 0, false) else outputChatBox("Cooldown in effect! You need to wait before giving money again.", player, 255, 0, 0, false) end end ) Command: /givemoney Function: Gives specified amount (amount value in /givemoney) of money to all online players with a specified amount of cooldown. local cooldown = false local cooldowntime = 1 -- Seconds before cooldown ends addCommandHandler("givemoney", function(player, cmd, amount) if amount then if tonumber(amount) and tonumber(amount) > 0 then if cooldown then for i,v in ipairs(getElementsByType("player")) do if player ~= v then givePlayerMoney(v, tonumber(amount)) cooldown = true outputChatBox(getPlayerName(player) .. " has given you $" .. tonumber(amount), v, 220, 220, 0, false) setTimer(function() cooldown = false end, tonumber(cooldowntime) * 1000, 1) end end outputChatBox("Gave " .. tonumber(amount) .. " to all online players.", player, 0, 255, 0, false) else outputChatBox("Cooldown in effect! You need to wait before giving money again.", player, 255, 0, 0, false) end else outputChatBox("Money amount must be over 0.", player, 255, 0, 0, false) end else outputChatBox("Syntax: /givemoney ", player, 220, 220, 0, false) end end )
  7. https://wiki.multitheftauto.com/wiki/OnPlayerStealthKill
  8. lock = false join = false players = 0 addCommandHandler("startgame", function(player, cmd) if lock then outputChatBox("Fastest typer game started - join with /joingame.", root, 255, 255, 0, false) setTimer(closeJoining, 60000, 1) lock = true else outputChatBox("Game is already running!", player, 255, 0, 0, false) end end ) addCommandHandler("joingame", function(player, cmd) if join then if not getElementData(player, "moneygame") then players = tonumber(players) + 1 setElementData(player, "moneygame", 1) outputChatBox(getPlayerName(player) .. " has joined the money game!", root, 0, 255, 0, false) else outputChatBox("You're already participating the game!", player, 255, 0, 0, false) end else outputChatBox("Game is not started or is running already!", player, 255, 0, 0, false) end end ) function closeJoining() if players > 1 then join = false outputChatBox("Money game is now locked - game starts in 20 seconds!", root, 255, 0, 0, false) setTimer(outputChatBox, 20000, 1, "Money game started! Say 'money' first to win!", root, 255, 255, 255, false) else players = 0 outputChatBox("Money game was not started due not enough players.", root, 255, 0, 0, false) end end addEventHandler("onPlayerChat", root, function(message, messageType) if messageType == "0" and string.find(message, "money") then if getElementData(source, "moneygame") then cancelEvent() outputChatBox(getPlayerName(source) .. " was first and won $100!", root, 255, 255, 0, false) givePlayerMoney(source, 100) for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "moneygame") then outputChatBox("Sorry you lost the game!", v, 255, 0, 0, false) removeElementData(v, "moneygame") end end players = 0 end end end ) EDIT: Looks like you did it already.. well here's mine.
  9. Won't work. It will always reset it and all will be winners. Make a function to start the competition and then the first one saying the word wins. When you type /startspeedtest it will wait for a minute and those who joined will be added in the game, more than one player. And if you wrote faster than a second, you will fail because of bind/F8. Or depends how long word.
  10. myonlake

    question

    How do you give health? - command - GUI - marker/object/other events Almost everytime I've replied, I have told you how to make the one simple chatbox message, please, read!
  11. myonlake

    question

    Oh my god. That makes no sense. I am gonna go sleep now, good luck... and I am still suggesting my previous page examples. Unless if you want something else. This small thing and 2 pages of "dafaq?", bitch please :3
  12. myonlake

    question

    function giveHealth(player, name, value) local accountName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. accountName, aclGetGroup("Admin")) then local health = tonumber(value) local target = getPlayerFromName(name) if health and target then outputChatBox(getPlayerName(player) .. " has given " .. getPlayerName(target) .. " " .. health .. "% of health.", root, 255, 255, 0) end end end
  13. myonlake

    question

    Try this. addCommandHandler("givehealth", function(player, cmd, name, value) if hasObjectPermissionTo(player, "command.ban") then if name and value then if tonumber(value) then local target = getPlayerFromPartialName(name, player) if target then if tonumber(value) > 0 and tonumber(value) <= 100 then setElementHealth(target, getElementHealth(target) + tonumber(value)) outputChatBox(getPlayerName(player) .. " has given " .. getPlayerName(target) .. " health with value " .. tonumber(value) .. ".", root, 220, 220, 0, false) else outputChatBox("Health's minimum value is 1 and maximum is 100.", player, 255, 0, 0, false) end else outputChatBox("No players or multiple were found.", player, 255, 0, 0, false) end else outputChatBox("Health value must be numbers.", player, 255, 0, 0, false) end else outputChatBox("Syntax: /givehealth .", player, 220, 220, 0, false) end else outputChatBox("No sufficent privileges (admin level required).", player, 255, 0, 0, false) end end ) local function getPlayerFromPartialName(name, player) if name then local matches = {} for index, _player in ipairs(getElementsByType("player")) do if getPlayerName(_player) == name then return _player end if getPlayerName(_player):gsub("#%x%x%x%x%x%x", ""):lower():find(name:lower()) then table.insert matches, _player) end end if #matches == 1 then return matches[1] else if player then outputChatBox("Found " .. #matches .. " matches.", player, 255, 0, 0) end end end end
  14. myonlake

    question

    As I entered an example before, here it is again with few changes... outputChatBox(getPlayerName(player) .. " has given " .. getPlayerName(target) .. " health with value " .. tonumber(health) .. ".", root, 255, 0, 0, false) Gosh. I made a long reply and you didn't read it.
  15. myonlake

    question

    Or do you want it to output the message to all players in the server? Or yourself? Or your team? No admin panel is mixed in this, leave it out. We'll do this with commands unless you make the GUI. You want it like: /givehealth and check if he's in your team? or /givehealth and give you health. Or /givehealth or /givehealth Explain better, please
  16. myonlake

    question

    Wait what? You want to know how much has the admin given health to the player? Read my examples.
  17. First of all, that wasn't all of it. Let me give you an example, how do you find out vehicle health? I am in a vehicle, alright. addCommandHandler("vhealth", function(player, cmd) local vehicle = getPedOccupiedVehicle(player) if vehicle then outputChatBox("Vehicle health: " .. tonumber(getElementHealth(vehicle)) .. ".", player, 220, 220, 0, false) else outputChatBox("You're not in a vehicle.", player, 255, 0, 0, false) end end ) Try to use that for your edits on the HUD.
  18. myonlake

    question

    addCommandHandler hasObjectPermissionTo setElementHealth outputChatBox getPlayerName Just a small fix for your outputChatBox function usage. outputChatBox("You've set " .. getPlayerName(target) .. "'s health to " .. tonumber(health) .. ".", player, 255, 255, 255, false) outputChatBox(getPlayerName(player) .. " set your health to " .. tonumber(health) .. ".", target, 255, 255, 255, false) Remember to find the player's name first and make a local of the function like this. getPlayerFromPartialName function. local function getPlayerFromPartialName(name, player) if name then local matches = {} for index, _player in ipairs(getElementsByType("player")) do if getPlayerName(_player) == name then return _player end if getPlayerName(_player):gsub("#%x%x%x%x%x%x", ""):lower():find(name:lower()) then table.insert matches, _player) end end if #matches == 1 then return matches[1] else if player then outputChatBox("Found " .. #matches .. " matches.", player, 255, 0, 0) end end end end This is the local for the set health script. local target = getPlayerFromPartialName(name, player) And the rest you'll need to do yourself. addCommandHandler("sethp", function(player, cmd, name, health) if ?!?! then -- Something goes here if ?!?! then -- Something goes here if ?!?! then -- Something goes here local target = getPlayerFromPartialName(name, player) if ?!?! then -- Something goes here -- Your script else -- Alternative outputs end else -- Alternative outputs end else -- Alternative outputs end else -- Alternative outputs end end ) local function getPlayerFromPartialName(name, player) if name then local matches = {} for index, _player in ipairs(getElementsByType("player")) do if getPlayerName(_player) == name then return _player end if getPlayerName(_player):gsub("#%x%x%x%x%x%x", ""):lower():find(name:lower()) then table.insert matches, _player) end end if #matches == 1 then return matches[1] else if player then outputChatBox("Found " .. #matches .. " matches.", player, 255, 0, 0) end end end end
  19. myonlake

    Need Scripter

    I am able to make any kind of scripts, however the only problem is time and payment. I am redirecting you straight to https://community.multitheftauto.com/ because buying scripters isn't the first way to do these things.
  20. local vehicle = getPedOccupiedVehicle(localP) You should be able to do the rest.
  21. JR10's script works just fine, this ones just a little bit organized. local PingTable = {} function PingCheck(source) if getPlayerPing(source) > tonumber(get("MaxPing")) then kickPlayer(source, "High Ping") else outputConsle(getPlayerName(source) .. " has passed the ping check.") end end addEventHandler("onPlayerJoin", getRootElement(), function() table.insert(PingTable, setTimer(PingCheck, tonumber(get("Delay")), 1, source) end )
  22. local playerBlips = {} addEventHandler("onPlayerSpawn", getRootElement(), function createBlipAttachedTo() local account = getPlayerAccount(source) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if isObjectInACLGroup("user." .. accountName, aclGetGroup("Admin")) then if isElement(playerBlips[source]) then destroyElement(playerBlips[source]) end local playerBlips[source] = createBlipAttachedTo(source, 0, 2, 0, 0, 0, 255, 0, 99999.0, 0) end end ) addEventHandler("onPlayerQuit", getRootElement(), function() destroyElement(playerBlips[source]) playerBlips[source] = nil end ) addEventHandler("onPlayerWasted", getRootElement(), function() destroyElement(playerBlips[source]) playerBlips[source] = nil end )
  23. GTA object: original map object. MTA object: created via a script/map editor.
  24. You're not a lead admin then, Esh.
×
×
  • Create New...