Jump to content

Best-Killer1

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by Best-Killer1

  1. ERROR: SAEGPolice\jail_s.lua:187: table index is nil code : local WARP_LOCS = { DEFAULT = { }, ADMIN = { }, RELEASE = { } } addEventHandler ( "onResourceStart", resourceRoot, function ( ) local warp_default = get ( "*JAIL_WARP_LOCATION" ); local warp_admin = get ( "*JAIL_WARP_ADMIN_LOCATION" ); local warp_release = get ( "*JAIL_WARP_RELEASE_LOCATION" ); if ( not warp_default ) then outputDebugString ( "Couldn't find '*JAIL_WARP_LOCATION' setting in SAEGPolice" ); WARP_LOCS.DEFAULT = { 0, 0, 0 } else local warp_default = split ( warp_default, "," ); if ( #warp_default ~= 3 ) then outputDebugString ( "'*JAIL_WARP_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); WARP_LOCS.DEFAULT = { 0, 0, 0 } elseif ( not tonumber ( warp_default[1] ) or not tonumber ( warp_default[2] ) or not tonumber ( warp_default[3] ) ) then outputDebugString ( "Failed to convert all '*JAIL_WARP_LOCATION' coordinates to floats. Please confirm they are numbers" ); WARP_LOCS.DEFAULT = { 0, 0, 0 } else WARP_LOCS.DEFAULT = { tonumber(warp_default[1]), tonumber(warp_default[2]), tonumber(warp_default[3]) }; end end if ( not warp_release ) then outputDebugString ( "Couldn't find '*JAIL_WARP_RELEASE_LOCATION' setting in SAEGPolice" ); WARP_LOCS.RELEASE = { 0, 0, 0 } else local warp_release = split ( warp_release, "," ); if ( #warp_release ~= 3 ) then outputDebugString ( "'*JAIL_WARP_RELEASE_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); WARP_LOCS.RELEASE = { 0, 0, 0 } elseif ( not tonumber ( warp_release[1] ) or not tonumber ( warp_release[2] ) or not tonumber ( warp_release[3] ) ) then outputDebugString ( "Failed to convert all '*JAIL_WARP_RELEASE_LOCATION' coordinates to floats. Please confirm they are numbers" ); WARP_LOCS.RELEASE = { 0, 0, 0 } else WARP_LOCS.RELEASE = { tonumber(warp_release[1]), tonumber(warp_release[2]), tonumber(warp_release[3]) }; end end if ( not warp_admin ) then outputDebugString ( "Couldn't find '*JAIL_WARP_ADMIN_LOCATION' setting in SAEGPolice" ); WARP_LOCS.ADMIN = { 0, 0, 0 } else local warp_admin = split ( warp_admin, "," ); if ( #warp_admin ~= 3 ) then outputDebugString ( "'*JAIL_WARP_ADMIN_LOCATION' setting value should be x,y,z (no spaces, please confirm format is correct)" ); WARP_LOCS.ADMIN = { 0, 0, 0 } elseif ( not tonumber ( warp_admin[1] ) or not tonumber ( warp_admin[2] ) or not tonumber ( warp_admin[3] ) ) then outputDebugString ( "Failed to convert all '*JAIL_WARP_ADMIN_LOCATION' coordinates to floats. Please confirm they are numbers" ); WARP_LOCS.ADMIN = { 0, 0, 0 } else WARP_LOCS.ADMIN = { tonumber(warp_admin[1]), tonumber(warp_admin[2]), tonumber(warp_admin[3]) }; end end outputDebugString ( "Default jail warp location: "..tostring ( table.concat( WARP_LOCS.DEFAULT, ", " ) ) ) outputDebugString ( "Admin jail warp location: "..tostring ( table.concat( WARP_LOCS.ADMIN, ", " ) ) ) outputDebugString ( "Release jail warp location: "..tostring ( table.concat( WARP_LOCS.RELEASE, ", " ) ) ) end ); local jailedPlayers = { } function isPlayerJailed ( p ) if ( p and getElementType ( p ) == 'player' ) then if ( jailedPlayers[p] ) then return tonumber ( getElementData ( p, 'SAEGPolice:JailTime' ) ) else return false end end return nil end function jailPlayer ( p, dur, announce, element, reason ) if( p and dur ) then local announce = announce or false jailedPlayers[p] = dur setElementInterior ( p, 0 ) setElementDimension ( p, 33 ) local __x, __y, __z = unpack ( WARP_LOCS.DEFAULT ) if ( element and reason ) then __x, __y, __z = unpack ( WARP_LOCS.ADMIN ) end setElementPosition ( p, __x, __y, __z ); --outputChatBox ( table.concat ( { __x, __y, __z }, ", " ) ); setElementData ( p,'SAEGPolice:JailTime', tonumber ( dur ) ) setElementData ( p, "isGodmodeEnabled", true ) exports['SAEGJobs']:updateJobColumn ( getAccountName ( getPlayerAccount ( p ) ), 'TimesArrested', "AddOne" ) if ( announce ) then local reason = reason or "Classified" local msg = "" if ( element and reason ) then msg = getPlayerName ( p ).." has been jailed by "..getPlayerName ( element ).." for "..tostring ( dur ).." seconds ("..reason..")" elseif ( element ) then msg = getPlayerName ( p ).." has been jailed by "..getPlayerName ( element ).." for "..tostring ( dur ).." seconds" end exports['SAEGMessages']:sendClientMessage ( msg, root, 0, 120, 255 ) exports['SAEGLogs']:outputPunishLog ( p, element or "Console", tostring ( msg ) ) end triggerEvent ( "onPlayerArrested", p, dur, element, reason ) triggerClientEvent ( p, "onPlayerArrested", p, dur, element, reason ) return true end return false end function unjailPlayer ( p, triggerClient ) local p = p or source setElementDimension ( p, 0 ) setElementInterior ( p, 0 ) setElementPosition ( p, 1543.32, -1675.6, 13.56 ) exports['SAEGMessages']:sendClientMessage ( "You've been released from jail! Behave next time.", p, 0, 255, 0 ) jailedPlayers[p] = nil setElementData ( p, "SAEGPolice:JailTime", nil ) setElementData ( p, "isGodmodeEnabled", nil ) exports['SAEGLogs']:outputActionLog ( getPlayerName ( p ).." has been unjailed" ) if ( triggerClient ) then triggerClientEvent ( p, 'SAEGJail:StopJailClientTimer', p ) end end addEvent ( "SAEGJail:UnjailPlayer", true ) addEventHandler ( "SAEGJail:UnjailPlayer", root, unjailPlayer ) function getJailedPlayers ( ) return jailedPlayers end addCommandHandler ( "jail", function ( p, _, p2, time, ... ) if ( exports['SAEGAdministration']:isPlayerStaff ( p ) ) then if ( p2 and time ) then local toJ = getPlayerFromName ( p2 ) or exports['NGPlayerFunctions']:getPlayerFromNamePart ( p2 ) if toJ then jailPlayer ( toJ, time, true, p, table.concat ( { ... }, " " ) ) else exports['SAEGMessages']:sendClientMessage ( "No player found with \""..p2.."\" in their name.", p, 255, 0, 0 ) end else exports['SAEGMessages']:sendClientMessage ( "Syntax: /jail [player name/part of name] [seconds] [reason]", p, 255, 255, 0 ) end end end ) addCommandHandler ( "unjail", function ( p, _, p2 ) if ( not exports['SAEGAdministration']:isPlayerStaff ( p ) ) then return false end if ( not p2 ) then return exports['SAEGMessages']:sendClientMessage ( "Syntax: /unjail [player]", p, 255, 255, 0 ) end if ( not getPlayerFromName ( p2 ) ) then p2 = exports['SAEGPlayerFunctions']:getPlayerFromNamePart ( p2 ) if not p2 then return exports['SAEGMessages']:sendClientMessage ( "That player doesn't exist on the server.", p, 255, 0, 0 ) end end if ( jailedPlayers[p2] ) then exports['SAEGMessages']:sendClientMessage ( "You've unjailed "..getPlayerName ( p2 ).."!", p, 0, 255, 0 ) exports['SAEGMessages']:sendClientMessage ( "You've been unjailed by "..getPlayerName ( p ).."!", p2, 0, 255, 0 ) unjailPlayer ( p2, true ) else exports['SAEGMessages']:sendClientMessage ( "That player isn't jailed.", p, 255, 0, 0 ) end end ) addEventHandler ( "onResourceStop", resourceRoot, function ( ) exports['NGSQL']:saveAllData ( false ) end ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) setTimer ( function ( ) local q = exports['NGSQL']:db_query ( "SELECT * FROM accountdata" ) local data = { } for i, v in ipairs ( q ) do data[v['Username']] = v['JailTime'] end for i, v in pairs ( data ) do local p = exports['SAEGPlayerFunctions']:getPlayerFromAcocunt ( i ) if p then local t = tonumber ( getElementData ( p, 'SAEGPolice:JailTime' ) ) or i jailPlayer ( p, tonumber ( t ), false ) end end end, 500, 1 ) end ) addEvent ( "onPlayerArrested", true )
  2. already it's fixed thanks you for trying for help
  3. Radar Showing Before login and defult radar showing with the new radar any help pls ? this the code Menu = {} Menu.__index = Menu Menu.instances = {} function onClientResourceStart() Pages = {} Pages.MAPA = {} Pages.MAPA.map = Map.new(x*30,y*30,x*1306,y*708) Pages.MAPA.map:setColor(255,255,255,200) Pages.MAPA.radar = Map.new(x*20,y*563,x*318,y*185) Pages.MAPA.radar:setColor(255,255,255,200) Pages.MAPA.radar.style = 1 Pages.MAPA.radar.blipSize = x*20 Pages.MAPA.radar:setVisible(true) MapaSwitch = function() Pages.MAPA.map:setVisible(not Pages.MAPA.map.visible) Pages.MAPA.radar:setVisible(not Pages.MAPA.map.visible) showChat(not Pages.MAPA.map.visible) end if(not isKeyBound('F11', 'down', MapaSwitch)) then bindKey('F11', 'down', MapaSwitch) end setPlayerHudComponentVisible("radar",false) toggleControl("radar",false) end addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart) function onClientResourceStop() setPlayerHudComponentVisible("radar",true) toggleControl("radar",true) end addEventHandler("onClientResourceStop",resourceRoot,onClientResourceStop) function isKeyBound(key, keyState, handler) local handlers = getFunctionsBoundToKey(key) for k,v in pairs(handlers or {}) do if(v == handler) then return true end end return false end
  4. function poop () setElementData(source, "ttt", (getElementData(source, "ttt") or 0) + 1) setElementData(source, "ttt", (getElementData(source, "ttt") or 0) + 0) end addEventHandler("onPlayerMute", getRootElement(),poop) addEventHandler("onPlayerUnMute", getRootElement(),poop) try that i'm not sure about it work or no
  5. Hello i tried to make the gate open for staffs too but it's not work what is the problem ?? this code : --- GATE SYSTEM BY DARHAL --- miniDistance = 3 --RESOURCE SETTINGS --HERE CHANGE THE RESOURCE NAME TO THE GROUPS SYSTEM THAT YOU USE local GROUPS_RESOURCE_NAME = "SAEGGroups" -- CHANGE THAT LINE TO YOUR GROUP SYSTEM NAME function GPG(plr) if plr and getACC(plr) then return exports.SAEGGroups:getPlayerGroup ( plr) or exports.SAEGAdministration:isPlayerStaff ( plr) end end -- GATE MANAGERS LIST (ACCOUNT NAME) managers = { --[[YOU CAN ADD ANY ACCOUNT BY SIMPLY ADDING THIS LINE : "account name", To the list above--]] "oussama", "", } -- ALLOWED OBJECTS THAT MANAGERS CAN USE TO PLACE GATE allowedModels = { 980 , 967 , 16773 , 10829 , 10832, 2990 , 2933 , 971 , 9042 , 8957, 3089, 2955 , 2947 , 2924 , 2911 , 1491 , 1504 , 1505 , 1507 , 1523 , 1557 , 8378 , 10671 , 11313 , 10641 , 7910 , 10149, 16775, 2634, }
  6. i tried to make staff panel it's work fine but when i freez player i can't unfreez also jetpack too code : addEvent ("OnCheckButtonFreeze", true) addEventHandler ("OnCheckButtonFreeze", root, function ( thePlayer ) if ( isElementFrozen ( thePlayer ) ) then guiSetText(ButtonFreeze, "Freeze") guiSetText(ButtonFreezePlayer, "Unfreeze") else guiSetText(ButtonFreeze, "Unfreeze") guiSetText(ButtonFreezePlayer, "Freeze") end end) addEvent ("OnCheckButtonJetPack", true) addEventHandler ("OnCheckButtonJetPack", root, function ( thePlayer ) if ( doesPedHaveJetPack ( thePlayer ) ) then guiSetText(ButtonGiveJetPack, "GiveJetpack") guiSetText(GiveJetPackPlayer, "RemoveJetPack") else guiSetText(ButtonGiveJetPack, "RemoveJetPack") guiSetText(GiveJetPackPlayer, "GiveJetPack") end end)
  7. how i can change the speed ?? this code handlingChange22 = function(l_5_0, l_5_1) if getElementModel(l_5_0) == 411 and l_5_1 == 0 then setVehicleHandling(l_5_0, "maxVelocity", 10000) setVehicleHandling(l_5_0, "engineAcceleration", 500) setVehicleHandling(l_5_0, "tractionBias", 0.80) setVehicleHandling(l_5_0, "suspensionLowerLimit", -0.100) setVehicleHandling(l_5_0, "driveType", "awd") setVehicleHandling(l_5_0, "modelFlags", 9999122304) setVehicleHandling(l_5_0, "handlingFlags", 99992948352) end end example i wanna make the speed 500 any one can show me for learn ?
  8. Hey Guys i have 15 day i'm serching for that radar please who can give me it pls
  9. remove it fast pls it's not allowed
  10. Dude BVZ Login Panel ? ahaha
  11. dude bro dude i start learning LUA (MTA) 15 day ago and much people helped me like JR10/Karim/Rob .............. but they don't love people ask help for leaked script or about de-compiler not yours script ___________________________________________ Thanks to all people who helped me
  12. i fix it but now i can't deposit / withdraw money from the bank Code : local _settings = get(""); local settings = {}; for k, v in pairs(_settings) do k = split(k, ".")[2]; settings[k] = v; end if (settings.key:len() < 1 or settings.key:len() > 1) then settings.key = "N"; end if (not settings.blip or tonumber(settings.blip) == nil) then settings.blip = false; end addEventHandler("onResourceStart", resourceRoot, function() if (settings.database == "mysql") then local host, db, username, password, port, socket = unpack(settings.database_data); if not (host and db and username and password) then outputDebugString("Business: Failed to connect to the MySQL server - The data is invalid"); return; end if (tonumber(port)) then port = "port="..port..";"; else port = ""; end if (socket and socket ~= "") then socket = "socket="..socket..";"; else socket = ""; end database = Connection("mysql", "host="..host..";dbname="..db..";"..port..socket, username, password); if (not database) then outputDebugString("Business: Failed to connect to the MySQL server"); return; end else database = Connection("sqlite", "files/business.db"); if (not database) then outputDebugString("Business: Failed to connect to the SQLite file"); return; end end database:exec("CREATE TABLE IF NOT EXISTS business(id INT, name TEXT, owner TEXT, cost INT, pos TEXT, payout INT, payout_time INT, payout_otime INT, payout_unit TEXT, payout_cur_time INT, bank INT)"); database:query(dbCreateBusinessesCallback, "SELECT * FROM business"); end); function dbCreateBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do local pos = split(row["pos"], ","); local b_marker = Marker(pos[1], pos[2], pos[3], "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = pos[4]; b_marker.dimension = pos[5]; if (settings.blip ~= false) then if (row["owner"] == "For Sale") then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; else local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; end end addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); local timer = Timer(businessPayout, row["payout_cur_time"] , 1, b_marker); b_marker:setData("b_data", {row["id"], row["name"], row["owner"], row["cost"], row["payout"], row["payout_time"], row["payout_otime"], row["payout_unit"], row["bank"], timer}); end end end addCommandHandler("business", function(player) if (ACL.hasObjectPermissionTo(player, "function.banPlayer")) then triggerClientEvent(player, "business.showCreateBusinessWindow", player); else player:outputMessage("Business: You don't have access to this command.", 255, 0, 0); end end); function Player:outputMessage(message, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, self, r, g, b); else self:outputChat(message, r, g, b, true); end end function outputMessage(message, player, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, player, r, g, b); else player:outputChat(message, r, g, b, true); end end function dxOutputMessage(message, player, r, g, b) triggerClientEvent(player, "business.dxOutputMessage", player, message, r, g, b); end addEvent("business.outputMessage", true); addEventHandler("business.outputMessage", root, function(message, r, g, b) source:outputMessage(message, r, g, b); end); addEvent("business.createBusiness", true); addEventHandler("business.createBusiness", root, function(x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) database:query(dbCreateBusinessCallback, {client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit}, "SELECT * FROM business"); end); function dbCreateBusinessCallback(query_handle, client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) local sql = query_handle:poll(0); if (sql) then local id; if (#sql > 0) then id = sql[#sql]["id"] + 1; else id = 1; end local unit; if (payout_unit == "Seconds") then unit = 1000; elseif (payout_unit == "Minutes") then unit = 60000; elseif (payout_unit == "Hours") then unit = 3600000; elseif (payout_unit == "Days") then unit = 86400000; end x = tonumber(x); y = tonumber(y); z = tonumber(z); interior = tonumber(interior); dimension = tonumber(dimension); cost = tonumber(cost); payout = tonumber(payout); payout_time = tonumber(payout_time); z = z - 1; database:exec("INSERT INTO business(id,name,owner,cost,pos,payout,payout_time,payout_otime,payout_unit,payout_cur_time,bank) VALUES(?,?,?,?,?,?,?,?,?,?,?)", id, name, "For Sale", cost, x..","..y..","..z..","..interior..","..dimension, payout, payout_time * unit, payout_time, payout_unit, payout_time * unit, 0); local b_marker = Marker(x, y, z, "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = interior; b_marker.dimension = dimension; if (settings.blip ~= false) then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = interior; b_blip.dimension = dimension; end local timer = Timer(businessPayout, payout_time * unit , 1, b_marker); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time * unit, payout_time, payout_unit, 0, timer}); addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); if (#tostring(id) == 1) then id = "0".. tostring(id) end client:outputMessage("Business: Business(ID #"..id..") has been created successfully", 0, 255, 0); end end function onBusinessMarkerHit(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.showInstructions", hElement); end function onBusinessMarkerLeave(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.hideInstructions", hElement); end function businessPayout(b_marker) local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then bank = bank + payout; database:exec("UPDATE business SET bank = ? WHERE id = ?", bank, id); if (settings.inform_player_of_payout) then local account = Account(owner); if (account) then local player = account:getPlayer(); if (player and player.isElement) then player:outputMessage("Business: Business \" "..name.." \" has paid out($"..payout..")", 0, 255, 0); end end end end timer = Timer(businessPayout, payout_time, 1, b_marker); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end addEventHandler("onResourceStop", resourceRoot, function() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then local left = timer:getDetails(); if (left >= 50) then database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", left, id); else database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", payout_time, id); end end end end); function Ped:isInMarker(marker) local colshape = marker.colShape; return self:isWithinColShape(colshape); end addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(Element.getAllByType("player")) do bindKey(player, settings.key, "up", onPlayerAttemptToOpenBusiness); end end); addEventHandler("onPlayerJoin", root,function() bindKey(source, settings.key, "up", onPlayerAttemptToOpenBusiness); end); function onPlayerAttemptToOpenBusiness(player) for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (player:isInMarker(b_marker)) then local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); triggerClientEvent(player, "business.showBusinessWindow", player, b_marker, getAccountName(getPlayerAccount(player)) == Owner, ACL.hasObjectPermissionTo(player, "function.showbus")); break; end end end function Ped:getMarker() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (self:isInMarker(b_marker)) then return b_marker; end end end addEvent("business.buy", true); addEventHandler("business.buy", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then client:outputMessage("Business: This business is owned", 255, 0, 0); return; end database:query(dbBuyBusinessCallback, {client, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}, "SELECT * FROM business WHERE owner = ?", account.name); end); addEvent("business.sell", true); addEventHandler("business.sell", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data");
  13. why the sample players can't open the gui windows when press N the windows not showing
  14. omg kariim the wanted system here : SAEGJobs>Law > general > Wanted_s.lua how we can export it ?
  15. ERROR SAEGTurf/server.lua:128: call: failed to call ' SAEGPolice:Givewantedpoints' [string"?"]
  16. error : SAEGVehicles/vehicles/vehicles_s.lua 355 : bad argument to 'gsub' (string expected, got nill) error :SAEGPhone/apps/vehicles_server.lua:19:call: failed to call 'SAEGVehicles:sellvehicle |string '?| code : addEvent ( "SAEGPhone:App->Vehicles:onPanelOpened", true ) addEventHandler ( "SAEGPhone:App->Vehicles:onPanelOpened", root, function ( ) local cars = exports.SAEGVehicles:getAccountVehicles ( getAccountName ( getPlayerAccount ( source ) ) ) triggerClientEvent ( source, "SAEGPhone:App->Vehicles:onClientGetVehicles", source, cars ) end ) addEvent ( "SAEGPhone:Apps->Vehicles:SetVehicleVisible", true ) addEventHandler ( "SAEGPhone:Apps->Vehicles:SetVehicleVisible", root, function ( id, stat ) local v = exports.SAEGVehicles:SetVehicleVisible ( id, stat, source ) end ) addEvent ( "SAEGPhone:Apps->Vehicles:AttemptRecoveryOnID", true ) addEventHandler ( "SAEGPhone:Apps->Vehicles:AttemptRecoveryOnID", root, function ( id ) exports.SAEGVehicles:recoverVehicle ( source, id ) end ) addEvent ( "SAEGPhone:App->Vehicles:sellPlayerVehicle", true ) addEventHandler ( "SAEGPhone:App->Vehicles:sellPlayerVehicle", root, function ( plr, data ) exports.SAEGVehicles:sellVehicle ( plr, data ) end ) addEvent ( "SAEGPhone:Apps->Vehicles:WarpThisVehicleToMe", true ) addEventHandler ( "SAEGPhone:Apps->Vehicles:WarpThisVehicleToMe", root, function ( id ) if ( not exports.SAEGVehicles:warpVehicleToPlayer ( id, source ) ) then exports.SAEGMessages:sendClientMessage ( "Error: Unable to warp vehicle", source, 255, 0, 0 ) end end )
  17. 1 problem in the turf system we can't add more turfs
  18. Hey Guys i have this bans system how i can make it work with the admin panel (P Panel) ?? this script Server-Side: local bans = { } -- All bans are saved here, until server save, or this resource stops --[[ bans table format: bans[serial] = { serial = user serial, ip = user ip, account = user account, unban_day = unban day, unban_month = unban month, unban_year = unban year, reason = reason, banner = the person who banned, banned_on = when the user was banned } ]] addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports.NGSQL:db_exec ( "CREATE TABLE IF NOT EXISTS ban_system ( serial TEXT, ip TEXT, account TEXT, unban_day INT, unban_month INT, unban_year INT, banner TEXT, reason TEXT, banned_on DATE )" ); -- Load the bans local q = exports.NGSQL:db_query ( "SELECT * FROM ban_system" ); if ( q and type ( q ) == "table" ) then for i, v in pairs ( q ) do local data = { } for ind, var in pairs ( v ) do data[ind] = var if ( ind == "unban_day" or ind == "unban_month" or ind == "unban_year" ) then data[ind] = tonumber ( var ) end end bans[v.serial] = data isSerialBanned ( v.serial ) end end setTimer ( function ( ) local playerSerials = { } for i, v in pairs ( getElementsByType ( "player" ) ) do playerSerials[getPlayerSerial(v)] = v end for i, v in pairs ( bans ) do if ( playerSerials [ v.serial ] ) then loadBanScreenForPlayer ( playerSerials [ v.serial ] ) end end playerSerials = nil end, 500, 1 ) end ) function banAccount ( acc, ban_day, unban_month, ban_year, reason, banner ) local reason = reason or "Not defined" local banner = banner or "Server" local d = exports.NGSQL:db_query ( "SELECT * FROM accountdata WHERE Username=?", acc ); if ( d and type ( d ) == "table" and table.len ( d ) == 1 ) then local d = d [ 1 ] local ser = d['LastSerial'] local ip = d['LastIP'] local ban_day = tonumber ( ban_day ) or 1 local unban_month = tonumber ( unban_month ) or 1 local ban_year = tonumber ( ban_year ) or 2015 bans[ser] = { serial = ser, ip = ip, account = acc, unban_day = ban_day, unban_month = unban_month, unban_year = ban_year, reason = reason, banner = banner, banned_on = exports.SAEGPlayerFunctions:getToday() } for i, v in pairs ( getElementsByType ( "player" ) ) do local a = getPlayerAccount ( v ) if ( not isGuestAccount ( a ) and getAccountName ( a ) == acc ) then kickPlayer ( v, "Reconnect to see why" ) break end end end end function isSerialBanned ( serial ) if ( bans [ serial ] ) then local isBanContinuted = false local today = today ( ) local d = bans [ serial ] if ( tostring(d.unban_year):upper() == "NIL" or tostring(d.unban_month):upper() == "NIL" or tostring(d.unban_day):upper() == "NIL" ) then return true end local unbanMeth = "" if ( d.unban_year > today.year ) then isBanContinuted = true unbanMeth = 1 elseif ( d.unban_year == today.year and d.unban_month > today.month ) then isBanContinuted = true unbanMeth = 2 elseif ( d.unban_year == today.year and d.unban_month == today.month and d.unban_day > today.day ) then isBanContinuted = true unbanMeth = 3 end if ( not isBanContinuted ) then bans [ serial ] = nil return false end -- try to detect the player for i, v in pairs ( getElementsByType ( "player" ) ) do if ( getPlayerSerial ( v ) == serial ) then loadBanScreenForPlayer ( v ) break end end return true end end function loadBanScreenForPlayer ( player ) toggleAllControls ( player, false ) showChat ( player, false ) setPlayerHudComponentVisible ( player, 'all', false ) setElementData ( player, "Job", "Banned" ) setElementData ( player, "Job Rank", "Banned" ) local d = bans [ getPlayerSerial ( player ) ] local banInfo = { account = d.account, ip = d.ip, serial = d.serial, reason = d.reason, banner = d.banner, unban_day = d.unban_day, unban_month = d.unban_month, unban_year = d.unban_year, banned_on = d.banned_on } for i, v in pairs ( banInfo ) do banInfo [ i ] = tostring ( v ) end triggerClientEvent ( player, "SAEGBans:OpenClientBanScreen", player, banInfo ) end addEventHandler ( "onPlayerLogin", root, function ( ) local s = getPlayerSerial ( source ) if ( bans [ s ] ) then kickPlayer ( source, "Stop avoiding the ban system." ) end end ) function unbanAccount ( acc ) local rV = false for i, v in pairs ( bans ) do if ( v.account == acc ) then bans[i] = nil rV = true break end end return rV end function saveBans ( ) exports.NGSQL:db_exec ( "DELETE FROM ban_system" ); local c = 0 for i, v in pairs ( bans ) do exports.NGSQL:db_exec ( "INSERT INTO ban_system ( serial, ip, account, unban_day, unban_month, unban_year, banner, reason, banned_on ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )", v.serial, v.ip, v.account, v.unban_day, v.unban_month, v.unban_year, v.banner, v.reason, v.banned_on ) c = c + 1 end return c end addEventHandler ( "onResourceStop", resourceRoot, saveBans ) -- misc functions function today ( ) local d = getRealTime ( ) local day = d.monthday local month = d.month + 1 local year = d.year + 1900 return { year=year, day=day, month=month } end function table.len ( t ) local c = 0; for i, v in pairs ( t ) do c = c + 1 end return c end Client-Side : local ban = nil local sx, sy = guiGetScreenSize ( ) local rsx, rsy = sx, sy local sx, sy = sx/1280, sy/960 local open = false local banY = -(rsy/1.2) local font_size =(sx+sy) function drawBanScreen ( ) if not startTime then startTime = getTickCount ( ) end if not endTime then endTime = getTickCount ( ) + 3500 end local now = getTickCount() local elapsedTime = now - startTime local duration = endTime - startTime local progress = elapsedTime / duration local _, y, _ = interpolateBetween ( 0, -(rsy/1.2), 0, 0, 0, 0, progress, "OutBack" ) banY = y dxDrawBoarderedText("You are banned from SAEG:RPG!", 0, banY, sx*1280, banY+sy*98, tocolor(255, 0, 0, 255), 3, "default", "center", "center", false, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*189, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Serial", sx*103, banY+sy*189, sx*239, banY+sy*229, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*189, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.serial, sx*259, banY+sy*189, sx*812, banY+sy*229, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*249, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("IP", sx*103, banY+sy*249, sx*239, banY+sy*289, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*249, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.ip, sx*259, banY+sy*249, sx*812, banY+sy*289, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*309, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Account", sx*103, banY+sy*309, sx*239, banY+sy*349, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*309, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.account, sx*259, banY+sy*309, sx*812, banY+sy*349, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*369, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Until", sx*103, banY+sy*369, sx*239, banY+sy*409, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*369, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.unban, sx*259, banY+sy*369, sx*812, banY+sy*409, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*429, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Banned On", sx*103, banY+sy*429, sx*239, banY+sy*469, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*429, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.banned_on, sx*259, banY+sy*429, sx*812, banY+sy*469, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*489, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Banned By", sx*103, banY+sy*489, sx*239, banY+sy*529, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*489, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.banner, sx*259, banY+sy*489, sx*812, banY+sy*529, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*87, banY+sy*549, sx*152, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText("Reason", sx*103, banY+sy*549, sx*239, banY+sy*589, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawRectangle(sx*249, banY+sy*549, sx*563, sy*40, tocolor(0, 0, 0, 138), true) dxDrawText(ban.reason, sx*259, banY+sy*549, sx*812, banY+sy*589, tocolor(255, 255, 255, 255), font_size, "default", "left", "center", true, false, true, false, false) dxDrawBoarderedText("Appeal @ saegmta.boards.net", sx*87, banY+sy*609, sx*812, banY+sy*649, tocolor(255, 255, 255, 255), 2, "default", "center", "center", true, false, true, false, false, 0, 0, 0, 2) end addEvent ( "SAEGBans:OpenClientBanScreen", true ) addEventHandler ( "SAEGBans:OpenClientBanScreen", root, function ( d ) ban = d if ( tonumber ( ban.unban_month ) and tonumber ( ban.unban_month ) < 10 ) then ban.unban_month = "0"..ban.unban_month end if ( tonumber ( ban.unban_day ) and tonumber ( ban.unban_day ) < 10 ) then ban.unban_day = "0"..ban.unban_day end ban.unban = table.concat ({ tostring(ban.unban_year), tostring(ban.unban_month), tostring(ban.unban_day) }, "-" ) if ( tostring ( ban.unban ):upper() == "NIL" ) then ban.unban = "Forever" end if open then return end open = true addEventHandler ( "onClientPreRender", root, drawBanScreen ) end ) function dxDrawBoarderedText ( text, x, y, endX, endY, color, size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) local text = tostring ( text ) local x = tonumber(x) or 0 local y = tonumber(y) or 0 local endX = tonumber(endX) or x local endY = tonumber(endY) or y local color = color or tocolor ( 255, 255, 255, 255 ) local size = tonumber(size) or 1 local font = font or "default" local alignX = alignX or "left" local alignY = alignY or "top" local clip = clip or false local wordBreak = wordBreak or false local postGUI = postGUI or false local colorCode = colorCode or false local subPixelPos = subPixelPos or false local fRot = tonumber(fRot) or 0 local fRotCX = tonumber(fRotCX) or 0 local fRotCY = tonumber(fRotCy) or 0 local offSet = tonumber(offSet) or 1 local t_g = text:gsub ( "#%x%x%x%x%x%x", "" ) dxDrawText ( t_g, x-offSet, y-offSet, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) dxDrawText ( t_g, x-offSet, y, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) dxDrawText ( t_g, x, y-offSet, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) dxDrawText ( t_g, x+offSet, y+offSet, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) dxDrawText ( t_g, x+offSet, y, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) dxDrawText ( t_g, x, y+offSet, endX, endY, tocolor(0,0,0,255), size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) return dxDrawText ( text, x, y, endX, endY, color, size, font, alignX, alignY, clip, wordBreak, postGUI, colorCode, subPixelPos, fRot, fRotCX, fRotCY, offSet ) end
  19. lol it's was : addEvent("show_job_window",true) addEventHandler("show_job_window",rootElement, function (jobName, jobDescription, mkr) guiSetVisible(job_window,true) showCursor(true) guiSetText(job_window,tostring(jobName)) guiSetText(job_desc,tostring(jobDescription)) marker = mkr end) addEventHandler("onClientGUIClick",rootElement, function () if (source == job_reject) then guiSetVisible(job_window,false) showCursor(false) guiSetText(job_window,"") guiSetText(job_desc,"") elseif (source == job_accept) then triggerServerEvent("job_accept",client,client,marker) guiSetVisible(job_window,false) showCursor(false) guiSetText(job_window,"") guiSetText(job_desc,"") end end) i change it to : openedJob = nil addEvent ( 'onClientClick', true ) addEventHandler ( 'onClientClick', root, function ( job ) openedJob = job guiSetVisible ( JobWindow, true ) showCursor ( true ) local desc = jobDescriptions [ job ] guiSetText ( JobDescription, tostring ( desc ) ) addEventHandler ( "onClientGUIClick", root, clickingevents_jobmenu ) end ) function clickingevents_jobmenu ( ) if ( source == JobDeny ) then desc = nil openedJob = nil guiSetVisible ( JobWindow, false ) showCursor ( false ) removeEventHandler ( "onClientGUIClick", root, clickingevents_jobmenu ) elseif ( source == JobAccept ) then triggerServerEvent ( "SAEGJobs:SetPlayerJob", localPlayer, openedJob ) desc = nil openedJob = nil guiSetVisible ( JobWindow, false ) showCursor ( false ) removeEventHandler ( "onClientGUIClick", root, clickingevents_jobmenu ) end end
  20. local _setElementData = setElementData function setElementData ( element, group, value ) return _setElementData ( element, group, value, true ) end local turfLocs = { } function createTurf ( x, y, z, width, height, owner, forcedId ) local owner = tostring ( owner or "server" ) local r, g, b = exports.SAEGGroups:getGroupColor ( owner ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end if ( owner == "server" ) then r, g, b = 255, 255, 255 end local rad = createRadarArea ( x, y, width, height, r, g, b, 170, getRootElement ( ) ) local col = createColCuboid ( x, y, z-5, width, height, 35) if ( not forcedId or turfLocs [ id ] ) then id = 0 while ( turfLocs [ id ] ) do id = id + 1 end else id = forcedId end turfLocs[id] = { } turfLocs[id].col = col turfLocs[id].radar = rad turfLocs[id].owner = owner or "server" turfLocs[id].attackers = nil turfLocs[id].attackProg = 0 turfLocs[id].prepProg = 0 setElementData ( turfLocs[id].col, "SAEGTurf:TurfId", id ) setElementData ( turfLocs[id].col, "SAEGTurf:TurffingTable", turfLocs [ id ] ) addEventHandler ( "onColShapeHit", turfLocs[id].col, onColShapeHit ) addEventHandler ( "onColShapeLeave", turfLocs[id].col, onColShapeLeave ) return turfLocs[id]; end function updateTurfGroupColor ( group ) local r, g, b = exports.saeggroups:getGroupColor ( group ) for i, v in pairs ( turfLocs ) do if ( v.owner == group ) then setRadarAreaColor ( v.radar, r, g, b, 120 ) end end end function onColShapeHit ( player ) if ( player and isElement ( player ) and getElementType ( player ) == "player" and not isPedInVehicle ( player ) ) then local gang = exports.saeggroups:getPlayerGroup ( player ) if getTeamName(getPlayerTeam(player)) ~= "Criminals" then exports['SAEGMessages']:sendClientMessage("You must be criminal.",255,0,0) return end triggerClientEvent ( player, "SAEGTurfs:onClientEnterTurfArea", player, turfLocs [ id ] ) if ( not gang ) then return exports.SAEGMessages:sendClientMessage ( "You're not in a gang, you cannot turf.", player, 255, 255, 0 ) end local id = tonumber ( getElementData ( source, "SAEGTurf:TurfId" ) ) if ( turfLocs[id].owner == gang ) then return end if ( turfLocs[id].attackers and turfLocs[id].attackers ~= gang ) then end if ( not turfLocs[id].attackers ) then local x, y, z = getElementPosition ( source ) setRadarAreaFlashing ( turfLocs[id].radar, true ) turfLocs[id].attackers = gang turfLocs[id].attackProg = 0 turfLocs[id].prepProg = 0 setElementData ( turfLocs[id].col, "SAEGTurf:TurffingTable", turfLocs [ id ] ) end end end function onColShapeLeave ( player ) if ( player and getElementType ( player ) == "player" ) then triggerClientEvent ( player, "SAEGTurfs:onClientExitTurfArea", player, turfLocs [ getElementData ( source, "SAEGTurf:TurfId" ) ] ) end end setTimer ( function ( ) for id, data in pairs ( turfLocs ) do if ( data.attackers ) then local players = { attackers = { }, owners = { } } local isGangInTurf = false local isOwnerInTurf = false for i, v in pairs ( getElementsWithinColShape ( data.col, "player" ) ) do local g = exports.SAEGGroups:getPlayerGroup ( v ) if ( g == data.attackers ) then isGangInTurf = true table.insert ( players.attackers, v ) elseif ( g == data.owner ) then isOwnerInTurf = true table.insert ( players.owners, v ) end end local x, y, z = getElementPosition ( data.col ) if ( isOwnerInTurf and isGangInTurf ) then else -- Add Points To Attackers if ( isGangInTurf ) then -- Prep the war if ( turfLocs[id].attackProg == 0 ) then turfLocs[id].prepProg = data.prepProg + 2 if ( turfLocs[id].prepProg >= 100 ) then turfLocs[id].prepProg = 0 turfLocs[id].attackProg = 1 beginTurfWarOnTurf ( id ) end -- Attack War else turfLocs[id].attackProg = turfLocs[id].attackProg + 1 if ( turfLocs[id].attackProg == 100 ) then setTurfOwner ( id, turfLocs[id].attackers ) return exports.SAEGPolice:giveWantedPoints(source,120) end end end -- Take points from attackers else -- Prepare war if ( turfLocs[id].attackProg == 0 ) then turfLocs[id].prepProg = data.prepProg - 2 if ( turfLocs[id].prepProg <= 0 ) then setTurfOwner ( id, turfLocs[id].owner ) end -- Attacking war else turfLocs[id].attackProg = data.attackProg - 1 if ( turfLocs[id].attackProg <= 0 ) then setTurfOwner ( id, turfLocs[id].owner ) end end end end for i, v in pairs ( players ) do for k, p in pairs ( v ) do triggerClientEvent ( p, "SAEGTurfs:upadateClientInfo", p, turfLocs [ id ] ) end end end end end, 800, 0 ) addEvent ( "SAEGTurfs:onTurfProgressChange", true ) --[[ addCommandHandler ( "attackprog", function ( p ) local gangAttacks = { } local g = exports.SAEGGroups:getPlayerGroup ( p ) if ( not g ) then return exports.SAEGMessages:sendclientMessage ( "You're not in a gang", p, 255, 255, 0) end for i, v in pairs ( turfLocs ) do if ( v.attackers and v.attackers == g ) then gangAttacks [ i ] = true end end if ( table.len ( gangAttacks ) == 0 ) then return exports.SAEGMessages:sendClientMessage ( "Your gang isn't involved in any gang wars right now.", p, 255, 255, 0 ) end for id, _ in pairs ( gangAttacks ) do local x ,y, z = getElementPosition ( turfLocs[id].col ) outputChatBox ( "----Turf War Status---", p, 255, 255, 255, false ) outputChatBox ( "Current owner: "..turfLocs[id].owner, p, 255, 255, 255, false ) outputChatBox ( "Attacker: "..turfLocs[id].attackers, p, 255, 255, 255, false ) outputChatBox ( "Prep Progress: "..turfLocs[id].prepProg.."%", p, 255, 255, 255, false ) outputChatBox ( "Attack Progress: "..turfLocs[id].attackProg.."%", p, 255, 255, 255, false ) outputChatBox ( "Turf Location: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ), p, 255, 255, 255, false ) outputChatBox ( "Turf Server-ID: "..id, p, 255, 255, 255, false ) end end )]] function table.len ( tb ) local c = 0 for i, v in pairs ( tb ) do c = c + 1 end return c end function beginTurfWarOnTurf ( id ) local d = turfLocs [ id ] local x, y, z = getElementPosition ( d.col ) setRadarAreaColor ( d.radar, 255, 255, 255, 170 ) end function setTurfOwner ( id, owner ) setRadarAreaFlashing ( turfLocs[id].radar, false ) turfLocs[id].owner = owner turfLocs[id].attackers = nil turfLocs[id].attackProg = 0 local r, g, b = exports.SAEGGroups:getGroupColor ( owner ) setRadarAreaColor ( turfLocs[id].radar, r, g, b, 120 ) saveTurfs ( ) end function getTurfs ( ) return turfLocs end function saveTurfs ( ) for id, data in pairs ( turfLocs ) do exports.NGSQL:db_exec ( "UPDATE turfs SET owner=? WHERE id=?", data.owner, id ) end return true end addEventHandler( "onResourceStart", resourceRoot, function ( ) exports.NGSQL:db_exec ( "CREATE TABLE IF NOT EXISTS turfs ( id INT, owner VARCHAR(50), x FLOAT, y FLOAT, z FLOAT, width INT, height INT )" ) local query = exports.NGSQL:db_query ( "SELECT * FROM turfs" ) if ( #query == 0 ) then local data = { { -1867.8, -107.43, 15.1, 58, 65 }, { -1866.5, -26.36, 15.29, 49, 200 }, { -1811.33, 743.43, 20, 85, 85 }, { -1991.5, 862.62, 34, 79, 42 }, { -2799.25, -200.6, 7.19, 83, 120 }, { -2136.84, 120.12, 30, 120, 190 }, { -2516.52, 718.16, 27.97, 118, 80 }, { -2516.41, 578.19, 16.62, 100, 100 }, { -2596.49, 818.05, 49.98, 59, 80 }, { -2453.17, 947.58, 45.43, 54, 80 }, { -2740.6, 344.59, 4.41, 68, 61 }, { -2696.24, 227.35, 4.33, 39.5, 50.5 }, { -2397.31, 82.99, 35.3, 133, 160 }, { -2095.33, -280.06, 35.32, 84, 176 }, { -1980.58, 107.69, 27.68, 59, 62 }, { -2129.01, 741.71, 48, 112, 57 }, { -2243.24, 928.4, 66.65, 87, 154 }, { -1701.62, 743.44, 10, 129, 83 }, { -2696.23, -59.88, 4.73, 83, 89 }, { -2541.18, -720.16, 135, 55, 125 }, }
×
×
  • Create New...