Skip to content

Commit 2355fa8

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e9f7ead + a1d4285 commit 2355fa8

File tree

20 files changed

+343
-145
lines changed

20 files changed

+343
-145
lines changed

[gamemodes]/[assault]/assault/assault.lua

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -944,21 +944,6 @@ function createHelpText()
944944
return helpTable
945945
end
946946

947-
function onPlayerChat( message, theType )
948-
if theType == 0 then
949-
cancelEvent()
950-
message = string.gsub(message, "#%x%x%x%x%x%x", "")
951-
local team = getPlayerTeam( source )
952-
local playerName = getPlayerName( source )
953-
if (team) then
954-
local r,g,b = getTeamColor(team)
955-
outputChatBox( playerName..":#FFFFFF "..message,root,r,g,b, true )
956-
else
957-
outputChatBox( playerName..": "..message )
958-
end
959-
outputServerLog( "CHAT: " .. playerName .. ": " .. message )
960-
end
961-
end
962947

963948

964949
function onPlayerJoin ()
@@ -1524,7 +1509,6 @@ addEventHandler( "onPlayerSpawn", root, onPlayerSpawn )
15241509
addEventHandler( "onPlayerWasted", root, onPlayerWasted )
15251510
addEventHandler( "onPlayerJoin", root, onPlayerJoin )
15261511
addEventHandler( "onPlayerQuit", root, onPlayerQuit )
1527-
addEventHandler( "onPlayerChat", root, onPlayerChat )
15281512

15291513
-- Vehicle Events
15301514
addEventHandler ( "onVehicleEnter", root, onVehicleEnter )

[gamemodes]/[play]/play/meta.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<include resource="superman"/>
77
<include resource="hedit"/>
88
<include resource="mapfixes"/>
9+
<include resource="chatmanager" />
910

1011
<script src="play_config.lua" type="server"/>
1112
<script src="play_players.lua" type="server"/>

[gamemodes]/[tdm]/tdma/Main/tdma_core.lua

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -332,23 +332,6 @@ function xonPlayerWasted ( ammo, attacker, weapon, bodypart )
332332
end
333333
addEventHandler ( "onPlayerWasted", root, xonPlayerWasted )
334334

335-
function onChat ( message, theType )
336-
if theType == 0 then
337-
cancelEvent()
338-
message = string.gsub(message, "#%x%x%x%x%x%x", "")
339-
local team = getPlayerTeam ( source )
340-
local bastidName = getPlayerName ( source )
341-
if ( team ) then
342-
local r, g, b = getTeamColor ( team )
343-
outputChatBox ( bastidName..":#FFFFFF "..message, root, r, g, b, true )
344-
else
345-
outputChatBox ( bastidName..": "..message )
346-
end
347-
outputServerLog( "CHAT: " .. bastidName .. ": " .. message )
348-
end
349-
end
350-
addEventHandler ( "onPlayerChat", root, onChat )
351-
352335
function updateKills( idPlayer, idTeam )
353336
if ( tonumber(gameMaxKills) > 0 ) then
354337
if xDebug then outputDebugString ( "Kills for team before are: " .. idTeam.kills ) end

[gameplay]/freeroam/fr_client.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,7 @@ function toggleFRWindow()
23282328
showCursor(false)
23292329
hideAllWindows()
23302330
colorPicker.closeSelect()
2331+
closePositionWindow()
23312332
else
23322333
if guiGetInputMode() ~= "no_binds_when_editing" then
23332334
guiSetInputMode("no_binds_when_editing")

[gameplay]/freeroam/fr_server.lua

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
local g_PlayerData = {}
22
local g_VehicleData = {}
3-
local chatTime = {}
4-
local lastChatMessage = {}
53

