Raised This Month: $ Target: $400
 0% 

Adt_array OnGameFrame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 06-29-2014 , 05:22   Adt_array OnGameFrame
Reply With Quote #1

Hello there,

I've got to questions in one.

I'm trying to override changes performed by the game on m_iAmmo when reloading.
The way I do this is hooking NetworkStateChanged_m_iAmmo function in a post hook, then I use a fifo to save the weapon entity on which m_iAmmo is updated.
OnGameFrame I process the fifo and override ammo set by the game (and weapon clip also).

I've read somewhere that adt_array have an access overhead. As my fifo is based on adt_arry, this could be a problem.
Is it true? If so, I should fall back to sourcepawn arrays.

Secondly, using that system, during one gameframe ammo is not overriden. Is there a way to post hook gameframe, or override the prop data before it is sent to client?

BTW this is CS:GO but should apply to all games.
h3bus is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 06-29-2014 , 06:26   Re: Adt_array OnGameFrame
Reply With Quote #2

It's probably better to use regular arrays since you don;t really need a dynamic array.
About the second: there are PreThink and PostThink hooks you can set on clients. It's like local gameframes for every client.

PHP Code:
#include <sdkhooks>

// ... 

public OnClientPutInServer(client) {

    
SDKHook(clientSDKHook_PostThinkOnClientThink);
}

public 
OnClientThink(client) {

    
// No need to check if client is in game, since this will fire only if client is in game
    
IsPlayerAlive(client) {
        
// Do some stuff
    
}


Last edited by xf117; 06-29-2014 at 06:30.
xf117 is offline
Send a message via ICQ to xf117
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 06-29-2014 , 07:18   Re: Adt_array OnGameFrame
Reply With Quote #3

Thanks, PostThink on client is working and I got rid of adt_arrays.

However, ammo set by game can still be seen on client: ammo is glitching very fast before being set back to the plugin value.
Event if player is very unlikeley to shoot during that glitch, I would like to get rid of that as this does not feel "clean".
Do you have any idea why prop data is sent to client before post think?

Last edited by h3bus; 06-29-2014 at 07:19.
h3bus is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 06-29-2014 , 07:32   Re: Adt_array OnGameFrame
Reply With Quote #4

It is probably due to client prediction and you can't really do anything about it.
But every significant event needs to be verified by the server. And server knows the amount of ammo clients really has and won't let them shoot even if client thinks he can. It will be jerky on client's side tho. But AFAIK there is nothing we can do to bypass it.
xf117 is offline
Send a message via ICQ to xf117
h3bus
AlliedModders Donor
Join Date: Nov 2013
Old 06-29-2014 , 07:40   Re: Adt_array OnGameFrame
Reply With Quote #5

Ok I will settle on that behavior.

Thanks for the help!

Last edited by h3bus; 06-29-2014 at 07:40.
h3bus 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 05:21.


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