View Issue Details

IDProjectCategoryView StatusLast Update
0009635New Feature Requests[All Projects] Generalpublic2017-06-18 20:54
Reportereinheit-101Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0009635: [Request] onClientPlayerWeaponPreFire + cancel ability
Description

It would be nice to be able to prevent the player from shooting by using cancelEvent(). Using this server side will still let the player shoot, however the shot doesnt get synced. A better solution would be to not let the player shoot at all by cancelling it on the client.

Also current behaviour when pressing "fire" while using the camera results in GTA taking a screenshot that gets saved to the GTA San Andreas User files. onClientPlayerWeaponFire does trigger there too, and cancelling it should prevent the game from taking that screenshot.

Additional Information

On my server there are situations where it is better to prevent the player from shooting if many certain conditions meet together. Using toggleControl() is very unpractical to use in some these situations, cancelEvent() however would allow to prevent single shots without actually disabling said control.

TagsNo tags attached.

Activities

CrosRoad95

2017-05-14 20:13

viewer   ~~0025946

use
https://wiki.multitheftauto.com/wiki/ToggleControl
toggleControl ( "fire", false ) -- or true :D i dont know

einheit-101

2017-05-14 22:09

reporter   ~~0025948

Using toggleControl would mean that i have to use onClientRender() to check if the player is allowed to shoot or not and enable/disable the control there each frame.

Plus sometimes i need the client to actually fire the weapon and then check the parameters in onClientPlayerWeaponFire to check if the shot is valid and THEN cancel it afterwards (if thats possible)

IIYAMA12

2017-05-15 15:47

viewer   ~~0025949

@einheit-101
Agree, except it should be only cancel able for the localPlayer.(security)

ccw

2017-05-15 19:01

administrator   ~~0025950

It's not possible to cancel server side onPlayerWeaponFire because bullets are synced on a separate thread. onClientPlayerWeaponFire is triggered too late to be cancelled.

The only alternative would be to add a new event like onClientPlayerWeaponPreFire

einheit-101

2017-05-15 23:12

reporter   ~~0025951

@IIYAMA12 yes of course only cancellable for the localPlayer.

@ccw then maybe its better to rename this bug report summary when its impossible to resolve in its current form.

Issue History

Date Modified Username Field Change