Skip to content

Commit

Permalink
Merge branch 'master' into dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored May 23, 2024
2 parents 7d1ea2b + 9505b18 commit 4511910
Show file tree
Hide file tree
Showing 199 changed files with 246 additions and 312 deletions.
1 change: 1 addition & 0 deletions [admin]/admin/client/admin_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function aClientAdminMenu ()
aAdminMenuClose ( false )
else
aAdminMenu ()
guiFocus (aAdminForm)
end
end

Expand Down
1 change: 0 additions & 1 deletion [admin]/admin/client/colorpicker/colorpicker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions [admin]/admin/client/gui/admin_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions [admin]/admin/client/gui/admin_maps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions [admin]/admin/client/gui/admin_vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
62 changes: 34 additions & 28 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand All @@ -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 )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down
11 changes: 1 addition & 10 deletions [admin]/admin/server/admin_servermaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
1 change: 1 addition & 0 deletions [admin]/admin2/client/main/admin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ addEventHandler(
aAdminMain.Close(false)
else
aAdminMain.Open()
guiFocus (aAdminMain.Form)
end
end
)
Expand Down
2 changes: 2 additions & 0 deletions [admin]/ip2c/conf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore the IpToCountry file that is automatically updated
*.csv
File renamed without changes.
4 changes: 4 additions & 0 deletions [admin]/ip2c/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

<script src="shared.lua" type="shared"/>
<export function="getCountryName" type="shared"/>

<aclrequest>
<right name="function.fetchRemote" access="true"></right>
</aclrequest>

<file src="client/images/flags/ad.png" />
<file src="client/images/flags/ae.png" />
Expand Down
14 changes: 13 additions & 1 deletion [admin]/ip2c/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

local aCountries = {}
local IP2C_FILENAME = "conf/IpToCountryCompact.csv"
local IP2C_FILENAME_BACKUP = "conf/IpToCountryCompact.csv.backup" -- If no file exists, it will be copied from here (failsafe in case update URL is unreachable)
local IP2C_UPDATE_URL = "http://mirror-cdn.multitheftauto.com/mtasa/scripts/IpToCountryCompact.csv"
local IP2C_UPDATE_INTERVAL_SECONDS = 60 * 60 * 24 * 1 -- Update no more than once a day

Expand Down Expand Up @@ -53,9 +54,20 @@ end
setTimer( loadIPGroupsIsReady, 1000, 1 )


-- Load all IP groups from "conf/IpToCountryCompact.csv"
-- Load all IP groups from IpToCountry file
function loadIPGroupsWorker ( cor )

-- Check if file exists; if not, copy from backup
if not fileExists( IP2C_FILENAME ) then
if (not fileExists( IP2C_FILENAME_BACKUP )) or (not fileCopy( IP2C_FILENAME_BACKUP, IP2C_FILENAME )) then
-- Create empty file if backup is not available or copy fails
outputDebugString( "IpToCountry file not found, creating empty file", 2 )
fileSaveContent( IP2C_FILENAME, "" )
else
outputDebugString( "IpToCountry file not found, successfully copied from backup" )
end
end

-- Maybe update file using the 'internet'
checkForIp2cFileUpdate( cor )

Expand Down
2 changes: 1 addition & 1 deletion [editor]/edf/meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta>
<info author="jbeta" description="Element Definition Format" edf:definition="edf.edf" />
<info author="jbeta" description="Element Definition Format" edf:definition="edf.edf" version="1.0.0" />

<min_mta_version client="1.5.7-9.19626" server="1.3.5" />

Expand Down
2 changes: 1 addition & 1 deletion [editor]/editor/meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta>
<info author="erorr404,jbeta,Talidan" description="Official MTA map editor" />
<info author="erorr404,jbeta,Talidan" description="Official MTA map editor" version="1.0.0" />

<!-- Include map manager, needed for the testing components, and handles the idea of "Gamemodes" and "Maps" -->
<include resource="mapmanager" />
Expand Down
2 changes: 1 addition & 1 deletion [editor]/editor_gui/meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta>
<info author="Talidan, jbeta" description="Map editor GUI" />
<info author="Talidan, jbeta" description="Map editor GUI" version="1.0.0" />

<!-- Required resources -->
<include resource="dialogs" />
Expand Down
2 changes: 1 addition & 1 deletion [editor]/editor_main/meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta>
<info author="erorr404,jbeta,Talidan" description="Map editor's main component" edf:definition="editor_main.edf" />
<info author="erorr404,jbeta,Talidan" description="Map editor's main component" edf:definition="editor_main.edf" version="1.0.0" />

<min_mta_version server="1.5.8-9.20957" />

Expand Down
1 change: 1 addition & 0 deletions [editor]/move_cursor/meta.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<meta>
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" version="1.0.0" />
<script src="move_cursor.lua" type="client" />
<script src="controlinterface.lua" type="client"/>

Expand Down
1 change: 1 addition & 0 deletions [editor]/move_freecam/meta.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<meta>
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" version="1.0.0" />
<script src="move_freecam.lua" type="client" />
<script src="controlinterface.lua" type="client"/>

Expand Down
1 change: 1 addition & 0 deletions [editor]/move_keyboard/meta.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<meta>
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" version="1.0.0" />
<script src="controlinterface.lua" type="client" />
<script src="move_keyboard.lua" type="client" validate="false"/>

Expand Down
1 change: 1 addition & 0 deletions [editor]/msgbox/meta.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<meta>
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" version="1.0.0" />
<script src="script.lua" type="client"/>
<file src="images\error.png" />
<file src="images\info.png" />
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-area51/as-area51.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">


<assaultSettings finishType="objective" finishObjective="silo"
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-cliff/Cliff Mayhem.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">

<meta>
<author>norby89 and driver2</author>
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-dam/as-dam.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">


<assaultSettings finishType="all" description="Steal explosives, destroy the dam" />
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-docks/as-docks.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">

<meta>
<author>BB101</author>
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-heist/Heist.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">

<meta>
<author>norby89</author>
Expand Down
2 changes: 1 addition & 1 deletion [gamemodes]/[assault]/[maps]/as-sharks/as-sharks.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<map mod="deathmatch" version="1.0">
<map version="1.0">
<meta>
<author>Ratt</author>
<version>1.0</version>
Expand Down
Loading

0 comments on commit 4511910

Please sign in to comment.