Jump to content

mint3d

Members
  • Posts

    425
  • Joined

  • Last visited

Everything posted by mint3d

  1. mint3d

    Gates

    There is none
  2. mint3d

    Gates

    I mean the gate dosent spawn
  3. mint3d

    Gates

    The gate dosent show up
  4. mint3d

    Gates

    The gate dosent show up at my pos and yes i have a DayZ script and they want the gate to open with there gang CZ which is in there name and or a code and the gate dosent show up and i want to remove it so you dont need the skin id
  5. mint3d

    Gates

    local a51gate1 = createObject ( 980, 1940.04175 2215.40015 10.7225, 0, 0, 0 ) local a51col = createColCircle ( 1940.04175 2215.40015 10.7225, 7 ) function opena51gates(thePlayer) if getElementType(thePlayer) == "player" then if getElementModel( thePlayer ) == 287 then moveObject (a51gate1, 5000, 1940.04175 2215.40015 10.7225 ) end end end addCommandHandler( "test", opena51gates) function closea51gates(thePlayer) if getElementType(thePlayer) == "player" then if getElementModel( thePlayer ) == 287 then moveObject (a51gate1, 5000, 1930.04175 2215.40015 10.7225 ) end end end addCommandHandler( "test1", closea51gates) i am using that and the gate dosent show up and i ment like find a name that had CZ in it
  6. mint3d

    Gates

    Ok i have this script and i want to set it to check name for CZ so it only opens for people with CZ in there name,or with using a command like /gate a51gate1 = createObject ( 980, 2060.96484375, 2437.982421875, 10.8203125, 0, 0, 0 ) a51col = createColCircle ( 213.94564819336, 1875.40234375, 13.938992500305, 7 ) function opena51gates(thePlayer) if getElementModel( thePlayer ) == 287 then moveObject (a51gate1, 5000, 2060.96484375, 2437.982421875, 10.8203125 ) end end addEventHandler( "onColShapeHit", a51col, opena51gates ) function closea51gates(thePlayer) if getElementModel( thePlayer ) == 287 then moveObject (a51gate1, 5000, 2060.96484375, 2437.982421875, 5.8203125 ) end end addEventHandler( "onColShapeLeave", a51col, closea51gates )
  7. mint3d

    Gates

    Just the one script i need yes and is it server sided?
  8. mint3d

    Gates

    ------------------------------------------------------------------------------ local dwnzgate = createColSphere ( -1572, 662, 7, 6 ) local dwnogate = createObject ( 980, -1572.19, 658.79, 6.8, 0, 269, 270 ) function pd_dgate_enter ( thePlayer ) local team = getPlayerTeam(thePlayer) if not team then return end if getTeamName(team) == "CZ.-" or getTeamName(team) == "BG.-" then local x,y,z = getObjectRotation ( dwnogate ) moveObject ( dwnogate, 3000, -1572.19, 658.79, 6.8, 0, -1+(360-y), 0 ) end end function pd_dgate_exit ( thePlayer ) if getPlayerTeam ( thePlayer ) then local x,y,z = getObjectRotation ( dwnogate ) moveObject ( dwnogate, 2000, -1572.19, 658.79, 6.8, 0, -90+(360-y), 0 ) end end addEventHandler ( "onColShapeHit", dwnzgate, pd_dgate_enter ) addEventHandler ( "onColShapeLeave", dwnzgate, pd_dgate_exit ) ------------------------------------------------------------------------------ i want to make it for castilos group system teams how?
  9. mint3d

    MYSQL

    Ok i have this MYSQL i am using that i have edited but it dosent seem to connect [2013-07-01 23:55:06] ERROR: mysql/connection.lua:16: attempt to call global 'mysql_connect' (a nil value) [2013-07-01 23:55:06] ERROR: mysql/connection.lua:62: attempt to call global 'mysql_ping' (a nil value) [2013-07-01 23:55:06] ERROR: call: failed to call 'mysql:query' [string "?"] -- connection settings local hostname = get( "hostname" ) or "localhost" local username = get( "username" ) or "db38" local password = get( "password" ) or "86kapfhqcycxsxgn7gazc" local database = get( "database" ) or "db38" local port = tonumber( get( "port" ) ) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local queryPool = { } local sqllog = false local countqueries = 0 -- connectToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result queryPool[resultid] = str return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result queryPool[resultid] = str return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) table.remove(queryPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end function getOpenQueryStr( resultid ) if (not queryPool[resultid]) then return false end return queryPool[resultid] end
  10. mint3d

    SQL

    [2013-06-25 21:27:52] ERROR: Unable to connect to mysql: (1044) Access denied for user ''@'localhost' to database 'mta' -- connection settings local hostname = get( "hostname" ) or "localhost" local username = get( "username" ) or "hostname" local password = get( "password" ) or "" local database = get( "database" ) or "mta_vg" local port = tonumber( get( "port" ) ) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local queryPool = { } local sqllog = false local countqueries = 0 -- connectToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result queryPool[resultid] = str return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result queryPool[resultid] = str return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) table.remove(queryPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end function getOpenQueryStr( resultid ) if (not queryPool[resultid]) then return false end return queryPool[resultid] end username = get( "username" ) or "localhost" password = get( "password" ) or "" db = get( "database" ) or "mta_vg" host = get( "hostname" ) or "localhost" port = tonumber( get( "port" ) ) or 3306 function getMySQLUsername() return username end function getMySQLPassword() return password end function getMySQLDBName() return db end function getMySQLHost() return host end function getMySQLPort() return port end function lazyQuery(message) local filename = "/lazyqueries.log" local file = createFileIfNotExists(filename) local size = fileGetSize(file) fileSetPos(file, size) fileWrite(file, message .. "\r\n") fileFlush(file) fileClose(file) return true end function createFileIfNotExists(filename) local file = fileOpen(filename) if not (file) then file = fileCreate(filename) end return file end
  11. mint3d

    login

    When i click the login button it just does not login Client; addEventHandler("accounts:login:request", getRootElement(), function () setElementDimension ( getLocalPlayer(), 1 ) setElementInterior( getLocalPlayer(), 0 ) setCameraMatrix( 837.90606689453, -2066.2963867188, 16.712882995605, 0, -10000, 0) fadeCamera(true) guiSetInputEnabled(true) clearChat() LoginScreen_openLoginScreen() end ); --[[ LoginScreen_openLoginScreen( ) - Open the login screen ]]-- local wLogin, lUsername, tUsername, lPassword, tPassword, chkRememberLogin, bLogin, bRegister, updateTimer = nil function LoginScreen_openLoginScreen() local width, height = guiGetScreenSize() --wLogin = guiCreateWindow(0,0, width, height, "valhallaGaming - MTA Roleplay server", true) wLogin = nil --guiWindowSetSizable(wLogin, false) --guiWindowSetMovable(wLogin, false) lUsername = guiCreateLabel(width /6, height /4, 100, 50, "Username:", false, wLogin) guiSetFont(lUsername, "default-bold-small") tUsername = guiCreateEdit(width /4, height /4, 100, 17, "Username", false, wLogin) guiSetFont(tUsername, "default-bold-small") guiEditSetMaxLength(tUsername, 32) addEventHandler("onClientGUIAccepted", tUsername, LoginScreen_validateLogin, false) lPassword = guiCreateLabel(width /6, height /3.5, 100, 50, "Password:", false, wLogin) guiSetFont(lPassword, "default-bold-small") tPassword = guiCreateEdit(width /4, height /3.5, 100, 17, "Password", false, wLogin) guiSetFont(tPassword, "default-bold-small") guiEditSetMasked(tPassword, true) guiEditSetMaxLength(tPassword, 64) addEventHandler("onClientGUIAccepted", tPassword, LoginScreen_validateLogin, false) chkRememberLogin = guiCreateCheckBox(width /5, height /3.2, 175, 17, "Remember My Details", false, false, wLogin) guiSetFont(chkRememberLogin, "default-bold-small") bLogin = guiCreateButton(width /6, height /2.9, 75, 17, "Login", false, wLogin) guiSetFont(bLogin, "default-bold-small") addEventHandler("onClientGUIClick", bLogin, LoginScreen_validateLogin, false) bRegister = guiCreateButton(width /4, height /2.9, 75, 17, "Register", false, wLogin) guiSetFont(bRegister, "default-bold-small") addEventHandler("onClientGUIClick", bRegister, LoginScreen_startRegister, false) guiSetText(tUsername, tostring( loadSavedData("username", "") )) local tHash = tostring( loadSavedData("hashcode", "") ) guiSetText(tPassword, tHash) if #tHash > 1 then guiCheckBoxSetSelected(chkRememberLogin, true) end addEventHandler( "onClientRender", getRootElement(), LoginScreen_RunFX ) updateTimer = setTimer(LoginScreen_RefreshIMG, 7500, 0) triggerEvent("accounts:options:settings:updated", getLocalPlayer()) end local screenX, screenY = guiGetScreenSize() local alphaAction = 3 local alphaStep = 50 local screenX, screenY = guiGetScreenSize() local alphaAction = 3 local alphaStep = 50 local totalslides = 6 local currentslide = math.random(1, totalslides) function LoginScreen_RunFX() dxDrawRectangle(0, 0, screenX, screenY, tocolor(0, 0, 0, 150), false) dxDrawText( "Welcome at the Valhalla Gaming MTA:Role play server", screenX/2 - 300, screenY/10, 300, 200, tocolor ( 255, 255, 255, 255 ), 2, "default-bold" ) dxDrawText( "Please login to start playing on our server!", screenX/6, screenY/4.9, screenX, screenY, tocolor ( 255, 255, 255, 255 ), 1, "default-bold" ) alphaStep = alphaStep + alphaAction if (alphaStep > 200) or (alphaStep < 50) then alphaAction = alphaAction - alphaAction - alphaAction end -- Left side local startX, startY = screenX/15, screenY/2 local endX = screenX/2.3 - 15 dxDrawText( "News and such.. ", startX, startY, 2000, 2000, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) startY = startY + 40 dxDrawText( getElementData(resourceRoot, "news:title") or "None \"{SMILIES_PATH}/icon_sad.gif\" alt=\"\" title=\"Sad\" />", startX, startY, endX, startY + 30, tocolor ( 255, 255, 255, 255 ), 1.2, "default-bold", "center", "top", true, false ) startY = startY + 16 dxDrawText( getElementData(resourceRoot, "news:sub") or "", startX, startY, endX, startY + 30, tocolor( 255, 255, 255, 200), 1, "default-bold", "center", "top", true, false ) startY = startY + 20 dxDrawText(getElementData(resourceRoot, "news:text") or "", startX, startY, endX, screenY, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", true, true ) -- Right side local startX, startY = screenX/2.3, screenY/5 dxDrawText( "Welcome in this world,", startX, startY, 2000, 2000, tocolor ( 255, 255, 255, 255 ), 1.3, "default-bold" ) startY = startY + 20 dxDrawText( "the valhalla of role play.", startX+150, startY, 2000, 2000, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold" ) startY = startY + 50 dxDrawText( "Valhalla Gaming MTA Role Play is a role play gaming server using the Multi Theft Auto\nmultiplayer modification for Grand Theft Auto: San Andreas. Originally started in January\nof 2008 as MTA:RP the server has grown to 110,000+ lines of code.\n\nIf you're new here, you should know a few things. First of all, you need an account to\n play at our server. You can get one at our website, [url=http://www.mta.vg]www.mta.vg[/url] and look at the right side.\nWe are aiming for an as real as possible enviorment to roleplay in, thusfar we have\nsome rules that everyone need to stick to. You can view those rules by going to our\nsite, [url=http://mta.vg]http://mta.vg[/url] or pressing F1 ingame.\n\nIf you require any assistance in our server, hit F2 and ask your question straight away. Also\nthere it's possible to report another player if he or she doesn't follow the rules.\n\nWe hope that you have a good time at our server.\n\n- Valhalla Gaming MTA Team", startX, startY, screenX-startX, screenY-startY, tocolor ( 255, 255, 255, 255 ), 1, "default-bold" ) -- Upper right dxDrawImage(screenX - 140, 10, 131, 120, "img/valhalla1.png", 0, 0, 0, tocolor(255, 255, 255, alphaStep), false) dxDrawText("Version "..scriptVersion, screenX - 130, 130, 20, 120, tocolor ( 255, 255, 255, 150 ), 1, "default-bold" ) -- Banner down dxDrawImage(startX, 500, 542, 214, "banners/".. tostring(currentslide) ..".png", 0, 0, 0, tocolor(255, 255, 255, 200), false) end function LoginScreen_RefreshIMG() currentslide = currentslide + 1 if currentslide > totalslides then currentslide = 1 end end function LoginScreen_startRegister() LoginScreen_showWarningMessage( "You can register an account\nat [url=http://mta.vg]http://mta.vg[/url]! ) end --[[ LoginScreen_closeLoginScreen() - Close the loginscreen ]] function LoginScreen_closeLoginScreen() destroyElement(lUsername) destroyElement(tUsername) destroyElement(lPassword) destroyElement(tPassword) destroyElement(chkRememberLogin) destroyElement(bLogin) destroyElement(bRegister) --destroyElement(wLogin) killTimer(updateTimer) removeEventHandler( "onClientRender", getRootElement(), LoginScreen_RunFX ) end --[[ LoginScreen_validateLogin() - Used to validate and send the contents of the login screen ]]-- function LoginScreen_validateLogin() local username = guiGetText(tUsername) local password = guiGetText(tPassword) guiSetText(tPassword, "") appendSavedData("hashcode", "") if (string.len(username)<3) then outputChatBox("Your username is too short. You must enter 3 or more characters.", 255, 0, 0) else local saveInfo = guiCheckBoxGetSelected(chkRememberLogin) triggerServerEvent("accounts:login:attempt", getLocalPlayer(), username, password, saveInfo) if (saveInfo) then appendSavedData("username", tostring(username)) else appendSavedData("username", "") end end end local warningBox, warningMessage, warningOk = nil function LoginScreen_showWarningMessage( message ) if (isElement(warningBox)) then destroyElement(warningBox) end local x, y = guiGetScreenSize() warningBox = guiCreateWindow( x*.5-150, y*.5-65, 300, 120, "Attention!", false ) guiWindowSetSizable( warningBox, false ) warningMessage = guiCreateLabel( 40, 30, 220, 60, message, false, warningBox ) guiLabelSetHorizontalAlign( warningMessage, "center", true ) guiLabelSetVerticalAlign( warningMessage, "center" ) warningOk = guiCreateButton( 130, 90, 70, 20, "Ok", false, warningBox ) addEventHandler( "onClientGUIClick", warningOk, function() destroyElement(warningBox) end ) guiBringToFront( warningBox ) end addEventHandler("accounts:login:attempt", getRootElement(), function (statusCode, additionalData) if (statusCode == 0) then LoginScreen_closeLoginScreen() if (isElement(warningBox)) then destroyElement(warningBox) end -- Succesful login for _, theValue in ipairs(additionalData) do setElementData(getLocalPlayer(), theValue[1], theValue[2], false) end local newAccountHash = getElementData(getLocalPlayer(), "account:newAccountHash") appendSavedData("hashcode", newAccountHash or "") local characterList = getElementData(getLocalPlayer(), "account:characters") if #characterList == 0 then newCharacter_init() else Characters_showSelection() end elseif (statusCode > 0) and (statusCode < 5) then LoginScreen_showWarningMessage( additionalData ) elseif (statusCode == 5) then LoginScreen_showWarningMessage( additionalData ) -- TODO: show make app screen? end end ) Server; local mysql = exports.mysql local salt = "vgrpkeyscotland" addEventHandler("accounts:login:request", getRootElement(), function () local seamless = getElementData(client, "account:seamless:validated") if seamless == true then outputChatBox("-- Migrated your session after a system restart", client, 0, 200, 0) setElementData(client, "account:seamless:validated", false, false, true) triggerClientEvent(client, "accounts:options", client) triggerClientEvent(client, "item:updateclient", client) return end triggerClientEvent(client, "accounts:login:request", client) end ); addEventHandler("accounts:login:attempt", getRootElement(), function (username, password, wantsLoginHash) local accountCheckQueryStr, accountData,newAccountHash,safeusername,safepassword = nil local cpypassword = password if (string.len(cpypassword) ~= 64) then password = md5(salt .. password) safeusername = mysql:escape_string(username) safepassword = mysql:escape_string(password) accountCheckQueryStr = "SELECT `id`,`username`,`banned`,`appstate`,`admin`,`adminduty`,`adminreports`,`hiddenadmin`,`adminjail`,`adminjail_time`,`adminjail_by`,`adminjail_reason`, `monitored` FROM `accounts` WHERE `username`='" .. safeusername .. "' AND `password`='" .. safepassword .. "'" else safeusername = mysql:escape_string(username) safepassword = mysql:escape_string(password) accountCheckQueryStr = "SELECT `id`,`username`,`banned`,`appstate`,`admin`,`adminduty`,`adminreports`,`hiddenadmin`,`adminjail`,`adminjail_time`,`adminjail_by`,`adminjail_reason`, `monitored` FROM `accounts` WHERE `username`='" .. safeusername .. "' AND `loginhash`='" .. safepassword .. "'" end local accountCheckQuery = mysql:query(accountCheckQueryStr) if (mysql:num_rows(accountCheckQuery) > 0) then accountData = mysql:fetch_assoc(accountCheckQuery) mysql:free_result(accountCheckQuery) -- Create a new safety hash, also used for autologin local newAccountHash = Login_calculateAutoLoginHash(safeusername) setElementDataEx(client, "account:seamlesshash", newAccountHash, false, true) if not (wantsLoginHash) then newAccountHash = "" end -- Check the account isn't already logged in local found = false for _, thePlayer in ipairs(exports.pool:getPoolElementsByType("player")) do local playerAccountID = tonumber(getElementData(thePlayer, "account:id")) if (playerAccountID) then if (playerAccountID == tonumber(accountData["id"])) and (thePlayer ~= client) then triggerClientEvent(client, "accounts:login:attempt", client, 1, "Account is already logged in." ) return false end end end -- Check if the account ain't banned if (tonumber(accountData["banned"]) == 1) then triggerClientEvent(client, "accounts:login:attempt", client, 2, "Account is disabled." ) return end -- Check the application state if (tonumber(accountData["appstate"]) == 0) then triggerClientEvent(client, "accounts:login:attempt", client, 5, "You need to send in an application to play on this server." ) return elseif (tonumber(accountData["appstate"]) == 1) then triggerClientEvent(client, "accounts:login:attempt", client, 4, "Your application is still pending." ) return elseif (tonumber(accountData["appstate"]) == 2) then triggerClientEvent(client, "accounts:login:attempt", client, 3, "Your application has been denied, you can remake one at [url=http://mta.vg]http://mta.vg[/url]. ) return end local forceAppCheckQuery = mysql:query("SELECT `username`,`appstate` FROM `accounts` WHERE `ip`='" .. mysql:escape_string(getPlayerIP(client)) .. "' OR `mtaserial`='" .. mysql:escape_string(getPlayerSerial(client)) .. "'") if forceAppCheckQuery then while true do local forceAppRow = mysql:fetch_assoc(forceAppQuery) if not forceAppRow then break end if (tonumber(forceAppRow["appstate"]) == 1) then triggerClientEvent(client, "accounts:login:attempt", client, 4, "Your application is still pending on account "..forceAppRow["username"].."." ) mysql:free_result(forceAppCheckQuery) return elseif (tonumber(forceAppRow["appstate"]) == 2) then triggerClientEvent(client, "accounts:login:attempt", client, 3, "Your application has been denied on account "..forceAppRow["username"]..", you can remake one at [url=http://mta.vg]http://mta.vg[/url]. ) mysql:free_result(forceAppCheckQuery) return end end end mysql:free_result(forceAppCheckQuery) -- Start the magic setElementDataEx(client, "account:loggedin", true, true) setElementDataEx(client, "account:id", tonumber(accountData["id"]), true) setElementDataEx(client, "account:username", accountData["username"], false) setElementDataEx(client, "adminreports", accountData["adminreports"], false) setElementDataEx(client, "hiddenadmin", accountData["hiddenadmin"], false) if (tonumber(accountData["admin"]) >= 0) then setElementDataEx(client, "adminlevel", tonumber(accountData["admin"]), false) setElementDataEx(client, "account:gmlevel", 0, false) setElementDataEx(client, "adminduty", accountData["adminduty"], false) setElementDataEx(client, "account:gmduty", false, true) else setElementDataEx(client, "adminlevel", 0, false) local GMlevel = -tonumber(accountData["admin"]) setElementDataEx(client, "account:gmlevel", GMlevel, false) if (tonumber(accountData["adminduty"]) == 1) then setElementDataEx(client, "account:gmduty", true, true) else setElementDataEx(client, "account:gmduty", false, true) end end if tonumber(accountData["adminjail"]) == 1 then setElementDataEx(client, "adminjailed", true, false) else setElementDataEx(client, "adminjailed", false, false) end setElementDataEx(client, "jailtime", tonumber(accountData["adminjail_time"]), false) setElementDataEx(client, "jailadmin", accountData["adminjail_by"], false) setElementDataEx(client, "jailreason", accountData["adminjail_reason"], false) if accountData["monitored"] ~= "" then setElementDataEx(client, "admin:monitor", accountData["monitored"], false) end local dataTable = { } table.insert(dataTable, { "account:newAccountHash", newAccountHash } ) table.insert(dataTable, { "account:characters", characterList( client ) } ) triggerClientEvent(client, "accounts:login:attempt", client, 0, dataTable ) local loginmethodstr = "manually" if (string.len(cpypassword) == 64) then loginmethodstr = "Autologin - "..cpypassword end exports.logs:dbLog("ac"..tostring(accountData["id"]), 27, "ac"..tostring(accountData["id"]), "Connected from "..getPlayerIP(client) .. " - "..getPlayerSerial(client) .. " (".. loginmethodstr ..")" ) mysql:query_free("UPDATE `accounts` SET `ip`='" .. mysql:escape_string(getPlayerIP(client)) .. "', `mtaserial`='" .. mysql:escape_string(getPlayerSerial(client)) .. "' WHERE `id`='".. mysql:escape_string(tostring(accountData["id"])) .."'") triggerEvent( "social:account", client, tonumber( accountData.id ) ) else mysql:free_result(accountCheckQuery) triggerClientEvent(client, "accounts:login:attempt", client, 1, "No combination found of the \nentered username/password." ) end end ); function Login_calculateAutoLoginHash(username) local finalhash = "" local chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" for i = 1, 64 do local rand = math.random(#chars) finalhash = finalhash .. chars:sub(rand, rand) end mysql:query_free("UPDATE `accounts` SET `loginhash`='".. finalhash .."' WHERE `username`='".. mysql:escape_string(username) .."'") return finalhash end function quitPlayer(quitReason, reason) local accountID = tonumber(getElementData(source, "account:id")) if accountID then local affected = { "ac"..tostring(accountID) } local dbID = getElementData(source,"dbid") if dbID then table.insert(affected, "ch"..tostring(dbID)) end exports.logs:dbLog("ac"..tostring(accountID), 27, affected, "Disconnected ("..quitReason or "Unknown reason"..") (Name: "..getPlayerName(source)..")" ) end end addEventHandler("onPlayerQuit",getRootElement(), quitPlayer)
  12. Is that not the default HelpManager
  13. WARNING: wasted-save\wasted-save.lua:30: Bad argument @ 'giveWeapon' [Expected weapon-type at argument 2, got boolean]
  14. still nothing and i spawn with more ammo
  15. addEventHandler ( "onPlayerWasted", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end local team = getPlayerTeam ( source ) if ( team ) then setAccountData ( account, "save-team", getTeamName ( team ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) local team = getTeamFromName ( getAccountData ( account, "save-team" ) ) if ( team ) then setPlayerTeam ( source, team ) else outputChatBox ( "NO TEAM SAVED", source ) end setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) end end end ) i have that and meta meta> "Bucky" type="script" version="1.3" description="Wasted save" />
  16. well mines dosent come to my server and check
  17. that spawned me with one gun and no team
  18. no just spawn me with nothing
  19. i did but nothing still local team = getTeamFromName ( getAccountData ( account, "save-team" ) ) if ( team ) then setPlayerTeam ( source, team ) end is that end ment to be there
  20. sorry still nothing
  21. because my friend killed me and i didnt spawn in the same team shouldn't there be something on the onplayerspawn side
  22. it didnt save the team
  23. i copied above and nothing still and i lost all guns again
  24. function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) setPlayerTeam ( source, getTeamFromName(team) ) setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) local team = getPlayerTeam ( source ) if ( team ) then setAccountData ( account , "save-team" , getTeamName ( team ) ) end end end end )
×
×
  • Create New...