Raised This Month: $51 Target: $400
 12% 

[CS:GO] get correct Bullet Destination


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aligator123456
Junior Member
Join Date: Jan 2015
Old 05-01-2015 , 10:36   [CS:GO] get correct Bullet Destination
Reply With Quote #1

Hi

currently I use this:
Code:
public BulletImpact(Handle:event, const char[] name, bool:dontBroadcast) {
        float bulletDestination[3];
        bulletDestination[0] = GetEventFloat(event, "x");
        bulletDestination[1] = GetEventFloat(event, "y");
        bulletDestination[2] = GetEventFloat(event, "z");
}
to get the Bullet Destination, but when I do a fast move while shooting, I get sometimes very wrong results.

Is there a better way doing this?
aligator123456 is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-01-2015 , 13:44   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #2

You can disable prediction:
sv_client_predict 0
Or you should use bonemerge with these offsets as shifts ( SetParentAttachmentMaintainOffset )... then it will be predicted with its parent

PHP Code:
    new enteffects GetEntProp(entProp_Send"m_fEffects");
    
enteffects |= EF_BONEMERGE;
    
SetEntProp(entProp_Send"m_fEffects"enteffects); 
But it may not work (I mean SetParentAttachmentMaintainOffset)

Last edited by kadet.89; 05-01-2015 at 13:51.
kadet.89 is offline
Send a message via Skype™ to kadet.89
aligator123456
Junior Member
Join Date: Jan 2015
Old 05-01-2015 , 14:52   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #3

I don't realy understand what you mean.

If I shift it, I need to know the Offset, but the Offset is always different, so I don't know it....

And I can't find anything helpfull about SetParentAttachmentMaintainOffset.

Last edited by aligator123456; 05-01-2015 at 14:58.
aligator123456 is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-01-2015 , 16:15   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #4

Ok, you know the real player position and the absolute position of BulletImpact. Just subtract one from the other and result will be the shift (offsets) that you are looking for. Than, as a player model is predictable, you should attach your "thing" to it and make it predictable with the player model.
Here is an example:
https://forums.alliedmods.net/showthread.php?t=261708
To make the entity predictable you should use EF_BONEMERGE flag, or this entity https://developer.valvesoftware.com/...namic_ornament
If you don't want to "display" something in the impact position, than you can just use the result of the BulletImpact function, as it returns the correct position (for the server)
The real position and visible position are highly depend on your ping. The server doesn't know predicted results, so you can't control it directly from the server.
If you want to use particle systems, then you should create a model with ones:
https://developer.valvesoftware.com/...cles_on_models
These are the only ways I know to make it to display correctly. You can also check this thread https://forums.alliedmods.net/showthread.php?t=261725 but I haven't find a way to make it "predictable"
Is the "Destination", you are talking about - another player ?
If it's not a secret, what do you want to achieve?

More about prediction https://developer.valvesoftware.com/wiki/Prediction

Last edited by kadet.89; 05-01-2015 at 16:41.
kadet.89 is offline
Send a message via Skype™ to kadet.89
aligator123456
Junior Member
Join Date: Jan 2015
Old 05-01-2015 , 16:44   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #5

Thank you, for your reply.
I'm still not sure, what you mean.


Here is what I think:

If I shoot, the bullet hits on C, but sometimes I get the coordinates of B.
How does the real Player position help me when I want to get the offset?

Sorry, but I'm new to modding with sourcemod, so maybe I missunderstand you.



Edit: just saw your edit.
So you mean, that I get the real possition, but the client shows a wrong one?
I would like to create a trace, between the player and the bullet (where it hits the wall, a player or something else). I saw another plugin, where it was made with the player-look-direction, but this works only for weapons, which don't spray....

Last edited by aligator123456; 05-01-2015 at 16:56.
aligator123456 is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-01-2015 , 16:50   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #6

Well, I suppose it's not possible. Bullet impact sprite - is a client side thing, you don't see it the same way as the server does, because of the ping-time shift. The result, the server gives to you is correct, and the sprite position is incorrect because of the prediction. The only way to minimize the difference - is to try to recalculate the prediction shift. I think the shift should be close to 'your speed'*'your ping', but I may be wrong. You should also take into account the spread of the bullets hit and recoil, it depends on the speed and the type of the weapon.
Perhaps this article will help you https://developer.valvesoftware.com/wiki/Prediction

Last edited by kadet.89; 05-01-2015 at 17:06.
kadet.89 is offline
Send a message via Skype™ to kadet.89
aligator123456
Junior Member
Join Date: Jan 2015
Old 05-01-2015 , 17:31   Re: [CS:GO] get correct Bullet Destination
Reply With Quote #7

Ok, then I will let it like it is now. It's better than nothing.

Thank you for your help!
aligator123456 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode