diff --git a/[admin]/admin/client/admin_client.lua b/[admin]/admin/client/admin_client.lua index f5fe95020..972e2b6bd 100644 --- a/[admin]/admin/client/admin_client.lua +++ b/[admin]/admin/client/admin_client.lua @@ -26,6 +26,7 @@ function aClientAdminMenu () aAdminMenuClose ( false ) else aAdminMenu () + guiFocus (aAdminForm) end end diff --git a/[admin]/admin/client/colorpicker/colorpicker.lua b/[admin]/admin/client/colorpicker/colorpicker.lua index 713cc0ff8..e27aa3a08 100644 --- a/[admin]/admin/client/colorpicker/colorpicker.lua +++ b/[admin]/admin/client/colorpicker/colorpicker.lua @@ -82,7 +82,6 @@ function colorPicker.create(id, start, title) end function colorPicker:render() - -- if not self.gui.focus then return end local x,y = guiGetPosition(self.gui.window, false) dxDrawRectangle(x+16, y+32, 256, 256, self.color.huecurrent, self.gui.focus) dxDrawImage(x+16, y+32, 256, 256, "client/colorpicker/sv.png", 0, 0, 0, self.color.white, self.gui.focus) diff --git a/[admin]/admin/client/gui/admin_main.lua b/[admin]/admin/client/gui/admin_main.lua index bcbf74c88..cac725ae4 100644 --- a/[admin]/admin/client/gui/admin_main.lua +++ b/[admin]/admin/client/gui/admin_main.lua @@ -194,6 +194,7 @@ y=y+B aTab1.VehicleHealth = guiCreateLabel ( 0.26, y, 0.25, 0.04, "Vehicle Heal aTab2.ResourceInclMaps = guiCreateCheckBox ( 0.03, 0.91, 0.15, 0.04, "Include Maps", false, true, aTab2.Tab ) aTab2.ResourceRefresh = guiCreateButton ( 0.20, 0.915, 0.18, 0.04, "Refresh list", true, aTab2.Tab, "listresources" ) aTab2.ResourceSettings = guiCreateButton ( 0.40, 0.05, 0.20, 0.04, "Settings", true, aTab2.Tab ) + guiSetVisible ( aTab2.ResourceSettings, false) aTab2.ResourceStart = guiCreateButton ( 0.40, 0.10, 0.20, 0.04, "Start", true, aTab2.Tab, "start" ) aTab2.ResourceRestart = guiCreateButton ( 0.40, 0.15, 0.20, 0.04, "Restart", true, aTab2.Tab, "restart" ) aTab2.ResourceStop = guiCreateButton ( 0.40, 0.20, 0.20, 0.04, "Stop", true, aTab2.Tab, "stop" ) @@ -1059,6 +1060,10 @@ function aClientClick ( button ) elseif ( source == aTab2.ResourceList ) then guiSetVisible ( aTab2.ResourceFailture, false ) if ( guiGridListGetSelectedItem ( aTab2.ResourceList ) ~= -1 ) then + local resName = guiGridListGetItemText(aTab2.ResourceList, guiGridListGetSelectedItem( aTab2.ResourceList ), 1) + if resName then + triggerServerEvent("aAdmin", localPlayer, "resourcelist", resName) + end guiSetText(aTab2.ResourceName, "Full Name: " .. guiGridListGetItemText(aTab2.ResourceList, guiGridListGetSelectedItem ( aTab2.ResourceList ), 4)) guiSetText(aTab2.ResourceAuthor, "Author: " .. guiGridListGetItemText(aTab2.ResourceList, guiGridListGetSelectedItem ( aTab2.ResourceList ), 5)) guiSetText(aTab2.ResourceVersion, "Version: " .. guiGridListGetItemText(aTab2.ResourceList, guiGridListGetSelectedItem ( aTab2.ResourceList ), 6)) @@ -1192,6 +1197,16 @@ function aClientClick ( button ) end end +addEvent ("setVisibilityOfSettingsButton", true) +function setVisibilityOfSettingsButton (hasResourceSetting) + if hasResourceSetting then + guiSetVisible(aTab2.ResourceSettings, true) + else + guiSetVisible(aTab2.ResourceSettings, false) + end +end +addEventHandler ( "setVisibilityOfSettingsButton", resourceRoot, setVisibilityOfSettingsButton) + function aClientRender () if ( guiGetVisible ( aAdminForm ) ) then if ( getTickCount() >= aLastCheck ) then diff --git a/[admin]/admin/client/gui/admin_maps.lua b/[admin]/admin/client/gui/admin_maps.lua index 43cfd6b64..2b037f4c8 100644 --- a/[admin]/admin/client/gui/admin_maps.lua +++ b/[admin]/admin/client/gui/admin_maps.lua @@ -78,15 +78,6 @@ function guiClick(button) else guiSetEnabled(aTabMap.NextMap, false) end - -- if gamemode == "deleted maps" then - -- guiSetEnabled(aTabMap.Start, false) - -- guiSetEnabled(aTabMap.Delete, false) - -- guiSetEnabled(aTabMap.Revert, true) - -- else - -- guiSetEnabled(aTabMap.Start, true) - -- guiSetEnabled(aTabMap.Delete, true) - -- guiSetEnabled(aTabMap.Revert, false) - -- end elseif source == aTabMap.Start then triggerServerEvent("startGamemodeMap_s", localPlayer, gamemode, mapResName) elseif source == aTabMap.NextMap then diff --git a/[admin]/admin/client/gui/admin_vehicle.lua b/[admin]/admin/client/gui/admin_vehicle.lua index a50296055..bc4ef3c7c 100644 --- a/[admin]/admin/client/gui/admin_vehicle.lua +++ b/[admin]/admin/client/gui/admin_vehicle.lua @@ -241,9 +241,6 @@ function aClientVehicleClick ( button ) triggerServerEvent ( "aVehicle", localPlayer, aVehicleCustomizePlayer, "setlights", { guiGetText ( aLightsColor ) } ) elseif ( source == aLicensePlateSet ) then triggerServerEvent ( "aVehicle", localPlayer, aVehicleCustomizePlayer, "setplates", { guiGetText ( aLicensePlate ) } ) - -- elseif ( source == aVehicleColorScheme ) then - -- guiSetVisible ( aVehicleColorForm, true ) - -- guiBringToFront ( aVehicleColorForm ) elseif ( source == aVehicleUpgradeAll ) then triggerServerEvent ( "aVehicle", localPlayer, aVehicleCustomizePlayer, "customize", { "all" } ) setTimer ( aVehicleCheckCurrentUpgrades, 2000, 1, aVehicleCustomizeVehicle ) diff --git a/[admin]/admin/server/admin_server.lua b/[admin]/admin/server/admin_server.lua index fb82b10c9..8521e6295 100644 --- a/[admin]/admin/server/admin_server.lua +++ b/[admin]/admin/server/admin_server.lua @@ -33,7 +33,7 @@ function notifyPlayerLoggedIn(player) end function aHandleIP2CUpdate() - local playersToUpdate = false + local playersToUpdate = nil local playersTable = getElementsByType("player") -- cache result, save function call for playerID = 1, #playersTable do @@ -135,7 +135,7 @@ addEventHandler ( "onResourceStart", root, function ( resource ) local stat = xmlFindChild ( node2, "stat", stats ) local id = tonumber ( xmlNodeGetAttribute ( stat, "id" ) ) local name = xmlNodeGetAttribute ( stat, "name" ) - aStats[id] = name + if (id) then aStats[id] = name end stats = stats + 1 end xmlUnloadFile ( node2 ) @@ -147,7 +147,7 @@ addEventHandler ( "onResourceStart", root, function ( resource ) local weather = xmlFindChild ( node3, "weather", weathers ) local id = tonumber ( xmlNodeGetAttribute ( weather, "id" ) ) local name = xmlNodeGetAttribute ( weather, "name" ) - aWeathers[id] = name + if (id) then aWeathers[id] = name end weathers = weathers + 1 end xmlUnloadFile ( node3 ) @@ -226,15 +226,11 @@ addEventHandler ( "onResourceStart", root, function ( resource ) aLogMessages[type] = {} local groups = 0 while ( xmlFindChild ( subnode, "group", groups ) ) do + aLogMessages[type][action] = {} local group = xmlFindChild ( subnode, "group", groups ) local action = xmlNodeGetAttribute ( group, "action" ) - local r = tonumber ( xmlNodeGetAttribute ( group, "r" ) ) - local g = tonumber ( xmlNodeGetAttribute ( group, "g" ) ) - local b = tonumber ( xmlNodeGetAttribute ( group, "b" ) ) - aLogMessages[type][action] = {} - aLogMessages[type][action]["r"] = r or 0 - aLogMessages[type][action]["g"] = g or 255 - aLogMessages[type][action]["b"] = b or 0 + local r, g, b = tonumber ( xmlNodeGetAttribute ( group, "r" ) ), tonumber ( xmlNodeGetAttribute ( group, "g" ) ), tonumber ( xmlNodeGetAttribute ( group, "b" ) ) + aLogMessages[type][action]["r"], aLogMessages[type][action]["g"], aLogMessages[type][action]["b"] = r or 0, g or 255, b or 255 if ( xmlFindChild ( group, "all", 0 ) ) then aLogMessages[type][action]["all"] = xmlNodeGetValue ( xmlFindChild ( group, "all", 0 ) ) end if ( xmlFindChild ( group, "admin", 0 ) ) then aLogMessages[type][action]["admin"] = xmlNodeGetValue ( xmlFindChild ( group, "admin", 0 ) ) end if ( xmlFindChild ( group, "player", 0 ) ) then aLogMessages[type][action]["player"] = xmlNodeGetValue ( xmlFindChild ( group, "player", 0 ) ) end @@ -386,17 +382,17 @@ function aAddUnmuteTimer( player, length ) aRemoveUnmuteTimer( player ) local serial = getPlayerSerial( player ) aUnmuteTimerList[serial] = setTimer( - function() - aUnmuteTimerList[serial] = nil - for _,plr in ipairs(getElementsByType('player')) do - if getPlayerSerial(plr) == serial then - if isPlayerMuted(plr) then - triggerEvent ( "aPlayer", getElementByIndex("console", 0), plr, "mute" ) - end - end - end - end, - length*1000, 1 ) + function() + aUnmuteTimerList[serial] = nil + for _,plr in ipairs(getElementsByType('player')) do + if getPlayerSerial(plr) == serial then + if isPlayerMuted(plr) then + triggerEvent ( "aPlayer", getElementByIndex("console", 0), plr, "mute" ) + end + end + end + end, + length*1000, 1 ) end function aRemoveUnmuteTimer( player ) @@ -455,7 +451,6 @@ end function aPlayerInitialize ( player ) bindKey ( player, "p", "down", "admin" ) - --callRemote ( "http://community.mtasa.com/mta/verify.php", aPlayerSerialCheck, player, getPlayerSerial ( player ) ) aPlayers[player] = {} aPlayers[player]["money"] = getPlayerMoney ( player ) updatePlayerCountry ( player ) @@ -722,6 +717,17 @@ addEventHandler ( "aAdmin", root, function ( action, ... ) end end triggerClientEvent ( source, "aAdminSettings", root, cmd, resName, tableOut ) + elseif (action == "resourcelist") then + local resName = arg[1] + local count = true + _, count = aGetResourceSettings(resName, count) + if count then + local hasResourceSetting + if count ~= 0 then + hasResourceSetting = true + end + triggerClientEvent ( source, "setVisibilityOfSettingsButton", resourceRoot, hasResourceSetting) + end elseif ( action == "sync" ) then local type = arg[1] local tableOut = {} @@ -1025,7 +1031,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional, if ( not setElementHealth ( player, health ) ) then action = nil end - mdata = health + mdata = tostring( health ) else action = nil end @@ -1036,14 +1042,14 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional, if ( not setPedArmor ( player, armour ) ) then action = nil end - mdata = armour + mdata = tostring( armour ) else action = nil end elseif ( action == "setskin" ) then data = tonumber ( data ) if ( setElementModel( player, data) ) then - mdata = data + mdata = tostring( data ) else action = nil outputChatBox( "Invalid skin ID", source, 255, 0, 0 ) @@ -1110,7 +1116,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional, if ( not setElementDimension ( player, dimension ) ) then action = nil end - mdata = dimension + mdata = tostring( dimension ) else action = nil end @@ -1183,7 +1189,7 @@ addEventHandler ( "aPlayer", root, function ( player, action, data, additional, end local x, y, z = getElementVelocity ( player ) setElementVelocity ( player, x , y, z + 0.2 ) - mdata = slap + mdata = tostring( slap ) else action = nil end @@ -1638,7 +1644,7 @@ addEventHandler('onElementDataChange', root, -- returns true if there is trouble function checkClient(checkAccess,player,...) - if client and client ~= player and g_Prefs.securitylevel >= 2 then + if client and client ~= player then local desc = table.concat({...}," ") local ipAddress = getPlayerIP(client) outputDebugString( "Admin security - Client/player mismatch from " .. tostring(ipAddress) .. " (" .. tostring(desc) .. ")", 1 ) diff --git a/[admin]/admin/server/admin_servermaps.lua b/[admin]/admin/server/admin_servermaps.lua index 9c4b1c085..c95ed4be1 100644 --- a/[admin]/admin/server/admin_servermaps.lua +++ b/[admin]/admin/server/admin_servermaps.lua @@ -26,7 +26,6 @@ function getServerMaps (loadList) end if loadList then - -- local deletedMaps = {} local gamemodes gamemodes = call(mapmanager, "getGamemodes") for id,gamemode in ipairs (gamemodes) do @@ -45,17 +44,9 @@ function getServerMaps (loadList) local countGmodes = #tableOut local maps = call(mapmanager, "getMapsCompatibleWithGamemode") for id,map in ipairs (maps) do - -- if fileOpen(":"..getResourceName(map).."/deleted") then - -- table.insert(deletedMaps ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) - -- else - table.insert(tableOut[countGmodes]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) - -- end + table.insert(tableOut[countGmodes]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) end - -- table.sort(deletedMaps, sortCompareFunction) table.sort(tableOut[countGmodes]["maps"], sortCompareFunction) - -- table.insert(tableOut, {name = "deleted maps", resname = "deleted maps", maps = {}}) - -- local countGmodes = countGmodes + 1 - -- tableOut[countGmodes]["maps"] = deletedMaps end local map = call(mapmanager, "getRunningGamemodeMap") local gamemode = call(mapmanager, "getRunningGamemode") diff --git a/[admin]/admin2/client/main/admin.lua b/[admin]/admin2/client/main/admin.lua index c8ce5c334..142aeffb0 100644 --- a/[admin]/admin2/client/main/admin.lua +++ b/[admin]/admin2/client/main/admin.lua @@ -34,6 +34,7 @@ addEventHandler( aAdminMain.Close(false) else aAdminMain.Open() + guiFocus (aAdminMain.Form) end end ) diff --git a/[admin]/ip2c/conf/.gitignore b/[admin]/ip2c/conf/.gitignore new file mode 100644 index 000000000..7c39db67e --- /dev/null +++ b/[admin]/ip2c/conf/.gitignore @@ -0,0 +1,2 @@ +# Ignore the IpToCountry file that is automatically updated +*.csv \ No newline at end of file diff --git a/[admin]/ip2c/conf/IpToCountryCompact.csv b/[admin]/ip2c/conf/IpToCountryCompact.csv.backup similarity index 100% rename from [admin]/ip2c/conf/IpToCountryCompact.csv rename to [admin]/ip2c/conf/IpToCountryCompact.csv.backup diff --git a/[admin]/ip2c/meta.xml b/[admin]/ip2c/meta.xml index 6e8a423fb..74d9f3158 100644 --- a/[admin]/ip2c/meta.xml +++ b/[admin]/ip2c/meta.xml @@ -7,6 +7,10 @@