Jump to content

Patrick

Moderators
  • Posts

    1,143
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by Patrick

  1. local sp2 = getVehicleNitroLevel(car) if sp2 and sp2*180 > 1 then sp2 = sp2*180 ... end
  2. Very simple codes, but it was stolen and annoyed me #1 original: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15863 #1 stolen: https://community.multitheftauto.com/index.php?p=resources&s=details&id=16030 #2 original: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15525 #2 stolen: https://community.multitheftauto.com/index.php?p=resources&s=details&id=15937
  3. You want to show the timestamp before every line on the chat? (or I do not understand...) This is my last tip. This little script show the timestamp before EVERY(!) line on the chat. -- CLIENT SIDE SCRIPT !!! local function getFirstColorCode(text) local s, e = text:find("#%x%x%x%x%x%x") return (s and e) and text:sub(s, e) or "#FFFFFF" end local function getTimePrefix() local realtime = getRealTime() return "[" .. string.format("%02d:%02d:%02d", realtime.hour, realtime.minute, realtime.second) .. "] " end addEventHandler("onClientChatMessage", root, function(text, r, g, b) if not text:find("%d%d:%d%d:%d%d") then cancelEvent() outputChatBox(getFirstColorCode(text) .. getTimePrefix() .. text, r, g, b, true) end end)
  4. local function getFirstColorCode(text) local s, e = text:find("#%x%x%x%x%x%x") return (s and e) and text:sub(s, e) or "#FFFFFF" end local function getTimePrefix() local realtime = getRealTime() return "[" .. string.format("%02d:%02d:%02d", realtime.hour, realtime.minute, realtime.second) .. "] " end addEventHandler("onPlayerChat", root, function(text, msgtype) if msgtype == 0 then cancelEvent() local text = getPlayerName(source) .. ": #ebddb2" .. text outputChatBox(getFirstColorCode(text) .. getTimePrefix() .. text, root, 255, 255, 255, true) end end) Do you mean something like that?
  5. I don't really understand what you want to do. Simply put the color code at the beginning of the text.
  6. Try, like this: dbExec(b_data, "INSERT INTO bank (bank_username,bank_pass,bank_ques,bank_answ,bank_money) VALUES (?,?,?,?,?)", b_username, b_pass, b_ques, b_answ, b_money)
  7. You can't hide it. But, I think you want to create a "DX-Editbox". (Because of the previous topic) Maybe, this is useful: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10804
  8. Is that what you mean? function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function getElementBackPosition(element) local x, y, z = getElementPosition(element) local _, _, rot = getElementRotation(element) local x, y = getPointFromDistanceRotation(x, y, 0.5, -rot + 180) return x, y, z end (https://wiki.multitheftauto.com/wiki/GetPointFromDistanceRotation)
  9. Send the full code
  10. Patrick

    help

    One of your coordinates (x5 or y4) is not definied. ("at argument 1", so x5 is equal to nil)
  11. setTimer (i think)
  12. -- SERVER SIDE function saveLog(text, fileName) if text and fileName then local path = "logs/"..fileName..".log" if not fileExists(path) then fileCreate(path) end local file = fileOpen(path) local fileSize = fileGetSize(file) fileSetPos(file, fileSize) fileWrite(file, text.."\n") fileClose(file) return true end return false end Something like that not tested
  13. source is not defined. Paste the full code.
  14. outputConsole("[TOPBAR] "..text:gsub("#%x%x%x%x%x%x","")) --this is the one
  15. Fixed code -- SERVER SIDE function jumpWithVehicle(playerWhoPressedTheButton) if not isPedInVehicle(playerWhoPressedTheButton) then return end -- kill function if player is not in vehicle local vehicleElement = getPedOccupiedVehicle(playerWhoPressedTheButton) -- we know player is in a vehicle, so get the vehicle's element if getVehicleController(vehicleElement) ~= playerWhoPressedTheButton then return end -- check player is who drive this vehicle (if not -> kill function) local playerAccountName = getAccountName(getPlayerAccount(playerWhoPressedTheButton)) -- get the player's account name if isObjectInACLGroup("user."..playerAccountName, aclGetGroup("Admin")) then -- check is player in the 'Admin' ACL group. local vehicleType = getVehicleType(vehicleElement) if vehicleType == "Plane" or vehicleType == "Helicopter" then return end -- kill function if the vehicle is a Plane/Helicopter local velocity_x, velocity_y, velocity_z = getElementVelocity(vehicleElement) setElementVelocity(vehicleElement, velocity_x, velocity_y, velocity_z + 0.33) -- boost vehicle's Z velocity end end addEventHandler("onResourceStart", resourceRoot, function() for _, onlinePlayer in ipairs(getElementsByType("player")) do bindKey(onlinePlayer, "lshift", "down", jumpWithVehicle) end end) addEventHandler("onPlayerJoin", root, function() bindKey(source, "lshift", "down", jumpWithVehicle) end)
  16. https://wiki.multitheftauto.com/wiki/SetVehicleComponentPosition
  17. API: http://getipintel.net/free-proxy-vpn-tor-detection-api/ -- SERVER SIDE local server_owner_email = "[email protected]" -- change it addEventHandler("onPlayerJoin", root, function() local IP = getPlayerIP(source) fetchRemote("http://check.getipintel.net/check.php?ip="..IP.."&contact="..server_owner_email, function(data, errno, player) if errno ~= 0 then print("fetchRemote error - "..errno) return false end local result = tonumber(data) if (result >= 0 and result <= 1) and result > 0.85 then outputChatBox(getPlayerName(player).." use VPN!", root) end end, "", false, source) end) not tested
  18. https://wiki.multitheftauto.com/wiki/GetVersion
  19. https://wiki.multitheftauto.com/wiki/GuiWindowSetMovable
  20. You need to use SAMP Editor. (Download link: https://www.moddb.com/downloads/san-andreas-multiplayer-map-editor) With this editor you can find and select this fence. If you selected it, at the right side, you can see the modelID(IDE) and the coordinates (x,y,z). I do it: removeWorldModel(1413, 1, 1658.9141, -2120.2813, 13.6797) removeWorldModel(1412, 1, 1658.8359, -2114.9609, 13.6797) removeWorldModel(1413, 1, 1658.8359, -2109.6875, 13.6797) removeWorldModel(1413, 1, 1658.8359, -2104.4063, 13.6797)
  21. bindKey(player,"m","down","music") replace to: bindKey("m","down","music") (And run this script on client side.)
  22. https://wiki.multitheftauto.com/wiki/OnPlayerLogin -- SERVER addEventHandler ( "onPlayerLogin", root, function ( thePreviousAccount, theCurrentAccount ) local accName = getAccountName ( theCurrentAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then setElementData( source, "cons", true) else setElementData( source, "cons", false) end end )
  23. marker = createMarker(137.39999, 1850.4, 16.6, "cylinder", 1.5, 230, 251, 3, 153) function camera(hitElement) if getElementType(hitElement) == "player" then fadeCamera(hitElement, false, 0.5) setTimer(function() setCameraMatrix(hitElement, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) fadeCamera(hitElement, true, 0.5) end, 500, 1) end end addEventHandler("onMarkerHit", marker, camera)
×
×
  • Create New...