On(Player/Ped)WeaponShot Event [Server Side]

Hey, is it possible to create an event so we could catch it each time a player or a ped shot a gun from server-side?

Any use case information? This seems like it’d just lead to a lot of network load, or inaccurate timing if based on existing packets.

Also, why ‘player/ped’ in your subject? We don’t distinguish between ‘players’ and ‘peds’ here, so it feels like you’ve got some idea in mind from elsewhere that you didn’t mention in your post.

A server-side event will make a lot of spam, but you might be able to use a client-side game event, filter the info on the client, and only send relevant info to server. it’s not that reliable tho.

Yes, I prefer to use the least client logic, and use server logic as much as possible. (I guess that’s the whole idea of where the project is heading, with the explosionEvent, etc…)
I will use this event as more reliable shooting information than the client’s game events and send it through an event (which is unreliable), as part of a system that gives you the same amount of bullets as you had before if you disconnected to something like that.

The ped suggestion is just some protection- I have networked peds in my server, as they do scenarios and run if someone scares them, and if someone is owning a ped, then they can use it to shoot players (with cheats), which I wouldn’t be able to check that at all. I guess that’s also accurate for players, as cheaters can disable scripts and just summon a weapon and shoot everybody, and with that, we can filter it.

I suggested Player/Ped because I don’t know how much it makes it more complex, but if there’s no distinction between ped or players I’ll of course prefer peds, as it includes everything.

I don’t think any data is submitted per shot by game code at all, remote shooting animations are handled by the remote client based on firing rate data, and only the current animation state (firing, reloading, …) as well as damage done to entities are sent. This part may be wrong, however.

Also, if you want to account for player weapon inventory data, why do you want an event per ‘bullet shot’ and not, say, just an inventory accessor on the server?

Although, if for this use case it means more custom client → server data would have to be sent, and, as you say…

… assuming this is indeed ‘unreliable’, what would make any built-in implementation of this, which would amount to the exact same code as this shooting event, more ‘reliable’?

Wouldn’t it make more sense to report what is being ‘unreliable’ about the above? :confused: Client → server should never get dropped randomly, this is actually using a ‘reliable’ channel in ENet as it calls it, so I’m not sure what else you’re having issues with but it seems like a bug? :confused:

The most reliable information you can get, is counting it by yourself networked, which means that if you give a player 25 bullets, you count only the bullets that being sent networked and everyone sees, and you just decrese the amount of bullet that they had with what they shot, so it won’t be possible to cheat it. I assumed that every shot being fired is being reported to the server, therefore my suggestion, as if it was the case, then you couldn’t make a shot without it being validated by the server, which makes it to network only validated data (and other data just being cancelled). Without that, the only validation you have is depended on the client, that can mess with it if they have cheats, such as canceling the whole event, or sending wrong data (for example, that you fired from a less expensive weapon that you actually fired) and we couldn’t even check if it’s true, just because we get 0 data server-sided (networked, not RPC) about bullets and shooting. Also if it were possible I wanted to add some more suggestions, like to check where the bullet hit (x, y, z) on the map.

So, the next best option is to check the weapon inventory data server sided, as is it more secure but still not reliable as shooting event, but I guess we need to deal with what we have.

I don’t understand what you just wrote in that last post - it seems to be making a lot of contextual assumptions and not even answer the questions I asked in my reply above. Can you rephrase it?

If your concern is somehow ‘cheats’ saying something about ‘expensive(?) bullets’, then no event of any sorts is going to help with that, since any event will still rely on client-side data given the game doesn’t run server-side at all, and you should rethink your threat model rather than suggesting some change as if it’ll magically be ‘immune’ to client-side manipulation.

I’m still not sure what you’re trying to say other than that, as the rest of the post just looks like word salad. :confused:

For example:

What does ‘counting networked’ mean?

Same for the meaning of ‘bullets being sent networked’, and this also assumes ‘seeing’ is related to any other state changes (it isn’t, and players can damage local peds fine without the server ever being told anything, as again that’s how the game works).

Again with the weird use of the word ‘network’. Like… huh?

The entire game runs on ‘the client’. Sending bullets to ‘the server’ still wouldn’t change any of that.

Again, with the word ‘networked’. What do you mean by ‘networked’? How is ‘RPC’ not the same as ‘networked’? Why would ‘networked’ data from clients somehow not be ‘depended on the client’, and ‘RPC’ data would be?

what? Out of nowhere, in an entirely impossible-to-understand post, another weird ‘suggestion’. Why would that in any way help with your ‘cheater’ prevention?

Again, a weird paragraph of word salad. Without any actual use case information still it’s really impossible to tell what you’re trying to do or want to accomplish with your request.