Jump to content

SaNoR

Members
  • Posts

    45
  • Joined

  • Last visited

  • Days Won

    1

SaNoR last won the day on October 15 2018

SaNoR had the most liked content!

1 Follower

Recent Profile Visitors

1,355 profile views

SaNoR's Achievements

Rat

Rat (9/54)

18

Reputation

  1. addEventHandler("onPlayerDamage", root, function(attacker, weapon, part) if part == 9 and isElement(attacker) and attacker ~= source then killPed(source, attacker, weapon, part) end end)
  2. Maybe this will help debugSleep
  3. addEventHandler("onPlayerJoin", root, function() local ip = getPlayerIP(source) local function displayPlayerCity(resp, errno, source) if errno == 0 then local data = fromJSON("[".. resp .. "]") local status = data["status"] or "fail" if status == "success" then if isElement(source) then outputChatBox(getPlayerName(source).." has joined the game ("..data["city"]..", "..data["country"]..")", root, 255, 100, 100) end else if isElement(source) then outputChatBox(getPlayerName(source).." has joined the game.", root, 255, 100, 100) end outputDebugString("JOINQUIT: Cannot retrieve network details") end else outputDebugString("JOINQUIT: Error @fetchRemote, ERRNO: "..errno) end end fetchRemote("http://ip-api.com/json/" .. ip, displayPlayerCity, "", false, source) end, true, "low")
  4. Don't be toxic, retard. I was talking about https://imgur.com/D76s3Rm
  5. It's sometimes happens when u copy code from forum, just write this line by yourself.
  6. Something like this function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function aBan(source, cmd, nickname, time, ...) if (hasObjectPermissionTo(source, "function.banPlayer", false)) then time = tonumber(time) if nickname and time then local b_player, b_serial, b_time, b_reason = getPlayerFromPartialName(nickname), "", 1, "" if isElement(b_player) then b_serial = getPlayerSerial(b_player) b_time = getRealTime().timestamp + (time * 86400) if #{...} ~= 0 then b_reason = table.concat({...}, " ") end if kickPlayer(b_player, source, b_reason) then -- INSERT TO MYSQL b_serial, b_time, b_reason outputChatBox(getPlayerName(b_player).." has been banned by "..getPlayerName(source)..". ("..time.." day"..(time == 1 and ")" or "s)"), root, 255, 0, 0) end end else outputChatBox("/aban [Nickname] [Days] [Reason]", source, 255, 0, 0) end end end addCommandHandler("aban", aBan) addEventHandler("onPlayerJoin", root, function() local serial = getPlayerSerial(source) -- SELECT PLAYER SERIAL FROM DB if #result ~= 0 then -- IF FOUND if getRealTime().timestamp < result.b_time then kickPlayer(source, os.date("%Y-%m-%d %H:%M:%S", result.b_time)) end end end)
  7. function showAmmoGUI(hitPlayer) triggerClientEvent(hitPlayer, "showAmmoGUI_Ed", getRootElement(), hitPlayer, marker) end addEventHandler("onPlayerPickupHit", marker, function() bindKey(source, "N", "down", showAmmoGUI) end) addEventHandler("onPlayerPickupLeave", marker, function() unbindKey(source, "N", "down", showAmmoGUI) end)
  8. SaNoR

    wanted level

    -- player's screen size width * (icon size / you'r screen size width) -- same with height local sw, sh = guiGetScreenSize() local mineX, mineY = 1280, 720 -- you'r current screen resolution (from video setting) local icon_width, icon_height = sw * (20 / mineX), sh * (20 / mineY) -- star.png width, height local space = sw * (1 / mineX) -- space between icons local x, y = sw - icon_width - sw * (50 / mineX), sh * 0.5 -- x, y position
  9. Use a multiline string. win.text = [[ 1st: Nickname 123 2nd: Nickname 13123 3nd: Nickname 141523 ]]
  10. SaNoR

    wanted level

    local sw, sh = guiGetScreenSize() local icon_width, icon_height = 20, 20 -- star.png width, height local space = 1 -- space between icons local x, y = sw - icon_width - 50, sh * 0.5 -- x, y position addEventHandler("onClientRender", root, function() for i = 1, getPlayerWantedLevel() do dxDrawImage(x + (icon_width + space) - i * (icon_width + space), y, icon_width, icon_height, "star.png") end end)
  11. Use loop As example: function updateScoreboard() scoreboard = {} for _, player in ipairs(getElementsByType("player")) do if not getPlayerTeam(player) then for n = 1, 10 do table.insert(scoreboard, {"player", player}) end end end
  12. https://wiki.multitheftauto.com/wiki/Scripting_Introduction#Clientside_and_Serverside_scripts
  13. SaNoR

    Dx Visibility

    function Dx () if getPlayerTeam(localPlayer) == getTeamFromName("Admins") then dxDrawText("text", 1, 1, 1, 1, tocolor(250, 120, 4, 255), 7.00, "bankgothic", "center", "center", false, false, false, false, false) end end
×
×
  • Create New...