Skip to content

onPlayerTriggerEventThreshold behaves incorrectly #4261

Closed
@ffsPLASMA

Description

@ffsPLASMA

Describe the bug

We use onPlayerTriggerEventThreshold to detect malicious players doing DOS events via ingame events.
However the server/network behaves incorrectly/falsely when the MTA client freezes for a few seconds.

Current scenario is, I use Vice City with MTA Stream from Wolfee-J (https://github.com/Wolfee-J/MTA-Vice-City) in which you load the whole map from one IMG container. Whenever I load the VC game world, the client freezes for 4-5 seconds.

When the client is done loading and unfreezes, onPlayerTriggerEventThreshold gets called on server for this client. This also happens when the client unloads the map which takes less than 1 second of freeze.

Whats odd is the client should not exceed the event threshold at all, I ran the following test while loading the custom map:

uFile = fileCreate("out.txt");

function checkEvents( sourceResource, functionName, isAllowedByACL, luaFilename, luaLineNumber, ... )
    local args = { ... }
    local resname = sourceResource and getResourceName(sourceResource)

	if(uFile) then
		if(functionName == "triggerServerEvent") then
			fileWrite(uFile, tostring(functionName).." @ "..tostring(resname).." from "..tostring(luaFilename)..":"..tostring(luaLineNumber).."\n");
		end
	end
end
addDebugHook( "postFunction", checkEvents)

function resourceStop()
	fileClose(uFile);
end
addEventHandler("onClientResourceStop", resourceRoot, checkEvents);

In the loading and unloading periods, the client only triggers ~8 events to server, yet the default threshold of 1000/100 triggers.

Setting the thresholds of interval and num events to max 5000/1000, the threshold does not get exceeded.

So the questions, does the client internally stockpile all remote calls to server because the GTA exe freezes due to loading content and then sends the whole pile to server at once? Or is the client not processing the RPC callback and therefore resending previous RPCs?

This event was added with commit eae47fe

Steps to reproduce

Download VC resource, add onPlayerTriggerEventThreshold check and trigger a server event while loading.

Version

client: Multi Theft Auto v1.6-release-23196
server: MTA:SA Server v1.6-release-23079

Additional context

No response

Relevant log output

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions