[[?]] Modders and how they do their stuff

Yes that part i understand. My confusion was more on the server side of things. In theory, with the native that you provided, one could check if the entity owner is an admin, if not, that would be evidence enough that they are cheating?

“Evidence” is a strong word, and it depends on how your server is set up.
For example, if you have one of those phone scripts, and someone takes out their phone, that usually entails creating an entity (the phone model) and attaching it to their hand.

You don’t need to be an admin to take out your phone, and using the phone is likely not considered cheating on your server.

The mentioning of an admin was just an example, it could be looked as a permission. The phone script in question would need to give the player a temporary permission for that phone model entity. Some other script would be constantly going over all entities and their owners to see if they have permissions for them. If not - banned, or at the very least, their entities deleted.

In theory, this would be enough to stop modders from spawning entities?

they can indeed detect this, there calling server sided functions, by implementing “injecting” their own client side scripts or something.

You can block this from happening, by adding a block/autokick/ban on these functions or adding a keycheck to the functions, and checking serversided if they match.

here’s a list provided by @d0p3t with the most commonly abused functions.

Thank you for that useful thread.

I did still but i think native is broken becouse it wont work.

function GetOwnerOfEntity(entity)
    if (not DoesEntityExist(entity)) then 
        return nil 
    end
    local owner = NetworkGetEntityOwner(entity)
    if (GetEntityPopulationType(entity) ~= 7) then return nil end
    return owner
end

Still enitity owner is returning nil

1 Like

That native only works on onesync. Make sure you have that enabled. As that native does work as intended on my server running artifact 2890.

1 Like

Hm im using recommended version i think its 2430. And im using OneSync inf. but it doesent work, its returning nil whole time.

Try updating your artifact, that is pretty outdated at this point.

bObjs = {
	['blocked_prop_hash'] = true,
}
AddEventHandler("entityCreating",function(entity)
	if not DoesEntityExist(entity) then
		return
	end
	local src = NetworkGetEntityOwner(entity)
	if GetEntityType(entity) == 3 then
		local model = GetEntityModel(entity)
		if bObjs[model] == true then
			CancelEvent()
			-- Ban player TriggerEvent('YourEvent', src, model )
		end
	end
end)

Works fine for me

I tried and it’s not a good idea, you could ban innocent players with that because if the modder spawns, for example, a cage or an unfriendly ped to troll someone, and the modder is far away, the owner will be the victim.

If you have OneSync and you can use the entityCreating event, then it works as DioneB showed, because most likely the entity owner in that tick is the real creator of the entity, but I never tried it because I don’t use OneSync at the moment.

Instead, if you don’t have OneSync, I suggest you to keep a server-side list of valid entities’ network-ids, and to regularly ask every player to return a list of all their “mission” entities (population type = 7)’ network ids, and if the entity is not on your list, then delete it.

Yes, well, I was assuming the context of the entityCreating event.
Also, why not use OneSync? It makes no sense to me that people want worse sync and no server-side entity awareness, so please elaborate on what the upside is.

The issue is that I am currently developing my server from scratch, and I don’t know how long it will take, so don’t want to start paying the monthly $15 too early; I will move to OneSync after I’ll see my server succeed.

Huh?

OneSync is free, it’s higher slot counts that require a subscription.

Waaat? D: This is great news then

How do I enable it? I’ve read the OneSync post many times but I don’t understand how to enable it.

OneSync is free, and if you are building a new server you should build it with the serverside entity awareness from the beginning.

Especially handy for cheat detection.

1 Like

In your server starter script, add +set onesync on
Suddenly, OneSync is on.

1 Like

Thanks guys, it works :slight_smile: I was basically building server-state awareness by myself with events lmao.

I was confused because of the The OneSync EAP and you post:

Since I don’t have any of these I thought I couldn’t use OneSync

Yes, a post from almost two years ago is outdated.
It happens.

You can just enable OneSync now. This change was done to stimulate development of OneSync-aware resources without requiring developers to fork over money on Patreon.
It’s been a generally very nice change.

The way it works now is that increasing sv_maxClients beyond 32 is paywalled instead.

1 Like

That’s great :slight_smile:
I do think however, that the thread should be edited, because it’s literally the first result on Google, and it’s linked in dozens and dozens of forum posts.