SaNoR

Members
  • Content Count

    42
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SaNoR

  1. Don't be toxic, retard. I was talking about https://imgur.com/D76s3Rm
  2. It's sometimes happens when u copy code from forum, just write this line by yourself.
  3. 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)
  4. SaNoR

    pickup on key

    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)
  5. 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
  6. Use a multiline string. win.text = [[ 1st: Nickname 123 2nd: Nickname 13123 3nd: Nickname 141523 ]]
  7. 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)
  8. 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
  9. https://wiki.multitheftauto.com/wiki/Scripting_Introduction#Clientside_and_Serverside_scripts
  10. 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
  11. SaNoR

    Hex Name colors

    You're welcome.
  12. SaNoR

    Hex Name colors

    dxDrawText( un:O(killRow[r]["killerName"]), killRow[r]["killerNamePos"]["leftX"] + 1, killRow[r]["killerNamePos"]["topY"] + 1, killRow[r]["killerNamePos"]["rightX"] + 1, killRow[r]["killerNamePos"]["bottomY"] + 1, label_shadowColor, 1, label_font, "right", _, _, _, _, true) dxDrawText( killRow[r]["killerName"], killRow[r]["killerNamePos"]["leftX"], killRow[r]["killerNamePos"]["topY"], killRow[r]["killerNamePos"]["rightX"], killRow[r]["killerNamePos"]["bottomY"], killRow[r]["killerNameColor"], 1, label_font, "right", _, _, _, _, true) This should help. I just forgot to do it
  13. SaNoR

    Health problem

    I test it in local server and everything works fine. Maybe you're problem in "ArMoR" event.
  14. SaNoR

    Health problem

    function armor(loss) local Health = getElementHealth(source) local Armour = getPedArmor(source) if Armour - tonumber(loss) >= 0 then setPedArmor(source, Armour - tonumber(loss)) else setPedArmor(source, 0) end if getPedArmor(source) == 0 then setElementHealth(source, Health + (Armour - tonumber(loss))) end end addEvent("ArMoR", true) addEventHandler("ArMoR", getRootElement(), armor)
  15. SaNoR

    Hex Name colors

    function renderClientKillPanel () for r = 1, rows do if killRow[r] then dxDrawText( killRow[r]["killerName"], killRow[r]["killerNamePos"]["leftX"] + 1, killRow[r]["killerNamePos"]["topY"] + 1, killRow[r]["killerNamePos"]["rightX"] + 1, killRow[r]["killerNamePos"]["bottomY"] + 1, label_shadowColor, 1, label_font, "right", "top", _, _, _, true) dxDrawText( killRow[r]["killerName"], killRow[r]["killerNamePos"]["leftX"], killRow[r]["killerNamePos"]["topY"], killRow[r]["killerNamePos"]["rightX"], killRow[r]["killerNamePos"]["bottomY"], killRow[r]["killerNameColor"], 1, label_font, "right", "top", _, _, _, true) dxDrawImage( killRow[r]["reasonIconPos"]["leftX"], killRow[r]["reasonIconPos"]["topY"], icon_width, icon_height, imagePath[ killRow[r]["deathReason"] ] ) dxDrawText( killRow[r]["victimName"], killRow[r]["victimNamePos"]["leftX"] + 1, killRow[r]["victimNamePos"]["topY"] + 1, killRow[r]["victimNamePos"]["rightX"] + 1, killRow[r]["victimNamePos"]["bottomY"] + 1, label_shadowColor, 1, label_font, "right", "top", _, _, _, true) dxDrawText( killRow[r]["victimName"], killRow[r]["victimNamePos"]["leftX"], killRow[r]["victimNamePos"]["topY"], killRow[r]["victimNamePos"]["rightX"], killRow[r]["victimNamePos"]["bottomY"], killRow[r]["victimNameColor"], 1, label_font "right", "top", _, _, _, true) end end end addEventHandler ( "onClientRender", root, renderClientKillPanel )
  16. setTimer(function() if coroutine.status (clearing_nonexisting_peds) == "dead" then clearing_nonexisting_peds = coroutine.create(forgetNonExistingPeds) end coroutine.resume(clearing_nonexisting_peds) end, 1000, 0)
  17. function Exp(user, cmd, Player, Quantity) local AccountPlayer = getAccountName(getPlayerAccount(user)) if isObjectInACLGroup("user."..AccountPlayer, aclGetGroup("Admin")) then if Player and Quantity then local Playername = getPlayerFromName(Player) if Playername then if Quantity:match("^%d+$") then local lvl = getElementData(Playername, "Level") or 1 local exp = getElementData(Playername, "Exp") or 0 local Maximumprogress = getElementData(Playername, "maximumprogress") if tonumber(exp) + tonumber(Quantity) >= Maximumprogress then setElementData(Playername, "Level", tonumber(lvl) + 1) setElementData(Playername, "Exp", 0) else setElementData(Playername, "Exp", tonumber(exp) + tonumber(Quantity)) end else outputChatBox("Quantity must be a number.", user, 255, 0, 0) end else outputChatBox("Player not found.", user, 255, 0, 0) end else outputChatBox("/exp [Player, Quantity].", user, 255, 0, 0) end else outputChatBox("You don't have rights.", user, 255, 0, 0) end end addCommandHandler("exp", Exp)
  18. https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI#Relative_and_Absolute
  19. local sw, sh = guiGetScreenSize() local jumpTimer = 0 local reload = 3000 function jump() if getTickCount() - jumpTimer > reload then local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then local sx, sy, sz = getElementVelocity(vehicle) setElementVelocity(vehicle, sx, sy, sz+0.33) end jumpTimer = getTickCount() end end addEventHandler("onClientRender", root, function() local now = getTickCount() local endTime = jumpTimer + reload local elapsedTime = now - jumpTimer local duration = endTime - jumpTimer local progress = elapsedTime / duration local width = interpolateBetween(0, 0, 0, 200, 0, 0, progress, "Linear") dxDrawRectangle(sw/2 - 100, sh - 100, 200, 20, tocolor(0, 0, 0, 180)) dxDrawRectangle(sw/2 - 100, sh - 100, width, 20, tocolor(0, 255, 0, 180)) end) bindKey("lshift", "down", jump)
  20. function engine() local vehicle = getPedOccupiedVehicle(localPlayer) if isElement(vehicle) and getPedOccupiedVehicleSeat(localPlayer) == 0 then local state = getVehicleEngineState(vehicle) if not state then startTimer = setTimer( function() if isElement(vehicle) and getPedOccupiedVehicleSeat(localPlayer) == 0 then setVehicleEngineState(vehicle, true) end end , 2000, 1) else setVehicleEngineState(vehicle, false) end end end function resetEngine() if isTimer(startTimer) then killTimer(startTimer) end end bindKey("2", "down", engine) bindKey("2", "up", resetEngine)
  21. setElementCollisionsEnabled Note: Disabling a peds collisions will cause some problems, such as it being unable to move. setElementCollidableWith
  22. SaNoR

    [HELP] CallRemote

    https://wiki.multitheftauto.com/wiki/Template:Error_codes_for_callRemote_and_fetchRemote Try without "mtasa://" callRemote ( "XXX.XXX.XX.XXX:XXXXX",getResourceFromName('runcode'),'httpRun',finishedCallback,"outputChatBox('Text',root)" )