Jump to content

All Activity

This stream auto-updates

  1. Today
  2. local mysql = exports.rp_mysql function setElementDataEx(source, field, parameter, streamtoall, streamatall) exports.rp_anticheat:changeProtectedElementDataEx( source, field, parameter, streamtoall, streamatall) end function getAllInts(thePlayer, commandName, ...) if exports.rp_integration:isPlayerAdmin( thePlayer ) then local interiorsList = {} local mQuery1 = nil dbQuery( function(qh) local res, rows, err = dbPoll(qh, 0) if rows > 0 then for index, row in ipairs(res) do table.insert(interiorsList, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } ) end triggerClientEvent(thePlayer, "createIntManagerWindow", thePlayer, interiorsList, getElementData( thePlayer, "account:username" )) end end, connection, "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id ORDER BY interiors.createdDate DESC") end end addCommandHandler("interiors", getAllInts) addCommandHandler("ints", getAllInts) addEvent("interiorManager:openit", true) addEventHandler("interiorManager:openit", getRootElement(), getAllInts) function delIntCmd(thePlayer, intID ) executeCommandHandler ( "delint", thePlayer, intID ) end addEvent("interiorManager:delint", true) addEventHandler("interiorManager:delint", getRootElement(), delIntCmd) function disableInt(thePlayer, intID ) executeCommandHandler ( "toggleinterior", thePlayer, intID ) end addEvent("interiorManager:disableInt", true) addEventHandler("interiorManager:disableInt", getRootElement(), disableInt) function gotoInt(thePlayer, intID ) executeCommandHandler ( "gotohouse", thePlayer, intID ) end addEvent("interiorManager:gotoInt", true) addEventHandler("interiorManager:gotoInt", getRootElement(), gotoInt) function restoreInt(thePlayer, intID ) executeCommandHandler ( "restoreInt", thePlayer, intID ) end addEvent("interiorManager:restoreInt", true) addEventHandler("interiorManager:restoreInt", getRootElement(), restoreInt) function removeInt(thePlayer, intID ) executeCommandHandler ( "removeint", thePlayer, intID ) end addEvent("interiorManager:removeInt", true) addEventHandler("interiorManager:removeInt", getRootElement(), removeInt) function forceSellInt(thePlayer, intID ) executeCommandHandler ( "fsell", thePlayer, intID ) end addEvent("interiorManager:forceSellInt", true) addEventHandler("interiorManager:forceSellInt", getRootElement(), forceSellInt) function openAdminNote(thePlayer, intID ) executeCommandHandler ( "checkint", thePlayer, intID ) end addEvent("interiorManager:openAdminNote", true) addEventHandler("interiorManager:openAdminNote", getRootElement(), openAdminNote) function interiorSearch(thePlayer, keyword ) if keyword and keyword ~= "" and keyword ~= "Search..." then local interiorsResultList = {} local mQuery1 = nil dbQuery( function(qh, thePlayer) local res, rows, err = dbPoll(qh, 0) if rows > 0 then for index, row in ipairs(res) do table.insert(interiorsResultList, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } ) end triggerClientEvent(thePlayer, "interiorManager:FetchSearchResults", thePlayer, interiorsResultList, getElementData( thePlayer, "account:username" )) end end, {thePlayer}, mysql:getConnection(), "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id WHERE interiors.id LIKE '%"..keyword.."%' OR interiors.name LIKE '%"..keyword.."%' OR factions.name LIKE '%"..keyword.."%' OR cost LIKE '%"..keyword.."%' OR charactername LIKE '%"..keyword.."%' OR username LIKE '%"..keyword.."%' OR interiors.creator LIKE '%"..keyword.."%' ORDER BY interiors.createdDate DESC") end end addEvent("interiorManager:Search", true) addEventHandler("interiorManager:Search", getRootElement(), interiorSearch) function checkInt(thePlayer, commandName, intID) if exports.rp_integration:isPlayerTrialAdmin( thePlayer ) then if not tonumber(intID) or (tonumber(intID) <= 0 ) or (tonumber(intID) % 1 ~= 0 ) then intID = getElementDimension(thePlayer) if intID == 0 then outputChatBox( "You must be inside an interior.", thePlayer, 255, 194, 14) outputChatBox("Or use SYNTAX: /"..commandName.." [Interior ID]", thePlayer, 255, 194, 14) return false end end dbQuery( function(qh, thePlayer) local res, rows, err = dbPoll(qh, 0) if rows > 0 then local result = {} for index, row in ipairs(res) do table.insert(result, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["safepositionY"], row["safepositionZ"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } ) end dbQuery( function(qh, thePlayer) local res, rows, err = dbPoll(qh, 0) if rows > 0 then local result2 = {} for index, row2 in ipairs(res) do table.insert(result2, { row2["date"], row2["action"], row2["adminname"], row2["logid"], row2["intID"]} ) end dbQuery( function(qh, thePlayer) local res, rows, err = dbPoll(qh, 0) if rows > 0 then local notes = {} for index, row2 in ipairs(res) do row2.creatorname = formatCreator(row2.creatorname, row2.creator) table.insert(notes, row2 ) end end triggerClientEvent(thePlayer, "createCheckIntWindow", thePlayer, result, exports.rp_global:getPlayerAdminTitle(thePlayer), result2, notes) end, {thePlayer}, mysql:getConnection(), "SELECT n.id, n.note, a.username AS creatorname, n.date, n.creator FROM interior_notes n LEFT JOIN accounts a ON n.creator=a.id WHERE n.intid="..intID.." ORDER BY n.date DESC") end end, {thePlayer}, mysql:getConnection(), "SELECT `interior_logs`.`date` AS `date`, `interior_logs`.`intID` as `intID`, `interior_logs`.`action` AS `action`, `accounts`.`username` AS `adminname`, `interior_logs`.`log_id` AS `logid` FROM `interior_logs` LEFT JOIN `accounts` ON `interior_logs`.`actor` = `accounts`.`id` WHERE `interior_logs`.`intID` = '"..intID.."' ORDER BY `interior_logs`.`date` DESC") end end, {thePlayer}, mysql:getConnection(), "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX,safepositionY, safepositionZ, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id WHERE interiors.id = '"..intID.."' ORDER BY interiors.createdDate DESC") end end addCommandHandler("checkint", checkInt) addCommandHandler("checkinterior", checkInt) addEvent("interiorManager:checkint", true) addEventHandler("interiorManager:checkint", getRootElement(), checkInt) function formatCreator(creator, creatorId) if creator and creatorId then if creator == nil then if creatorId == "0" then return "SYSTEM" else return "N/A" end else return creator end else return "N/A" end end function saveAdminNote(intID, adminNote, noteId ) if not intID or not adminNote then outputChatBox("Internal Error!", source, 255,0,0) return false end if string.len(adminNote) > 500 then outputChatBox("Admin note has failed to add. Reason: Exceeded 500 characters.", source, 255, 0, 0) return false end if noteId then if dbExec(mysql:getConnection(),"UPDATE interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id").." WHERE id ="..noteId.." AND intid="..intID) then outputChatBox("You have successfully updated admin note entry #"..noteId.." on interior #"..intID..".", source, 0, 255,0) addInteriorLogs(intID, "Modified admin note entry #"..noteId, source) return true end else --outputChatBox("INSERT INTO interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id")..", intid="..intID ) local insertedId = dbExec(mysql:getConnection(),"INSERT INTO interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id")..", intid="..intID ) if insertedId then outputChatBox("You have successfully added a new admin note entry #"..insertedId.." to interior #"..intID..".", source, 0, 255,0) addInteriorLogs(intID, "Added new admin note entry #"..insertedId, source) return true end end end addEvent("interiorManager:saveAdminNote", true) addEventHandler("interiorManager:saveAdminNote", getRootElement(), saveAdminNote) function restock(thePlayer, commandName, intID, amount) if exports.rp_integration:isPlayerTrialAdmin(thePlayer) or exports.rp_integration:isPlayerSupporter(thePlayer) then if not intID or not tonumber(intID) or tonumber(intID)%1~=0 then amount = 100 intID = getElementDimension(thePlayer) if intID == 0 then outputChatBox( "You must be inside an interior to restock. Or use SYNTAX: /" .. commandName .. " [Interior ID] [Amount 1~300]", thePlayer, 255, 194, 14 ) return false end else if not amount or not tonumber(amount) or tonumber(amount)%1~=0 or tonumber(amount) < 1 or tonumber(amount) > 300 then outputChatBox( "SYNTAX: /" .. commandName .. " [Interior ID] [Amount 1~300]", thePlayer, 255, 194, 14 ) outputChatBox( "Restocks businesses with supplies.", thePlayer, 255, 100, 0 ) return false end end local possibleInteriors = getElementsByType("interior") for _, interior in ipairs(possibleInteriors) do if tonumber(intID) == getElementData(interior, "dbid") then if not exports.rp_integration:isPlayerAdmin(thePlayer) then local success, msg1, msg2 = exports["rp_jobs"]:remoteOrderSupplies(thePlayer, intID, amount, true) --outputChatBox(msg1,thePlayer, 255, 194, 14) outputChatBox(msg2,thePlayer, 255, 194, 14) if success then return true else return false end else local amount2 = getElementData(interior, "status")[6] + tonumber(amount) local mQuery1 = dbExec(mysql:getConnection(),"UPDATE `interiors` SET `supplies` = '"..amount2.."' WHERE `id` = '"..intID.."'") or false if not mQuery1 then outputChatBox( "Failed to restock "..getElementData(interior, "name").." (ID#"..intID.."), Database error!", thePlayer, 255, 0, 0 ) return false end --exports["interiors"]:reloadOneInterior(tonumber(intID)) outputChatBox( getElementData(interior, "name").." (ID#"..intID..") has been restocked with "..amount.." supplies.", thePlayer, 0, 255, 0 ) local adminUsername = getElementData(thePlayer, "account:username") local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") local adminTitle = exports.rp_global:getPlayerAdminTitle(thePlayer) local adminID = getElementData(thePlayer, "account:id") if hiddenAdmin == 0 then exports.rp_global:sendMessageToAdmins("[INTERIOR]: "..adminTitle.." ".. getPlayerName(thePlayer):gsub("_", " ").. " ("..adminUsername..") has restocked "..getElementData(interior, "name").." (ID#"..intID..") with "..amount.." of supplies.") else exports.rp_global:sendMessageToAdmins("[INTERIOR]: A hidden admin has has restocked "..getElementData(interior, "name").." (ID#"..intID..") with "..amount.." of supplies.") end local addLog = dbExec(mysql:getConnection(),"INSERT INTO `interior_logs` (`intID`, `action`, `actor`) VALUES ('"..tostring(intID).."', '"..commandName:gsub("'","''").." with "..amount.." supplies', '"..adminID.."')") or false if not addLog then outputDebugString("Failed to add interior logs.") end return true end end end end end addCommandHandler("restock", restock, false, false) function setInteriorFaction(thePlayer, cmd, ...) if exports.rp_integration:isPlayerAdmin(thePlayer) then if not (...) then outputChatBox("SYNTAX: /" .. cmd .. " [Faction Name or Faction ID]", thePlayer, 255, 194, 14 ) return end local dim = getElementDimension(thePlayer) if dim < 1 then outputChatBox("You must be inside an interior to perform this action.", thePlayer, 255, 0, 0 ) return end local clue = table.concat({...}, " ") local theFaction = nil if tonumber(clue) then theFaction = exports.rp_pool:getElement("team", tonumber(clue)) else theFaction = exports.rp_factions:getFactionFromName(clue) end if not theFaction then outputChatBox("No faction found.", thePlayer, 255, 0, 0 ) return end local dbid, entrance, exit, interiorType, interiorElement = exports['rp_interiors']:findProperty( thePlayer ) if not isElement(interiorElement) then outputChatBox("No interior found here.", thePlayer, 255, 0, 0 ) return end local can , reason = exports.rp_global:canFactionBuyInterior(theFaction) if not can then outputChatBox(reason, thePlayer, 255, 0, 0 ) return end local factionId = getElementData(theFaction, "id") local factionName = getTeamName(theFaction) local intName = getElementData(interiorElement, "name") if not dbExec(mysql:getConnection(), "UPDATE interiors SET owner='-1', faction='"..factionId.."', locked=0 WHERE id='" .. dbid .. "'") then outputChatBox("Internal Error.", thePlayer, 255, 0, 0 ) return end call( getResourceFromName( "rp_items" ), "deleteAll", interiorType == 1 and 5 or 4, dbid ) exports.rp_global:giveItem(thePlayer, interiorType == 1 and 5 or 4, dbid) exports.rp_logs:dbLog(thePlayer, 37, { "in"..tostring(dbid) } , "SETINTFACTION INTERIOR ID#"..dbid.." TO FACTION '"..factionName.."'") exports['rp_interiors']:realReloadInterior(tonumber(dbid)) triggerClientEvent(thePlayer, "createBlipAtXY", thePlayer, entrance[INTERIOR_TYPE], entrance[INTERIOR_X], entrance[INTERIOR_Y]) exports.rp_global:sendMessageToAdmins("[INTERIOR] "..exports.rp_global:getPlayerFullIdentity(thePlayer).." transferred the ownership of interior '"..intName.."' ID #"..dbid.." to faction '"..factionName.."'.") return true end end addCommandHandler("setintfaction", setInteriorFaction, false, false) function setInteriorToMyFaction(thePlayer, cmd) local factionId = getElementData(thePlayer, "faction") local factionLeader = getElementData(thePlayer, "factionleader") if not factionId or not factionLeader or factionId < 1 or factionLeader < 1 then outputChatBox("You must be a faction leader to perform this action.", thePlayer, 255, 0, 0 ) return end local dim = getElementDimension(thePlayer) if dim < 1 then outputChatBox("You must be inside an interior to perform this action.", thePlayer, 255, 0, 0 ) return end local theFaction = exports.rp_pool:getElement("team", tonumber(factionId)) if not theFaction then outputChatBox("No faction found.", thePlayer, 255, 0, 0 ) return end local dbid, entrance, exit, interiorType, interiorElement = exports['rp_interiors']:findProperty( thePlayer ) if not isElement(interiorElement) then outputChatBox("No interior found here.", thePlayer, 255, 0, 0 ) return end local charId = getElementData(thePlayer, "dbid") local intStatus = getElementData(interiorElement, "status") local intName = getElementData(interiorElement, "name") local factionName = getTeamName(theFaction) if intStatus[INTERIOR_OWNER] ~= charId then outputChatBox("You must own this interior to perform this action.", thePlayer, 255, 0, 0 ) return end local can , reason = exports.rp_global:canPlayerFactionBuyInterior(thePlayer) if not can then outputChatBox(reason, thePlayer, 255, 0, 0 ) return end if not dbExec(mysql:getConnection(), "UPDATE interiors SET owner='-1', faction='"..factionId.."', locked=0 WHERE id='" .. dbid .. "'") then outputChatBox("Internal Error.", thePlayer, 255, 0, 0 ) return end call( getResourceFromName( "item-system" ), "deleteAll", interiorType == 1 and 5 or 4, dbid ) exports.rp_global:giveItem(thePlayer, interiorType == 1 and 5 or 4, dbid) exports.rp_logs:dbLog(thePlayer, 37, { "in"..tostring(dbid) } , "SETINTTOMYFACTION INTERIOR ID#"..dbid.." TO FACTION '"..factionName.."'") exports['rp_interiors']:realReloadInterior(tonumber(dbid)) triggerClientEvent(thePlayer, "createBlipAtXY", thePlayer, entrance[INTERIOR_TYPE], entrance[INTERIOR_X], entrance[INTERIOR_Y]) exports.rp_global:sendMessageToAdmins("[INTERIOR] "..exports.rp_global:getPlayerFullIdentity(thePlayer).." transferred the ownership of interior '"..intName.."' ID #"..dbid.." to his faction '"..factionName.."'.") return true end addCommandHandler("setinttomyfaction", setInteriorToMyFaction, false, false) ERROR : [2024-03-29 05:38:52] WARNING: [rooster-db]\rp_interiormanager\server.lua:12: Bad argument @ 'dbQuery' [Expected db-connection at argument 2, got nil] [2024-03-29 05:38:58] WARNING: [rooster-db]\rp_interiormanager\server.lua:12: Bad argument @ 'dbQuery' [Expected db-connection at argument 2, got nil]
  3. local mysql = exports.rp_mysql

    function setElementDataEx(source, field, parameter, streamtoall, streamatall)
        exports.rp_anticheat:changeProtectedElementDataEx( source, field, parameter, streamtoall, streamatall)
    end

    function getAllInts(thePlayer, commandName, ...)
        if exports.rp_integration:isPlayerAdmin( thePlayer ) then
            local interiorsList = {}
            local mQuery1 = nil
            
            dbQuery(
                function(qh)
                    local res, rows, err = dbPoll(qh, 0)
                    if rows > 0 then
                        for index, row in ipairs(res) do
                            table.insert(interiorsList, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } )
                        end
                        triggerClientEvent(thePlayer, "createIntManagerWindow", thePlayer, interiorsList, getElementData( thePlayer, "account:username" ))
                    end
                end,
            connection, "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id ORDER BY interiors.createdDate DESC")
        end
    end
    addCommandHandler("interiors", getAllInts)
    addCommandHandler("ints", getAllInts)
    addEvent("interiorManager:openit", true)
    addEventHandler("interiorManager:openit", getRootElement(), getAllInts)

    function delIntCmd(thePlayer, intID )
        executeCommandHandler ( "delint", thePlayer, intID )
    end
    addEvent("interiorManager:delint", true)
    addEventHandler("interiorManager:delint", getRootElement(), delIntCmd)

    function disableInt(thePlayer, intID )
        executeCommandHandler ( "toggleinterior", thePlayer, intID )
    end
    addEvent("interiorManager:disableInt", true)
    addEventHandler("interiorManager:disableInt", getRootElement(), disableInt)

    function gotoInt(thePlayer, intID )
        executeCommandHandler ( "gotohouse", thePlayer, intID )
    end
    addEvent("interiorManager:gotoInt", true)
    addEventHandler("interiorManager:gotoInt", getRootElement(), gotoInt)

    function restoreInt(thePlayer, intID )
        executeCommandHandler ( "restoreInt", thePlayer, intID )
    end
    addEvent("interiorManager:restoreInt", true)
    addEventHandler("interiorManager:restoreInt", getRootElement(), restoreInt)

    function removeInt(thePlayer, intID )
        executeCommandHandler ( "removeint", thePlayer, intID )
    end
    addEvent("interiorManager:removeInt", true)
    addEventHandler("interiorManager:removeInt", getRootElement(), removeInt)
      
    function forceSellInt(thePlayer, intID )
        executeCommandHandler ( "fsell", thePlayer, intID )
    end
    addEvent("interiorManager:forceSellInt", true)
    addEventHandler("interiorManager:forceSellInt", getRootElement(), forceSellInt)

    function openAdminNote(thePlayer, intID )
        executeCommandHandler ( "checkint", thePlayer, intID )
    end
    addEvent("interiorManager:openAdminNote", true)
    addEventHandler("interiorManager:openAdminNote", getRootElement(), openAdminNote)

    function interiorSearch(thePlayer, keyword )
        if keyword and keyword ~= "" and keyword ~= "Search..." then
            local interiorsResultList = {}
            local mQuery1 = nil
            dbQuery(
                function(qh, thePlayer)
                    local res, rows, err = dbPoll(qh, 0)
                    if rows > 0 then
                        for index, row in ipairs(res) do
                            table.insert(interiorsResultList, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } )
                        end
                        triggerClientEvent(thePlayer, "interiorManager:FetchSearchResults", thePlayer, interiorsResultList, getElementData( thePlayer, "account:username" ))
                    end
                end,
            {thePlayer}, mysql:getConnection(), "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id WHERE interiors.id LIKE '%"..keyword.."%' OR interiors.name LIKE '%"..keyword.."%' OR factions.name LIKE '%"..keyword.."%' OR cost LIKE '%"..keyword.."%' OR charactername LIKE '%"..keyword.."%' OR username LIKE '%"..keyword.."%' OR interiors.creator LIKE '%"..keyword.."%' ORDER BY interiors.createdDate DESC")
        end
    end
    addEvent("interiorManager:Search", true)
    addEventHandler("interiorManager:Search", getRootElement(), interiorSearch)

    function checkInt(thePlayer, commandName, intID)
        if exports.rp_integration:isPlayerTrialAdmin( thePlayer ) then 
            if not tonumber(intID) or (tonumber(intID) <= 0 ) or (tonumber(intID) % 1 ~= 0 ) then
                intID = getElementDimension(thePlayer)
                if intID == 0 then
                    outputChatBox( "You must be inside an interior.", thePlayer, 255, 194, 14)
                    outputChatBox("Or use SYNTAX: /"..commandName.." [Interior ID]", thePlayer, 255, 194, 14)
                    return false
                end
            end
            dbQuery(
                function(qh, thePlayer)
                    local res, rows, err = dbPoll(qh, 0)
                    if rows > 0 then
                        local result = {}
                        for index, row in ipairs(res) do
                            table.insert(result, { row["iID"], row["type"], row["name"], row["cost"], row["charactername"], row["username"], row["cked"], row["DiffDate"], row["locked"], row["supplies"], row["safepositionX"], row["safepositionY"], row["safepositionZ"], row["disabled"], row["deleted"], '', row["iCreatedDate"],row["iCreator"], row["`interiors`.`x`"], row["`interiors`.`y`"], row["`interiors`.`z`"], row['fowner'] } )
                        end
                        dbQuery(
                            function(qh, thePlayer)
                                local res, rows, err = dbPoll(qh, 0)
                                if rows > 0 then
                                    local result2 = {}
                                    for index, row2 in ipairs(res) do
                                        table.insert(result2, { row2["date"], row2["action"], row2["adminname"], row2["logid"], row2["intID"]} )
                                    end
                                    dbQuery(
                                        function(qh, thePlayer)
                                            local res, rows, err = dbPoll(qh, 0)
                                            if rows > 0 then
                                                local notes = {}
                                                for index, row2 in ipairs(res) do
                                                    row2.creatorname = formatCreator(row2.creatorname, row2.creator)
                                                    table.insert(notes, row2 )
                                                end
                                            end
                                            triggerClientEvent(thePlayer, "createCheckIntWindow", thePlayer, result, exports.rp_global:getPlayerAdminTitle(thePlayer), result2, notes)
                                        end,
                                    {thePlayer}, mysql:getConnection(), "SELECT n.id, n.note, a.username AS creatorname, n.date, n.creator FROM interior_notes n LEFT JOIN accounts a ON n.creator=a.id WHERE n.intid="..intID.." ORDER BY n.date DESC")
                                end
                            end,
                        {thePlayer}, mysql:getConnection(), "SELECT `interior_logs`.`date` AS `date`, `interior_logs`.`intID` as `intID`, `interior_logs`.`action` AS `action`, `accounts`.`username` AS `adminname`, `interior_logs`.`log_id` AS `logid` FROM `interior_logs` LEFT JOIN `accounts` ON `interior_logs`.`actor` = `accounts`.`id` WHERE `interior_logs`.`intID` = '"..intID.."' ORDER BY `interior_logs`.`date` DESC")
                    end
                end,
            {thePlayer}, mysql:getConnection(), "SELECT factions.name AS fowner, interiors.id AS iID, interiors.type AS type, interiors.name AS name, cost, charactername, username, cked, locked, supplies, safepositionX,safepositionY, safepositionZ, disabled, deleted, interiors.createdDate AS iCreatedDate, interiors.creator AS iCreator, DATEDIFF(NOW(), lastused) AS DiffDate, interiors.x, interiors.y, interiors.y FROM interiors LEFT JOIN characters ON interiors.owner = characters.id LEFT JOIN accounts ON characters.account = accounts.id LEFT JOIN factions ON interiors.faction=factions.id WHERE interiors.id = '"..intID.."' ORDER BY interiors.createdDate DESC")
        end
    end
    addCommandHandler("checkint", checkInt)
    addCommandHandler("checkinterior", checkInt)
    addEvent("interiorManager:checkint", true)
    addEventHandler("interiorManager:checkint", getRootElement(), checkInt)

    function formatCreator(creator, creatorId)
        if creator and creatorId then
            if creator == nil then
                if creatorId == "0" then
                    return "SYSTEM"
                else
                    return "N/A"
                end
            else
                return creator
            end
        else
            return "N/A"
        end
    end

    function saveAdminNote(intID, adminNote, noteId )
        if not intID or not adminNote then
            outputChatBox("Internal Error!", source, 255,0,0)
            return false
        end

        if string.len(adminNote) > 500 then
            outputChatBox("Admin note has failed to add. Reason: Exceeded 500 characters.", source, 255, 0, 0)
            return false
        end

        if noteId then
            if dbExec(mysql:getConnection(),"UPDATE interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id").." WHERE id ="..noteId.." AND intid="..intID) then
                outputChatBox("You have successfully updated admin note entry #"..noteId.." on interior #"..intID..".", source, 0, 255,0)
                addInteriorLogs(intID, "Modified admin note entry #"..noteId, source)
                return true
            end
        else
            --outputChatBox("INSERT INTO interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id")..", intid="..intID )
            local insertedId = dbExec(mysql:getConnection(),"INSERT INTO interior_notes SET note='"..(adminNote).."', creator="..getElementData(source, "account:id")..", intid="..intID ) 
            if insertedId then
                outputChatBox("You have successfully added a new admin note entry #"..insertedId.." to interior #"..intID..".", source, 0, 255,0)
                addInteriorLogs(intID, "Added new admin note entry #"..insertedId, source)
                return true
            end
        end
    end
    addEvent("interiorManager:saveAdminNote", true)
    addEventHandler("interiorManager:saveAdminNote", getRootElement(), saveAdminNote)

    function restock(thePlayer, commandName, intID, amount)
        if exports.rp_integration:isPlayerTrialAdmin(thePlayer) or exports.rp_integration:isPlayerSupporter(thePlayer) then
            if not intID or not tonumber(intID) or tonumber(intID)%1~=0 then
                amount = 100
                intID = getElementDimension(thePlayer)
                if intID == 0 then
                    outputChatBox( "You must be inside an interior to restock. Or use SYNTAX: /" .. commandName .. " [Interior ID] [Amount 1~300]", thePlayer, 255, 194, 14 )
                    return false
                end
            else
                if not amount or not tonumber(amount) or tonumber(amount)%1~=0 or tonumber(amount) < 1 or tonumber(amount) > 300 then
                    outputChatBox( "SYNTAX: /" .. commandName .. " [Interior ID] [Amount 1~300]", thePlayer, 255, 194, 14 )
                    outputChatBox( "Restocks businesses with supplies.", thePlayer, 255, 100, 0 )
                    return false
                end
            end
            local possibleInteriors = getElementsByType("interior")
            for _, interior in ipairs(possibleInteriors) do
                if tonumber(intID) == getElementData(interior, "dbid") then
                    if not exports.rp_integration:isPlayerAdmin(thePlayer) then
                        local success, msg1, msg2 = exports["rp_jobs"]:remoteOrderSupplies(thePlayer, intID, amount, true)
                        --outputChatBox(msg1,thePlayer, 255, 194, 14)
                        outputChatBox(msg2,thePlayer, 255, 194, 14)
                        if success then
                            return true
                        else
                            return false
                        end
                    else
                        local amount2 = getElementData(interior, "status")[6] + tonumber(amount)
                        local mQuery1 = dbExec(mysql:getConnection(),"UPDATE `interiors` SET `supplies` = '"..amount2.."' WHERE `id` = '"..intID.."'") or false
                        if not mQuery1 then
                            outputChatBox( "Failed to restock "..getElementData(interior, "name").." (ID#"..intID.."), Database error!", thePlayer, 255, 0, 0 )
                            return false
                        end
                        --exports["interiors"]:reloadOneInterior(tonumber(intID))
                        outputChatBox( getElementData(interior, "name").." (ID#"..intID..") has been restocked with "..amount.." supplies.", thePlayer, 0, 255, 0 )
                        local adminUsername = getElementData(thePlayer, "account:username")
                        local hiddenAdmin = getElementData(thePlayer, "hiddenadmin")
                        local adminTitle = exports.rp_global:getPlayerAdminTitle(thePlayer)
                        local adminID = getElementData(thePlayer, "account:id")
                        if hiddenAdmin == 0 then
                            exports.rp_global:sendMessageToAdmins("[INTERIOR]: "..adminTitle.." ".. getPlayerName(thePlayer):gsub("_", " ").. " ("..adminUsername..") has restocked "..getElementData(interior, "name").." (ID#"..intID..") with "..amount.." of supplies.")
                        else
                            exports.rp_global:sendMessageToAdmins("[INTERIOR]: A hidden admin has has restocked "..getElementData(interior, "name").." (ID#"..intID..") with "..amount.." of supplies.")
                        end
                        local addLog = dbExec(mysql:getConnection(),"INSERT INTO `interior_logs` (`intID`, `action`, `actor`) VALUES ('"..tostring(intID).."', '"..commandName:gsub("'","''").." with "..amount.." supplies', '"..adminID.."')") or false
                        if not addLog then
                            outputDebugString("Failed to add interior logs.")
                        end
                        return true
                    end
                end
            end
        end
    end
    addCommandHandler("restock", restock, false, false)

    function setInteriorFaction(thePlayer, cmd, ...)
        if exports.rp_integration:isPlayerAdmin(thePlayer) then

            if not (...) then
                outputChatBox("SYNTAX: /" .. cmd .. " [Faction Name or Faction ID]", thePlayer, 255, 194, 14 )
                return
            end

            local dim = getElementDimension(thePlayer)
            if dim < 1 then
                outputChatBox("You must be inside an interior to perform this action.", thePlayer, 255, 0, 0 )
                return
            end

            local clue = table.concat({...}, " ")
            local theFaction = nil
            if tonumber(clue) then
                theFaction = exports.rp_pool:getElement("team", tonumber(clue))
            else
                theFaction = exports.rp_factions:getFactionFromName(clue)
            end

            if not theFaction then
                outputChatBox("No faction found.", thePlayer, 255, 0, 0 )
                return
            end

            local dbid, entrance, exit, interiorType, interiorElement = exports['rp_interiors']:findProperty( thePlayer )
            if not isElement(interiorElement) then
                outputChatBox("No interior found here.", thePlayer, 255, 0, 0 )
                return
            end

            local can , reason = exports.rp_global:canFactionBuyInterior(theFaction)
            if not can then
                outputChatBox(reason, thePlayer, 255, 0, 0 )
                return 
            end

            local factionId = getElementData(theFaction, "id")
            local factionName = getTeamName(theFaction)
            local intName = getElementData(interiorElement, "name")

            if not dbExec(mysql:getConnection(), "UPDATE interiors SET owner='-1', faction='"..factionId.."', locked=0 WHERE id='" .. dbid .. "'") then
                outputChatBox("Internal Error.", thePlayer, 255, 0, 0 )
                return
            end

            call( getResourceFromName( "rp_items" ), "deleteAll", interiorType == 1 and 5 or 4, dbid )
            exports.rp_global:giveItem(thePlayer, interiorType == 1 and 5 or 4, dbid)

            exports.rp_logs:dbLog(thePlayer, 37, { "in"..tostring(dbid) } , "SETINTFACTION INTERIOR ID#"..dbid.." TO FACTION '"..factionName.."'")
            exports['rp_interiors']:realReloadInterior(tonumber(dbid))
            triggerClientEvent(thePlayer, "createBlipAtXY", thePlayer, entrance[INTERIOR_TYPE], entrance[INTERIOR_X], entrance[INTERIOR_Y])
            exports.rp_global:sendMessageToAdmins("[INTERIOR] "..exports.rp_global:getPlayerFullIdentity(thePlayer).." transferred the ownership of interior '"..intName.."' ID #"..dbid.." to faction '"..factionName.."'.")
            return true
        end
    end
    addCommandHandler("setintfaction", setInteriorFaction, false, false)

    function setInteriorToMyFaction(thePlayer, cmd)
        local factionId = getElementData(thePlayer, "faction")
        local factionLeader = getElementData(thePlayer, "factionleader")

        if not factionId or not factionLeader or factionId < 1 or factionLeader < 1 then
            outputChatBox("You must be a faction leader to perform this action.", thePlayer, 255, 0, 0 )
            return
        end

        local dim = getElementDimension(thePlayer)
        if dim < 1 then
            outputChatBox("You must be inside an interior to perform this action.", thePlayer, 255, 0, 0 )
            return
        end

        local theFaction = exports.rp_pool:getElement("team", tonumber(factionId))
        if not theFaction then
            outputChatBox("No faction found.", thePlayer, 255, 0, 0 )
            return
        end

        local dbid, entrance, exit, interiorType, interiorElement = exports['rp_interiors']:findProperty( thePlayer )
        if not isElement(interiorElement) then
            outputChatBox("No interior found here.", thePlayer, 255, 0, 0 )
            return
        end

        local charId = getElementData(thePlayer, "dbid")
        local intStatus = getElementData(interiorElement, "status")
        local intName = getElementData(interiorElement, "name")
        local factionName = getTeamName(theFaction)

        if intStatus[INTERIOR_OWNER] ~= charId then
            outputChatBox("You must own this interior to perform this action.", thePlayer, 255, 0, 0 )
            return
        end

        local can , reason = exports.rp_global:canPlayerFactionBuyInterior(thePlayer)
        if not can then
            outputChatBox(reason, thePlayer, 255, 0, 0 )
            return 
        end

        if not dbExec(mysql:getConnection(), "UPDATE interiors SET owner='-1', faction='"..factionId.."', locked=0 WHERE id='" .. dbid .. "'") then
            outputChatBox("Internal Error.", thePlayer, 255, 0, 0 )
            return
        end

        call( getResourceFromName( "item-system" ), "deleteAll", interiorType == 1 and 5 or 4, dbid )
        exports.rp_global:giveItem(thePlayer, interiorType == 1 and 5 or 4, dbid)

        exports.rp_logs:dbLog(thePlayer, 37, { "in"..tostring(dbid) } , "SETINTTOMYFACTION INTERIOR ID#"..dbid.." TO FACTION '"..factionName.."'")
        exports['rp_interiors']:realReloadInterior(tonumber(dbid))
        triggerClientEvent(thePlayer, "createBlipAtXY", thePlayer, entrance[INTERIOR_TYPE], entrance[INTERIOR_X], entrance[INTERIOR_Y])
        exports.rp_global:sendMessageToAdmins("[INTERIOR] "..exports.rp_global:getPlayerFullIdentity(thePlayer).." transferred the ownership of interior '"..intName.."' ID #"..dbid.." to his faction '"..factionName.."'.")
        return true
    end
    addCommandHandler("setinttomyfaction", setInteriorToMyFaction, false, false)

    ERROR : [2024-03-29 05:38:52] WARNING: [rooster-db]\rp_interiormanager\server.lua:12: Bad argument @ 'dbQuery' [Expected db-connection at argument 2, got nil]
    [2024-03-29 05:38:58] WARNING: [rooster-db]\rp_interiormanager\server.lua:12: Bad argument @ 'dbQuery' [Expected db-connection at argument 2, got nil]

  4. Game Mode Sale Announcement The game mode is now on sale, and we have important updates to share with you. https://payhip.com/b/Bw8CG Buy Here retirement from the game. New Updates: Weapon system Bed system Broken weapon system Code look system Character selection system Animals + BOT Login System Inventory System Shop System Wallet System with BTC New weapon skins for VIP membership Above-sleeper name display Tools visibility without killing the sleeper Purchase store with real money Revamped team system Modifications to building appearance Modifications to the entire map Tagging friends to enemies Placing markers on the map according to images shown
  5. Estou com um script de inventario onde eu clico usar e aparece a txd dff mas presciso que o personagem faça um setElementBoneRotation junto com isso tudo. Meu script: elseif item == "mochila" then local position = { getElementPosition(player) } local dimension = getElementDimension(player) local interior = getElementInterior(player) if mochila[player] then --sendNotification(player, "error", "Você já tem uma mochila nas costa, use /mochila.") triggerClientEvent(player, 'addBox', player, "error", "Você já tem uma mochila nas costa, use /mochila.") return end mochila[player] = createObject(1858, unpack(position)) setElementDimension(mochila[player], dimension) setElementInterior(mochila[player], interior) exports.bone_attach:attachElementToBone(mochila[player], player, 5, -0.250, 0.05, 0, 0, 0, -105) setElementBoneRotation(mochila[player], player, 33, 0, 219.6, 345.6) setElementBoneRotation(mochila[player], player, 23, 0, 216, 10.8) -- sendNotification(player, "success", "Agora você está usando uma mochila.") triggerClientEvent(player, 'addBox', player, "success", "Agora você está usando uma mochila.") --sendNotification(player, "info", "Para remover a mochila utilize /mochila.") triggerClientEvent(player, 'addBox', player, "info", "Para remover a mochila utilize /mochila.")
  6. DataSystem Links: Github: https://github.com/PWisniaNE/MTA-SA-DataSystem Authors: P.Wiśnia (https://github.com/PWisniaNE) Rick (https://github.com/httpRick/) Server-Side functions: setCustomData(element,name,variable,key) getCustomData(element,name,key) getAllCustomData(element,key) getElementsByCustomData(name,key) hasCustomData(element, selectedKey, name, variable) removeCustomData(element,name,key) Client-Side functions: getCustomData(element,name) setCustomData(element,name,variable) hasCustomData(element,name,variable) KeyTypes: Server (non-synchronization, data only storage on server) Synced (synchronization with all players) Client (synchronization from server to one player) Group (synchronization from server to group of players)
  7. Yesterday
  8. mouxd

    cl 16

    game is not opining --------------------------- MTA: San Andreas [CL16] (CTRL+C to copy) --------------------------- Load failed. Please ensure that the latest data files have been installed correctly. Do you want to see some on-line help about this problem ? --------------------------- Yes No ---------------------------
  9. Join us, today! @ UCP: https://ardicgaming.com/ Forums: https://forums.ardicgaming.com/ Community Rules: https://wiki.ardicgaming.com/ Discord: https://ardicgaming.com/discord/ Server IP: mtasa://164.132.200.104:22003
  10. The idea is good: having server data, synced data and private data :+1
  11. You should use client instead of source in the addEventHandler.
  12. Hi, I started slowly creating an alternative elementdat system. Link: https://github.com/PWisniaNE/MTA-SA-UserDataSystem/ If you have any suggestions how to improve or optimize the system, I will be happy to listen to your suggestions. I would like the code to be as optimal and safe as possible.
  13. Hey Everyone ! How do I make something like this ?
  14. Last week
  15. Me olvidé de repostear una nueva actu que tuvimos a inicios de Marzo donde ya empezamos a trabajar en otras cosas y dandole un nuevo enfoque al servidor intentando progresar de todas las maneras posibles. https://www.bayside-rp.net/t100266-actualizacion-2-2-5
  16. A culpa é inteiramente da administração do servidor. As possíveis causas são as seguintes: 1) Não desenvolveram uma segurança decente para o servidor, permitindo que os jogadores violem os banimentos. 2) Desenvolveram resources com brechas de segurança que tornaram o servidor violável pelos clientes. 3) Deram permissão admin para algum resource desconhecido que está colocando usuários não autorizados na ACL Group Console.
  17. Hello, yesterday i was encountering a bug, when i play , sometimes an error pops up. It's "Direct3DDevice9 Reset error 887a0006 . I asked the question on MTA Discord server, and i have been told that it may be because my graphics card is overheating. I am on a laptop, windows 11 and i have no idea on how to fix this, i have been playing for 4 hours and then the error crashed. How is it happening? well, my game freezes, then the screen goes black, then gray, and then the mta closes and that error pops up. Any idea on how i can fix it? Contact me here, or either on discord (KoXuu), i recommend discord, but if thats not an option, let me know here. Thank you!
  18. Yep, same problem. It worked fine for years on my Linux install but since yesterday, the error showed up again and no matter how often or long i have the server running, the error still shows up. I can somehow bypass this by disconnecting the internet before starting the game, join into my local server and then enable my connection again, this allows me to play on any server like usual.
  19. شباب ابي برنامج تحرير نصوص مخصص للعبة Mta sa ويكون في مكتبه اكواد الخاص باللعبه يعني مثلا كود outputChatBox بطبيعة الحال هيكون ازرق فا ياريت تفيدوني بأحدث البرامج لاني بحثت كتير ومالقيت + عندي Mta Script Editor لكنه نسخه قديمه واظن ماعندهم تحديث
  20. Boa noite, tenho um servidor de mta grande e tô desistindo dele porque tá uma porcaria continuar, em 2 dias sofri um ataque de cheats e eles pegou painel P facilmente forçando o evento, e eu queria que vocês desse Ban nesse pessoal, é uma grupo de 3-5 pessoa.
  21. Nenhum desses exemplos vai funcionar pois faltou fechar o parênteses do addEventHandler. Adicione um ) depois do último end.
  22. Join us, today! @ UCP: https://ardicgaming.com/ Forums: https://forums.ardicgaming.com/ Community Rules: https://wiki.ardicgaming.com/ Discord: https://ardicgaming.com/discord/ Server IP: mtasa://164.132.200.104:22003
  23. Cliente: addEventHandler("onClientPlayerDamage", root, function() if bodypart == 9 then setElementHealth(source, getElementHealth(source) - 30) end end Meta: <meta> <script src="client.lua" type="client" /> </meta>
  24. cara eu n sei muito de script sabe, então preciso criar uma função ou um local função ?
  1. Load more activity
×
×
  • Create New...