Jump to content

Dimos7

Members
  • Posts

    1,546
  • Joined

  • Last visited

Everything posted by Dimos7

  1. function nickHandler(playerNick) if (playerNick) and string.len(playerNick) <=3 then cancelEvent(true, "Your nickname is too short for that") end end addEventHandler("onPlayerConnect", root, nickHandler)
  2. You move the mouse if you mean apear it there is a function for it
  3. setPlayerMuted setAccountData getPlayerAccount getAccountData setTimer outputChatBox https://www.wiki.multitheftauto.com/wiki/onPlayerLogin https://www.wiki.multitheftauto.com/wiki/onPlayerQuit store Timer on account and get it when Login to server
  4. function nickHandler(playerNick) if (playerNick) and string.len(playerNick) <3 then cancelEvent() end end addEventHandler("onPlayerConnect", root, nickHandler)
  5. you can't mute someone who is not online in your server
  6. local connection = exports["mysql"]:getConnection() function loginHandler(client,username, password) if (client) and (client == source) then local account = getAccount(username) local hashedPass = getAccountData(account, "hashed_Password") dbQuery(function(queryHandler) local result, num_affected_row = dbPoll(queryHandler, 0) if account ~= nil and passwordVerify(password, hashedPass, function(isVaild) if not isVaild then exports["notification-system"]:sendClientMessage("ERROR :Password is invaild!", source, 255, 0, 0) end end) and num_affected_row > 1 then if (logIn(source, account, hashedPass) == true ) then triggerClientEvent(source, "hideLoginWindow", root) setElementData(source, "account:id", result.id) dbExec(connection, "UPDATE accounts SET lastlogin=? WHERE username=?", "NOW()", tostring(username)) exports["notification-system"]:sendClientMessage("INFO: You successfuly logged in!", source ,0, 255, 0) else exports["notification-system"]:sendClientMessage("ERROR: That account is already logged in!", source, 255, 0, 0) end else exports["notification-system"]:sendClientMessage("ERROR: Username or passwrod is invailed!", source, 255, 0, 0) end end, connection, "SELECT * FROM accounts WHERE username = ? AND password = ?", tostring(username), tostring(hashedPass)) end end function reigsterHandler(client,username, email, password) if (client) and (client == source) then local account = getAccount(username) dbQuery(function(queryHandler) local result, num_affected_row = dbPoll(queryHandler, 0) if account ~= nil and num_affected_row > 1 then exports["notification-system"]:sendClientMessage("ERROR: That username is already exist!", source, 255, 0, 0) else passwordHash(password, "bcrypt", {}, function(hashedPassword) local account = addAccount(username,hashedPassword) setAccountData(account, "hashed_Password", hashedPassword) local ip = getPlayerIP(source) local serial = getPlayerSerial(source) local r = getRealTime() local regDate = ("%04d-%02d-%02d %02d:%02d:%02d"):format(r.year+1900, r.month+1, r.monthday, r.hour, r.minute, r.second) dbExec(connection, "INSERT INTO accounts (username, password ,email, ip, serial, registerdate) VALUES(?, ?, ?, ?, ?, ?)", tostring(username), tostring(hashedPassword), tostring(email), tostring(ip), tostring(serial), tostring(regDate)) triggerClientEvent(source, "hideRegisterWindow", root) exports["notification-system"]:sendClientMessage("INFO: You successfuly register!", source, 0, 255, 0) end) end end,connection, "SELECT username FROM accounts WHERE username =?",tostring(username)) end end addEvent("submitLogin", true) addEvent("submitRegister", true) addEventHandler("submitLogin", root, loginHandler) addEventHandler("submitRegister", root, reigsterHandler) local sw, sh = guiGetScreenSize() showChat(false) setPlayerHudComponentVisible("all", false) local GUIEditor = { window = {}, label = {}, edit = {}, memo = {}, checkbox = {}, button = {}, } function createLoginWindow() GUIEditor.window[1] = guiCreateWindow((sw-662)/2, (sh-285)/2, 662, 285, "Login", false) guiWindowSetSizable(GUIEditor.window[1], false) guiWindowSetMovable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(20, 49, 84, 19, "Username:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-blod-small") GUIEditor.edit[1] = guiCreateEdit(94, 39, 156, 36, "", false, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[1], 20) GUIEditor.label[2] = guiCreateLabel(20, 95, 84, 19, "Password:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-blod-small") GUIEditor.edit[2] = guiCreateEdit(94, 85, 156, 36, "", false, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[2], 50) guiEditSetMasked(GUIEditor.edit[2], true) guiSetText(GUIEditor.edit[1], tostring(loadSavedData("username", ""))) guiSetText(GUIEditor.edit[2], tostring(loadSavedData("password", ""))) GUIEditor.button[1] = guiCreateButton(94, 185, 156, 36, "Login", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(94, 231, 156, 36, "Register", false, GUIEditor.window[1]) GUIEditor.checkbox[1] = guiCreateCheckBox(94, 136, 149, 15, "Rememeber information", false, false, GUIEditor.window[1]) GUIEditor.memo[1] = guiCreateMemo(296, 39, 351, 231, "Hey, you there!\n\nWelcome to the great experience of Countyside Roleplay.\n\nWe hope to enjoy your time here", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) addEventHandler("onClientGUIClick", GUIEditor.button[1], onClientSubmitLogin, false) addEventHandler("onClientGUIClick", GUIEditor.button[2], createRegisterWindow, false) end function createRegisterWindow() guiSetVisible(GUIEditor.window[1], false) GUIEditor.window[2] = guiCreateWindow((sw-311)/2, (sh-285)/2, 311, 285, "Registration", false) guiWindowSetMovable(GUIEditor.window[2], false) guiWindowSetSizable(GUIEditor.window[2], false) GUIEditor.label[3] = guiCreateLabel(20, 49, 84, 19, "Username:", false, GUIEditor.window[2]) guiSetFont(GUIEditor.label[3], "default-blod-small") GUIEditor.edit[3] = guiCreateEdit(94, 39, 156, 36, "", false, GUIEditor.window[2]) guiEditSetMaxLength(GUIEditor.edit[3], 20) GUIEditor.label[4] = guiCreateLabel(20, 95, 84, 19, "Email:", false, GUIEditor.window[2]) guiSetFont(GUIEditor.label[4], "default-blod-small") GUIEditor.edit[4] = guiCreateEdit(94, 85, 156, 36, "", false, GUIEditor.window[2]) guiEditSetMaxLength(GUIEditor.edit[4], 100) GUIEditor.label[5] = guiCreateLabel(20, 146, 84, 19, "Password:", false, GUIEditor.window[2]) guiSetFont(GUIEditor.label[5], "default-blod-small") GUIEditor.edit[5] = guiCreateEdit(94, 136, 156, 36, "", false, GUIEditor.window[2]) guiEditSetMaxLength(GUIEditor.edit[5], 50) guiEditSetMasked(GUIEditor.edit[5], true) GUIEditor.button[3] = guiCreateButton(94, 185, 156, 36, "Register", false, GUIEditor.window[2]) GUIEditor.button[4] = guiCreateButton(94, 231, 156, 36, "Back", false, GUIEditor.window[2]) addEventHandler("onClientGUIClick", GUIEditor.button[3], onClientSubmitRegister, false) addEventHandler("onClientGUIClick", GUIEditor.button[4], hideRegisterWindow, false) guiSetVisible(GUIEditor.window[2], true) end function reousceStart() createLoginWindow() if GUIEditor.window[1] ~= nil then guiSetVisible(GUIEditor.window[1], true) else exports["notification-system"]:sendClientMessage("ERROR: An ERROR has been occupied!", 255, 0, 0) end showCursor(true) guiSetInputEnabled(true) guiSetInputMode("no_binds") end local oldXmlFileName = "settings.xml" local migratedSettingsFile = "@migratedsettings.empty" local xmlFileName = "@settings.xml" function loadSavedData(parameter, default) if not fileExists(migratedSettingsFile) then if not fileExists(xmlFileName) and fileExists(oldXmlFileName) then fileRename(oldXmlFileName, xmlFileName) end fileClose(fileCreate(migratedSettingsFile)) end local xmlRoot = xmlLoadFile( xmlFileName ) if (xmlRoot) then local xmlNode = xmlFindChild(xmlRoot, parameter, 0) if (xmlNode) then return xmlNodeGetValue(xmlNode) end end return default or false end function appendSavedData(parameter, value) setElementData(localPlayer, parameter, value, false) local xmlFile = xmlLoadFile ( xmlFileName ) if not (xmlFile) then xmlFile = xmlCreateFile( xmlFileName, "login" ) end local xmlNode = xmlFindChild (xmlFile, parameter, 0) if not (xmlNode) then xmlNode = xmlCreateChild(xmlFile, parameter) end xmlNodeSetValue ( xmlNode, value ) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function onClientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[1]) local password = guiGetText(GUIEditor.edit[2]) if username ~= "" and password ~= "" then if username == "" then exports["notification-system"]:sendClientMessage("ERROR: You need enter username!" , 255, 0, 0) elseif password == "" then exports["notification-system"]:sendClientMessage("ERROR: You need enter a password!", 255, 0, 0) end if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then appendSavedData("username", tostring(username)) appendSavedData("password", tostring(password)) else appendSavedData("username", "") appendSavedData("password", "") end triggerServerEvent("submitLogin", resourceRoot, username, password) else exports["notification-system"]:sendClientMessage("ERROR: You need enter username and password!!", 255, 0, 0) end end end function onClientSubmitRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[3]) local email = guiGetText(GUIEditor.edit[4]) local password = guiGetText(GUIEditor.edit[5]) if username ~="" and email ~= "" and password ~= "" then if username == "" then exports["notification-system"]:sendClientMessage("ERROR: You need enter username!", 255, 0, 0) elseif email == "" then exports["notification-system"]:sendClientMessage("ERROR You need enter a email!", 255, 0, 0) elseif password == "" then exports["notification-system"]:sendClientMessage("ERROR: You need enter a password!", 255, 0, 0) end if string.len(username) < 3 then exports["notification-system"]:sendClientMessage("ERROR: Username is too short you need 3 characters long!" , 255, 0, 0) end if string.len(password) < 6 then exports["notification-system"]:sendClientMessage("ERROR: Password is too short you need 6 characters long!", 255, 0, 0) end if not string.find(email, "@") then exports["notification-system"]:sendClientMessage("ERROR: Invaild email!", 255, 0, 0) end triggerServerEvent("submitRegister", resourceRoot, username, email, password) else exports["notification-system"]:sendClientMessage("ERROR: You need enter username, email and password!!", 255, 0, 0) end end end function hideLoginWindow() guiSetVisible(GUIEditor.window[1], false) showChat(true) setPlayerHudComponentVisible("all", true) guiSetInputEnabled(false) showCursor(false) end function hideRegisterWindow() createLoginWindow() guiSetVisible(GUIEditor.window[2], false) end addEvent("hideLoginWindow", true) addEvent("hideRegisterWindow", true) addEventHandler("hideLoginWindow", root, hideLoginWindow) addEventHandler("hideRegisterWindow", root, hideRegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, reousceStart) Nothing work nether login or register no error or warnings
  7. He don't had a color defind with rgb only take team colro which he was in none which mean team not exist and color too
  8. You can make shop panel for acl groups but you can't put it automatically
  9. We can't help you aski owl for ther scripts if they give you okay otherwise its leaked
  10. local gate = createObject(971, 2582.1005859375, -2115.7998046875, 3.5999999046326, 0, 0, 179.99450683594) local marker = createMarker(2581.15039, -2108.35376, 1.49555, "cylinder", 8, 0, 0, 0, 0) function moveGate(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)) , aclGetGroup("VIP")) then moveObject(gate, 1000, 263.9, -1333.5, 46) end end addEventHandler("onMarkerHit", marker, moveGate) function move_back_gate() moveObject(gate, 1000, 263.9, -1333.5, 53.251480102539) end addEventHandler("onMarkerLeave", marker, move_back_gate)
  11. function vipChat(thePlayer, _,...) local message = table.concat ({...}, " ") for _, v in ipairs (getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("VIP")) then outputChatBox("[VIP Chat]".. getPlayerName(thePlayer).. ":#ffffff ".. message, v, 255, 0, 255, true) else return outputChatBox("You are not VIP", thePlayer, 255, 0, 0) end end end addCommandHandler("v", vipChat)
  12. I can make it easier if you want
  13. Yes that not about acl that is for game teams which player it in your are not in a team local isPlayerInGroup, onChat local function onChatCommand (player) if isPlayerInGroup (player, "VIP") then onChat (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("v", onChatCommand) chat_range=10000000 addEventHandler("onPlayerJoin",getRootElement(), function () end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[VIP Chat]"..nick..": #ffffff"..msg,v,255,0,255,true) end end end function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end
  14. Player is not in a teams so give that error
  15. 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 givemoneycommand (player, cmd, giveTo, amount) local find = getPlayerFromPartialName(giveTo) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("VIP")) then if find then if amount then if getPlayerMoney(player) >= tonumber(amount) then takePlayerMoney(player, tonumber(amount)) givePlayerMoney(find, tonumber(amount)) outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),player,0,255,0 ) else outputChatBox('[givemoney]:You don't have that amount!', player, 255, 0, 0) end else outputChatBox( '[givemoney]:/'..cmd..'[playername][amount]!',player,255,0,0 ) end outputChatBox( '[givemoney]:Player not found!',player,255,0,0 ) end else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("givemoney", givemoneycommand)
  16. local isPlayerInGroup, givemoney local function givemoneycommand (player) if isPlayerInGroup (player, "VIP") then giveCash (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("givemoney", givemoneycommand) 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 addCommandHandler( 'givemoney', function( source,_,giveTo,amount ) local find = getPlayerFromPatrialName( giveTo) if find then if amount then -- If player type amount ( full command /givemoney [nickname][amount] ) givePlayerMoney( find,tonumber( amount ) ) -- give money for player outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),source,255,0,0 ) else -- player not type full command ( /givemoney [nickname][amount] ) outputChatBox( '[givemoney]:/givemoney [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[givemoney]:Player not found!',source,255,0,0 ) end end ) function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end
  17. Dimos7

    About ban...

    I need some question for help you you ban player thought admin panel or other resource? You have database store bans etc
  18. local isPlayerInGroup, givemoney local function givemoneycommand (player) if isPlayerInGroup (player, "VIP") then giveCash (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("givemoney", givemoneycommand) 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 addCommandHandler( 'givemoney', function( source,_,player,amount ) local find = getPlayerFromPatrialName( player ) if find then if amount then -- If player type amount ( full command /givemoney [nickname][amount] ) givePlayerMoney( find,tonumber( amount ) ) -- give money for player outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),source,255,0,0 ) else -- player not type full command ( /givemoney [nickname][amount] ) outputChatBox( '[givemoney]:/givemoney [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[givemoney]:Player not found!',source,255,0,0 ) end end ) function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end try that
  19. ID = {} exports.scoreboard:addScoreboardColumn("id",root, 20, "id", 1) addEventHandler("onPlayerJoin", root, function () for i=0, getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) end end end)
  20. setTimer(function(thePlayer ) if getElementData(thePlayer, "asd.asd") then outputChatBox("asd", thePlayer, 255, 255, 255, true) end end, 1000*3, 0)
×
×
  • Create New...