HasPedGotWeapon native for server side

Hi,
i need HasPedGotWeapon in server side for some blacklist weapon detection on server side . and the reason for server side is they can’t even know that there is a blacklist weapon !

You could make a script that triggers an event on the client to return all their weapons though, and it would be the same thing.

1 Like

There is no need for that if you don’t want them to see which weapons are blacklisted by dumping server files create a server side callback and put those blacklisted weapons on there then on client side trigger that callback and retrieve those weapons from server so when they dump the files they will see a empty table

1 Like

they always can block events on client side so i think i need such event

If you trigger an event on the client and the client doesn’t answer by triggering your server event, you could kick him from the server.

1 Like

You are right, but if they implement such a feature (Which I am 99% sure they don’t) imagine this check iteration for 128 players it’s heavy and can cause hitch and lag for your server as players rise up I suggest few things

Listen for the client resource stop event so once they stop a resource on their own client they will get banned (but you have to be careful and don’t restart a resource or use scripts contains automatic stop/restart)

AddEventHandler('onClientResourceStop', function (resource)
  TriggerServerEvent('yourBanEvent', "Tried to stop resource " .. resource)
end)

A heartbeat for your server ban event, for example, let’s consider your ban event is banMyself you can pass few arguments to this event such as reason and etc add an isFake parameter at the end and if it was true don’t ban the player and consider that as a heartbeat and if a user failed to send heartbeat three times in a row within X second just ban/kick them

Obfuscation, It’s not really useful unless you have a unique obfuscation method for your self but it’s still better than nothing you can obfuscate your client-side files in order to prevent script kiddies read what’s really going on or find out event names, XFuscator is one of those free obfuscation software for Lua

1 Like

yea well i don’t really want to make a loop to check HasPedGotWeapon on server side , i want to check on certain times i want ,
also the part for sending heartbeat for event from client, may have too many false positives because of time outs or any network problem with client

also i don’t believe Obfuscation really do something these days when they can decode it like a charm !
but for sure it stop kids

This would be great to have server side! Right now I’m using GetSelectedPedWeapon() server side so maybe you could use this as a work around?

1 Like

another problem i faced up with recently is
if you call RemoveWeaponFromPed , in server or client side
if player is time-out or in reconnecting . it won’t work and player still have the weapon !

I would personally just kick a player who is “reconnecting”, to force them to reload the game.
That feature is not reliable at all to me, I keep reading forum posts about people having players duplicate stuff because of it.
So my suggestion is to check if the player’s ping is -1: if it is, then save their cached data and then drop them with a “sorry, a network issue has occurred” message, so if they manage to reconnect, their data gets loaded from the server again.

You are aware that’s bad script design in whatever script things get “duplicated” in, and not an issue with “that feature”, right?

Another use that could be extremely helpful => [Server side native request] HasPedGotWeapon