italoblade1

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About italoblade1

  • Rank
    Vic

Details

  • Gang
    Thzxz
  • Location
    Brazil
  • Occupation
    Owner
  • Interests
    scripts mta dayz

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. italoblade1

    HELP BIND

    I need a help from the community, it is possible to prevent a player from using a specific bind, such as crouching on the mouse1, if possible, how to do it. Many players take advantage of bugs because of this, I wanted the player to be kicked when entering with bind or to take kick when to configure this bind
  2. I discovered the location of the problem, it's in a groups resource. But I do not know the reason, I've already changed the system to a more current one and still this problem continues to hang at a random moment, overloading the entire machine and freezing the server. Print from minutes after the server defrost: groups.lua here ------------------------------------------------------------------------------------ -- PROJECT: N/A -- RIGHTS: All rights reserved by developers -- FILE: groupSystem/group.slua -- DEVELOPER: Sebbe (Smart) ------------------------------------------------------------------------------------ local groupTable = {} local log = false -- Set this to false if you don't want group stuff to be logged in your server.log local debugInfo = false -- Set this to false if you don't want to see see group logs in your debug mode. local GAC = {} -- index = account (string), [1] = group name, [2] = rank, [3] = warning level, [4] = date Joined, [5] = last time online (Not Available) local users = {} local myGang = {} local rankCache = {} local db = dbConnect("sqlite", "/database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS groupmember (account TEXT, groupName TEXT, rank TEXT, warningLvl TEXT, joined TEXT, lastTime TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS groups (name TEXT, leader TEXT, message TEXT, chatcolor TEXT, notecolor TEXT, date TEXT, turfcolor TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS groupRanks (groupName TEXT, name TEXT, permissions TEXT)") playerTeam = createTeam("Player") --Some misc functions _outputDebugString = outputDebugString function outputDebugString(string) if (debugInfo) then _outputDebugString(string) end end function getTime() local time = getRealTime() local date = string.format("%02d/%02d/%02d", time.monthday, (time.month+1), (time.year-100) ) local time = string.format("%02d:%02d", time.hour, time.minute) return date, time end MTAoutput = outputChatBox function outputChatBox(message, player, r, g, b, bool) if (isElement(message) and getElementType(message) == "player") then MTAoutput(player, message, r, g, b, bool) else MTAoutput(message, player, r, g, b, bool) end end function groupLog(group, message) if (log) then outputServerLog("GROUP: "..group.." - "..message) end if (debugInfo) then outputDebugString("GROUP: "..group.." - "..message) end end --Lets start local permToTable = { [1] = "invite", [2] = "promote", [3] = "demote", [4] = "kick", [5] = "warn", [6] = "delete", [7] = "deposit", [8] = "withdraw", [9] = "editInfo", [10] = "viewLog", [11] = "viewBlacklist", [12] = "addBlaclist", [13] = "changeTurfColor", [14] = "modifyAlliance", [15] = "modifyRanks", } function account(plr) if (plr and isElement(plr)) then return getAccountName(getPlayerAccount(plr)) end end function loadGroupRanks(query) local the_table = dbPoll(query, 0) if (the_table) then for ind, data in pairs(the_table) do if (not rankCache[data.groupName]) then rankCache[data.groupName] = {} end if (not rankCache[data.groupName][data.name]) then rankCache[data.groupName][data.name] = {} end local JSONtable = fromJSON(data.permissions) for ind, value in pairs(JSONtable) do if (value and ind) then rankCache[data.groupName][data.name][ind] = true end end end end end dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") function loadGroupStuff(query) local g_table = dbPoll(query, 0) if (not g_table) then return end for ind, data in ipairs(g_table) do groupTable[data.name] = {data.leader, data.message, data.chatcolor, data.notecolor, data.date, data.turfcolor} end end dbQuery(loadGroupStuff, db, "SELECT * FROM groups") function loadClientGroup(query) local g_table = dbPoll(query, 0) if (not g_table) then return end for ind, data in ipairs(g_table) do local player = getAccountPlayer(getAccount(data.account)) users[data.groupName] = {} table.insert(users[data.groupName], data.account) if (player) then setElementData(player, "Group", data.groupName) myGang[player] = data.groupName end GAC[data.account] = {data.groupName, data.rank, data.warningLvl, data.joined, data.lastTime or 0} end end dbQuery(loadClientGroup, db, "SELECT * FROM groupmember") function addRank(group, rank, permissionTable) if (not rankCache[group]) then rankCache[group] = {} end --rankCache[group][rank] = {fromJSON(permissionTable)} dbExec(db, "INSERT INTO groupRanks VALUES (?, ?, ?)", tostring(group), tostring(rank), permissionTable) dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") end function removeRank(group, rank) if (not rankCache[group]) then return true end if (rankCache[group][rank]) then rankCache[group][rank] = nil dbExec(db, "DELETE FROM groupRanks WHERE name=? AND groupName=?", tostring(rank), tostring(group)) dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") return true end end function isRank(group, rank) if (not rankCache[group]) then return false end return rankCache[group][rank] end function groupMemberLogin() if (GAC[account(source)]) then myGang[source] = GAC[account(source)][1] setElementData(source, "Group", GAC[account(source)][1]) setPlayerTeam(source,playerTeam) end end addEventHandler("onPlayerLogin", root, groupMemberLogin) function getGroupMembers(group) local temp = {} for ind, data in pairs(users) do if (ind == group) then table.insert(temp, data[1]) end end return temp end function getPlayerGroup(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][1] end function getPlayerGroupRank(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][2] end function getPlayerWarningLevel(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][3] end function getPlayerJoinDate(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][4] end function getHexCode(r, g, b) if (r and g and b) then return string.format("#%.2X%.2X%.2X", r, g, b) end end function getGroupChatColor(group) if (not groupTable[group]) then return 255, 255, 255 end local color = fromJSON(groupTable[group][3]) return color[1], color[2], color[3] end function getGroupTurfColor(group) if (not groupTable[group]) then return 255, 255, 255 end local color = fromJSON(groupTable[group][6]) return color[1], color[2], color[3] end function outputGroupMessage(message, group) for ind, data in pairs(GAC) do if (data[1] == group) then local acc = getAccount(ind) if (getAccountPlayer(acc)) then local color = fromJSON(groupTable[group][3]) local hex = getHexCode(color[1], color[2], color[3]) outputChatBox("("..group..") #FFFFFF"..message, getAccountPlayer(acc), 9,249,17, true) end end end end function checkGroupAccess(player, actionID) local rank = getPlayerGroupRank(player) local group = getPlayerGroup(player) if (not rankCache[group]) then return false end if (rankCache[group] and rankCache[group][rank]) then if (tostring(actionID)) then for ind, data in pairs(permToTable) do if (data == actionID) then actionID = ind break end end end local actionID = tonumber(actionID) if (rankCache[group][rank][actionID]) then return true end end end function getPermissionCount(group, rank) if (not rankCache[group]) then return false end local count = 0 if (rankCache[group] and rankCache[group][rank]) then for ind, data in pairs(rankCache[group][rank]) do count = count + 1 end end return count end function getGroupRankCount(group) if (not rankCache[group]) then return end local count = 0 for ind, v in pairs(rankCache[group]) do count = count + 1 end return tonumber(count) or 1 end function viewWindow(player) if (player) then client = player end local group = getPlayerGroup(client) local rank = getPlayerGroupRank(client) local dateJoined = getPlayerJoinDate(client) local permRank = false local msg = "" if (group and group ~= "none" and groupTable[group] and groupTable[group][2]) then msg = groupTable[group][2] end if (group and rank and rankCache[group] and rankCache[group][rank]) then permRank = rankCache[group][rank] end triggerClientEvent(client, "groupSystem.done", client, group, rank, dateJoined, msg, permRank) end addEvent("groupSystem.viewWindow", true) addEventHandler("groupSystem.viewWindow", root, viewWindow) function attemptMakeGroup(name) if (isGuestAccount(getPlayerAccount(client))) then return end if (groupTable[name]) then outputChatBox("There is already a group with this name", client, 255, 0, 0) return end if (#name > 20) then outputChatBox("Max group name is 20 characters", client, 255, 0, 0) return end if (not getPlayerGroup(client) or getPlayerGroup(client) == "None" or getPlayerGroup == "nil") then local date, time = getTime() local date = date.." - "..time createGroup(name, client, date) setGroup(client, name, date, "Founder") outputChatBox("You have made a group called '"..name.."'", client, 0, 255, 0) end end addEvent("groupSystem.attemptMakeGroup", true) addEventHandler("groupSystem.attemptMakeGroup", root, attemptMakeGroup) function setGroup(player, group, date, rank) if (not users[group]) then users[group] = {} end local date, time = getTime() local date = date.." - "..time local color = {math.random(255), math.random(255), math.random(255)} myGang[player] = gang GAC[account(player)] = {group, rank, 0, date, 0} table.insert(users[group], account(player)) dbExec(db, "INSERT INTO groupmember VALUES (?, ?, ?, ?, ?, ?)", tostring(account(player)), tostring(group), tostring(rank), "0", date, "0") viewWindow(player) outputDebugString(getPlayerName(player).." joined group: "..group.." as: "..rank.." at: "..date) setPlayerTeam(player,playerTeam) setElementData(player, "Group", group) end function createGroup(name, creator, date) if (not users[name]) then users[name] = {} end local permissions = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} local color = {math.random(255), math.random(255), math.random(255)} addRank(name, "Founder", toJSON(permissions)) groupTable[name] = {account(creator), "", toJSON(color), toJSON(color), date, toJSON(color)} myGang[creator] = name table.insert(users[name], account(creator)) dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") dbExec(db, "INSERT INTO groups VALUES (?, ?, ?, ?, ?, ?, ?)", name, account(creator), "", toJSON(color), toJSON(color), date, toJSON(color)) setPlayerTeam(creator,playerTeam) outputDebugString(getPlayerName(creator).." created group: "..name.." at: "..date) end --[[function hackGroupCommand(plr, cmd, rank, ...) if (account(plr) == "Smart") then local group = table.concat({...}, " ") leaveGroup(plr) setGroup(plr, group, _, rank) end end addCommandHandler("hackgroup", hackGroupCommand)--]] function leaveGroup(player) if (not player) then player = client end local group = getPlayerGroup(player) if (not group) then return end if (getPlayerGroupRank(player) == "Founder") then outputGroupMessage(getPlayerName(player).." has decided to delete the group", group) for ind, data in pairs(GAC) do if (data[1] == group) then if (getAccountPlayer(getAccount(ind))) then setElementData(getAccountPlayer(getAccount(ind)), "Group", nil) end dbExec(db, "DELETE FROM groupmember WHERE account=?", tostring(ind)) GAC[ind] = nil end end dbExec(db, "DELETE FROM groupRanks WHERE groupName=?", tostring(group)) dbExec(db, "DELETE FROM groups WHERE name=?", tostring(group)) groupTable[group] = nil rankCache[group] = nil end dbExec(db, "DELETE FROM groupmember WHERE account=?", tostring(account(player))) GAC[account(player)] = nil viewWindow(player) myGang[player] = nil setPlayerTeam(player,nil) end addEvent("groupSystem.leaveGroup", true) addEventHandler("groupSystem.leaveGroup", root, leaveGroup) function kickAccount(account) dbExec(db, "DELETE FROM groupmember WHERE account=?", tostring(account)) GAC[account] = nil local plr = getAccountPlayer(getAccount(account)) if (plr) then myGang[plr] = nil viewWindow(plr) end end function updateMessage(message) local group = getPlayerGroup(client) if (not groupTable[group]) then outputChatBox"1" return end if (not checkGroupAccess(client, 9)) then outputChatBox"2" return end groupTable[group][2] = message viewWindow(client) dbExec(db, "UPDATE groups SET message=? WHERE name=?", tostring(message), tostring(group)) outputGroupMessage(getPlayerName(client).." has updated the group info", group) end addEvent("groupSystem.updateMessage", true) addEventHandler("groupSystem.updateMessage", root, updateMessage) function printManagment(player) if (player) then player = client end local group = getPlayerGroup(client) for ind, data in pairs(GAC) do if (data[1] == group) then local rank, warning, joined, lastTime = GAC[ind][2], GAC[ind][3],GAC[ind][4], GAC[ind][5] triggerClientEvent(client, "groupSystem.addToList", client, tostring(ind), rank, warning, joined, lastTime, "N/A", getAccountPlayer(getAccount(ind))) end end end addEvent("groupSystem.print", true) addEventHandler("groupSystem.print", root, printManagment) function makeInvite(player) if (getPlayerGroup(player)) then return end if (not getPlayerGroup(client)) then return end if (not checkGroupAccess(client, 1)) then return end local group = getPlayerGroup(client) outputChatBox(getPlayerName(client).." has sent and invite for you to join "..group, player, 0, 255, 0) outputChatBox("Sent an invite to "..getPlayerName(player).." to join "..group, client, 0, 255, 0) triggerClientEvent(player, "groupSystem.addInviteToList", player, group, getPlayerName(client), time) end addEvent("groupSystem.makeInvite", true) addEventHandler("groupSystem.makeInvite", root, makeInvite) function accepInvite(group) if (not groupTable[group]) then outputChatBox(tostring(group).." does no longer exist", client, 255, 0, 0) return end setGroup(client, group, _, "Trial") outputGroupMessage(getPlayerName(client).." has joined the group", group) end addEvent("groupSystem.accepInvite", true) addEventHandler("groupSystem.accepInvite", root, accepInvite) function getGroupList() local count = {} for ind, data in pairs(groupTable) do for ind2, data2 in pairs(GAC) do if (data2[1] == ind) then if (not count[ind]) then count[ind] = 0 end count[ind] = count[ind] + 1 end end end triggerClientEvent(client, "groupSystem.addGroupList", client, groupTable, count) end addEvent("groupSystem.getGroupList", true) addEventHandler("groupSystem.getGroupList", root, getGroupList) function warnAccount(account, lvl, reason) local online = getAccountPlayer(getAccount(account)) local group = getPlayerGroup(client) if (not checkGroupAccess(client, 5)) then return end if (not GAC[account] or not GAC[account][3]) then return end local mine = getPermissionCount(group, getPlayerGroupRank(client)) local his = getPermissionCount(group, GAC[account][2]) if (getAccountName(getPlayerAccount(client)) == account and mine <= 14) then return end if (tonumber(mine) <= tonumber(his) and getAccountName(getPlayerAccount(client)) ~= account) then outputChatBox("You cannot warn this account because it has more permissions attributes than yours", client, 255, 0, 0) return end if (tonumber(GAC[account][3] + lvl) < 1) then add = 0 elseif (tonumber(GAC[account][3] + lvl) >= 100) then if (not checkGroupAccess(client, 4)) then return end if (account == getAccountName(getPlayerAccount(client))) then outputChatBox("You can not kick yourself", client, 255, 0, 0) return end kickAccount(account) outputGroupMessage("Account: "..account.." has been kicked by "..getPlayerName(client).." ("..reason..")", group) groupLog(group, "Account: "..account.." has been kicked by "..getPlayerName(client).." ("..reason..")", group) return else add = GAC[account][3] + lvl end if (online) then outputGroupMessage(getPlayerName(online).." has been warned by "..getPlayerName(client).." ("..lvl.." ("..reason..") Total: "..add..")", group) groupLog(group, getPlayerName(online).." has been warned by "..getPlayerName(client).." ("..lvl.." ("..reason..") Total: "..add..")") else groupLog(group, "Account: "..account.." has been warned by "..getPlayerName(client).." ("..lvl.." ("..reason..") Total: "..add..")") outputGroupMessage("Account: "..account.." has been warned by "..getPlayerName(client).." ("..lvl.." ("..reason..") Total: "..add..")", group) end GAC[account][3] = add dbExec(db, "UPDATE groupmember SET warningLvl=? WHERE account=?", tostring(add), tostring(account)) viewWindow(client) end addEvent("groupSystem.warnAccount", true) addEventHandler("groupSystem.warnAccount", root, warnAccount) function showLog() local group = getPlayerGroup(client) if (not group) then return end if (not checkGroupAccess(client, 10)) then return end outputChatBox("This feature is not available", client, 255, 0, 0) --exports.logs:viewGroupLog(client, group) end addEvent("groupSystem.showLog", true) addEventHandler("groupSystem.showLog", root, showLog) function groupChat(message, messageType) cancelEvent() if (messageType == 2) then local group = getPlayerGroup(source) if not (group) then return end outputGroupMessage(getPlayerName(source)..": "..message, group) end end addEventHandler( "onPlayerChat", getRootElement(), groupChat ) function showRanks() if (not checkGroupAccess(client, 15)) then return end local group = getPlayerGroup(client) triggerClientEvent(client, "groupSystem.doneWithRanks", client, rankCache[group] or {}) end addEvent("groupSystem.showRanks", true) addEventHandler("groupSystem.showRanks", root, showRanks) function addTheRank(name, selected) if (not checkGroupAccess(client, 15)) then return end local group = getElementData(client, "Group") if (not group) then return end local permissions = {false, false, false, false, false, false, false, false, false, false, false, false, false, false} addRank(group, name, toJSON(permissions)) outputChatBox("Added the rank "..name.." successfully", client, 0, 255, 0) triggerClientEvent(client, "groupSystem.doneWithRanks", client, rankCache[group] or {}, name) end addEvent("groupSystem.addTheRank", true) addEventHandler("groupSystem.addTheRank", root, addTheRank) function editRank(name, newPerm) if (not checkGroupAccess(client, 15)) then return end local group = getPlayerGroup(client) if (isRank(group, name)) then removeRank(group, name) else return end addRank(group, name, toJSON(newPerm)) outputChatBox("Edited permissions for rank '"..name.."'", client, 0, 255, 0) groupLog(group, getPlayerName(client).." edited permissions for rank '"..name.."'") end addEvent("groupSystem.editRank", true) addEventHandler("groupSystem.editRank", root, editRank) function deleteRank(rank) if (not checkGroupAccess(client, 15)) then return end local group = getPlayerGroup(client) if (getGroupRankCount(group) == 1) then outputChatBox("Cannot delete the only rank you have", client, 255, 0, 0) return end if (isRank(group, rank)) then removeRank(group, rank) else return end outputGroupMessage(getPlayerName(client).." deleted the rank: "..rank) groupLog(group, getPlayerName(client).." deleted the rank: "..rank) triggerClientEvent(client, "groupSystem.doneWithRanks", client, rankCache[group] or {}) end addEvent("groupSystem.deleteRank", true) addEventHandler("groupSystem.deleteRank", root, deleteRank) function getMyRanks() if (checkGroupAccess(client, 4) or checkGroupAccess(client, 5)) then local group = getPlayerGroup(client) triggerClientEvent(client, "groupSystem.printTheRanks", client, rankCache[group] or {}) end end addEvent("groupSystem.getMyRanks", true) addEventHandler("groupSystem.getMyRanks", root, getMyRanks) function setTheRank(rank, account) if (not account or not getAccount(account)) then outputChatBox("No account was selected from the list", client, 255, 0, 0) return end --if (getAccountName(getPlayerAccount(client)) == account) then return end local group = getPlayerGroup(client) local mine = getPermissionCount(group, getPlayerGroupRank(client)) local his = getPermissionCount(group, rank) if (not rankCache[group] or rankCache[group] and not rankCache[group][rank]) then outputChatBox("This rank ("..tostring(rank)..") was not found in your group", client, 255, 0, 0) return end local online = getAccountPlayer(getAccount(account)) if (not checkGroupAccess(client, 15)) then return end if (tonumber(his) > tonumber(mine)) then outputChatBox("You cannot set the rank of this account because it has more permissions attributes than yours", client, 255, 0, 0) return end if (not GAC[account]) then return end if (GAC[account][1] ~= group) then return end if (GAC[account][2] == rank) then outputChatBox("This account already has the rank "..rank, client, 255, 0, 0) return end if (online) then outputGroupMessage(getPlayerName(client).." has set "..getPlayerName(online).."'s rank to: "..rank, group) groupLog(group, getPlayerName(client).." has set "..getPlayerName(online).."'s rank to: "..rank) else groupLog(group, getPlayerName(client).." has set account: "..account.."'s rank to: "..rank) outputGroupMessage(getPlayerName(client).." has set account: "..account.."'s rank to: "..rank, group) end dbExec(db, "UPDATE groupmember SET rank=? WHERE account=?", tostring(rank), tostring(account)) outputChatBox("You have set the rank of account "..account.." to "..rank, client, 0, 255, 0) GAC[account][2] = rank end addEvent("groupSystem.setTheRank", true) addEventHandler("groupSystem.setTheRank", root, setTheRank) function changeGroupColor(plr, cmd, r, g, b) local r, g, b = r or 255, g or 255, b or 255 local group = getPlayerGroup(plr) if (not group) then return end if (not checkGroupAccess(plr, 13)) then return end if (not groupTable[group]) then return end local color = {r, g, b} dbExec(db, "UPDATE groups SET chatcolor=? WHERE name=?", toJSON(color), group) groupTable[group][3] = toJSON(color) outputGroupMessage(getPlayerName(plr).." has changed the group chat R: "..r.." G: "..g.." B: "..b, group) outputChatBox("Group colour changed to R: "..r.." G: "..g.." B: "..b, r, g, b, "default-bold", plr, true, 0.15) groupLog(group, getPlayerName(plr).." has set chat color to: "..r..", "..g..", "..b) end addCommandHandler("chatcolor", changeGroupColor) function changeTurfColor(plr, cmd, r, g, b) local r, g, b = r or 255, g or 255, b or 255 local group = getPlayerGroup(plr) if (not group) then return end if (not checkGroupAccess(plr, 13)) then return end if (not groupTable[group]) then return end local color = {r, g, b} dbExec(db, "UPDATE groups SET turfcolor=? WHERE name=?", toJSON(color), group) groupTable[group][6] = toJSON(color) outputChatBox("Turf colour changed to R: "..r.." G: "..g.." B: "..b, plr, r, g, b, "default-bold", true, 0.15) groupLog(group, getPlayerName(plr).." has set turf color to: "..r..", "..g..", "..b) end addCommandHandler("turfcolor", changeTurfColor) function setCorrectElementData() for ind, plr in pairs(getElementsByType("player")) do if (not GAC[account(plr)]) then setElementData(plr, "Group", false) end end end setTimer(setCorrectElementData, 2500, 0) Full resource (if needed): https://www.mediafire.com/?1fadf9ry3c6f2u1
  3. yes, but, when I hang up I can not
  4. Hello guy, i have this problem in my server, In a random moment, regardless of the number of players appears and the machine freezes with the MTA using 16GB of RAM (dedicated 16GB). What can it be? [Network] InResultQueue > 200000 msgs. This is due to server overload or script freeze Temporarily suspending incoming sync packets