64
g_ArmedVehicles = {
75
[425] = true,
@@ -447,34 +445,6 @@ function fadeVehiclePassengersCamera(toggle)
447445
end
448446
end
449447

450-
addEventHandler('onPlayerChat', root,
451-
function(msg, type)
452-
if type == 0 then
453-
cancelEvent()
454-
if not hasObjectPermissionTo(source, "command.kick") and not hasObjectPermissionTo(source, "command.mute") then
455-
if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then
456-
outputChatBox("Stop spamming main chat!", source, 255, 0, 0)
457-
return
458-
else
459-
chatTime[source] = getTickCount()
460-
end
461-
if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then
462-
outputChatBox("Stop repeating yourself!", source, 255, 0, 0)
463-
return
464-
else
465-
lastChatMessage[source] = msg
466-
end
467-
end
468-
if isElement(source) then
469-
local r, g, b = getPlayerNametagColor(source)
470-
outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. stripHex(msg), root, r, g, b, true)
471-
outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg )
472-
end
473-
end
474-
end
475-
)
476-
477-
478448
addEventHandler('onVehicleEnter', root,
479449
function(player, seat)
480450
if not g_VehicleData[source] then
@@ -599,8 +569,6 @@ function quitHandler(player)
599569
table.each(g_PlayerData[source].vehicles, unloadVehicle)
600570
removeEventHandler("onFreeroamLocalSettingChange",source,onLocalSettingChange)
601571
g_PlayerData[source] = nil
602-
chatTime[source] = nil
603-
lastChatMessage[source] = nil
604572
end
605573
addEventHandler('onPlayerQuit', root, quitHandler)
606574

[gameplay]/freeroam/meta.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
-->
9999
<setting name="*vehicles/disallowed_warp" value="[[425, 520, 476, 447, 464, 432]]" />
100100

101-
<setting name="*chat/mainChatDelay" value="1000" /> <!-- Miliseconds between each message a player can send through main chat -->
102-
<setting name="*chat/blockRepeatMessages" value="true" /> <!-- Prevent a player from saying the same thing twice in a row to spam -->
103101
<setting name="*gui/antiram" value="true" /> <!-- Allow player to use vehicle ghostmode (anti-ram) from F1? -->
104102
<setting name="*gui/disablewarp" value="true" /> <!-- Allow player to prevent others warping to them from F1? -->
105103
<setting name="*gui/disableknife" value="true" /> <!-- Allow player to prevent themselves from getting knifekilled and vice versa (instakilled from behind) from F1? -->

[gameplay]/hedit/meta.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<meta>
2-
<info type="script" name="Ingame Handling Editor" author="Remi-X" version="2.1.5" description="The first ingame handling editor for MTA!" />
2+
<info type="script" name="Ingame Handling Editor" author="Remi-X, MTA contributors (github.com/multitheftauto/mtasa-resources)" version="2.1.6" description="The first ingame handling editor for MTA!" />
33
<oop>true</oop>
4-
<min_mta_version server="1.4.0" client="1.4.0" />
4+
<min_mta_version server="1.6.0-9.22815" client="1.6.0-9.22815" />
55

66
<!-- SHARED -->
77
<script src="shared/variables/general.lua" type="shared" />

[gameplay]/hedit/server/cfgloader.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function loadCFGIntoMemory ( cfgstr )
2626
waitForLine = false
2727

2828
if addingEntry then
29-
print ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token )
29+
outputDebugString ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token, 1)
3030
table.remove ( lines, #lines )
3131
addingEntry = false
3232
end
@@ -63,18 +63,18 @@ function loadCFGIntoMemory ( cfgstr )
6363

6464

6565
if #lines > 0 then
66-
print ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." )
67-
print ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." )
68-
print ( "[HEDIT] This may take some time." )
66+
outputDebugString ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." )
67+
outputDebugString ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." )
68+
outputDebugString ( "[HEDIT] This may take some time." )
6969

7070
addCommandHandler ( "exportcfg", function ( player )
7171

7272
if getElementType ( player ) ~= "console" then
7373
return false
7474
end
7575

76-
print ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." )
77-
print ( "[HEDIT] This may take a while. Please wait." )
76+
outputDebugString ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." )
77+
outputDebugString ( "[HEDIT] This may take a while. Please wait." )
7878

7979
setTimer ( function ( )
8080
exportToDefaults ( lines )
@@ -85,8 +85,8 @@ function loadCFGIntoMemory ( cfgstr )
8585
return true
8686
end
8787

88-
print ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!")
89-
print ( "[HEDIT] Make sure handling.cfg is correct and try again." )
88+
outputDebugString ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!", 2)
89+
outputDebugString ( "[HEDIT] Make sure handling.cfg is correct and try again.", 2 )
9090

9191
return true
9292
end
@@ -113,7 +113,7 @@ function exportToDefaults ( linetabs )
113113

114114
if id == 1 then
115115
if not tonumber ( value ) then
116-
print ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!" )
116+
outputDebugString ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!", 1 )
117117
break
118118
end
119119

@@ -156,8 +156,8 @@ addCommandHandler ( "loadcfg", function ( player )
156156

157157
fileClose ( cfgFile )
158158

159-
print ( "[HEDIT] handling.cfg has been read." )
160-
print ( "[HEDIT] Please wait while loading the lines into the memory." )
159+
outputDebugString ( "[HEDIT] handling.cfg has been read." )
160+
outputDebugString ( "[HEDIT] Please wait while loading the lines into the memory." )
161161

162162
setTimer ( function ( )
163163
loadCFGIntoMemory ( str )
@@ -166,6 +166,6 @@ addCommandHandler ( "loadcfg", function ( player )
166166
return true
167167
end
168168

169-
print ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource." )
169+
outputDebugString ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource.", 2 )
170170
return false
171171
end )

[gameplay]/hedit/server/core.lua

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,21 @@ addEventHandler ( "onResourceStart", resourceRoot, function ( )
77

88
local resName = getResourceName ( resource )
99

10-
setElementData(resourceRoot, "resourceVersion", getResourceInfo(resource, "version"))
11-
1210
if resName ~= "hedit" and not DEBUGMODE then
13-
outputChatBox ( "Handling Editor failed to start, see the logs for more information." )
14-
print ( "===============================================================================" )
15-
print ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor." )
16-
print ( "[HEDIT] The handling editor will not work unless you rename the resource to 'hedit'." )
17-
print ( "===============================================================================" )
11+
outputDebugString ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor.", 1)
1812
return cancelEvent ( true, "Rename the handling editor resource to 'hedit' in order to use the resource." )
1913
end
2014

21-
22-
print ( "===============================================================================" )
23-
print ( " MTA:SA HANDLING EDITOR [hedit.github.io]" )
24-
print ( "===============================================================================" )
2515
if fileExists ( "handling.cfg" ) then
26-
print ( " Handling.cfg found." )
27-
print ( " Type 'loadcfg' to load handling.cfg into the memory." )
28-
print ( " After this, you can import the handling into defaults.xml." )
29-
print ( "===============================================================================" )
16+
outputDebugString ( "[HEDIT] Handling.cfg found; type 'loadcfg' to load handling.cfg into the memory.")
3017
end
3118

3219
--Parse meta settings
3320
parseMetaSettings()
3421
addEventHandler("onSettingChange", root, parseMetaSettings)
3522

3623
for model=400,611 do
37-
setElementData ( root, "originalHandling."..tostring ( model ), getOriginalHandling ( model, true ) )
24+
setElementData ( resourceRoot, "hedit:originalHandling."..tostring ( model ), getOriginalHandling ( model, true ), true, "deny" )
3825
end
3926

4027
--initiateCFGLoader ( )

[gameplay]/hedit/server/logmanager.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local vehicleLogs = {}
22

33
function loadHandlingLog ( )
4-
local data = getElementData ( root, "hedit:vehicleLogs" )
4+
local data = getElementData ( root, "hedit:vehicleLogs" ) -- retrieve stashed vehicleLogs from root element data (if it exists)
55

66
if data then
77
vehicleLogs = data
@@ -12,7 +12,7 @@ end
1212

1313

1414
function unloadHandlingLog ( )
15-
setElementData ( root, "hedit:vehicleLogs", vehicleLogs, false )
15+
setElementData ( root, "hedit:vehicleLogs", vehicleLogs, false, "deny") -- stash vehicleLogs as root element data so it can be recovered on next start
1616

1717
return true
1818
end
@@ -109,7 +109,7 @@ function uploadFullLog ( vehicle )
109109
return false
110110
end
111111

112-
triggerClientEvent ( client, "receiveFullLog", client, getElementData(root,"hedit:vehicleLogs")[vehicle] )
112+
triggerClientEvent ( client, "receiveFullLog", client, vehicleLogs[vehicle] )
113113
return true
114114
end
115115
addEvent ( "requestFullLog", true )

0 commit comments

Comments
 (0)