Raised This Month: $13 Target: $400
 3% 

[CS:GO] Problem with assists manipulation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-21-2016 , 15:47   [CS:GO] Problem with assists manipulation
Reply With Quote #1

Hello guys. I have little problem with CSGO assist's manipulation.
Super simple code:

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

public OnPluginStart()
{
    
HookEvent("round_end"OnRoundEnd);
}

public 
OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClients; ++i)
    {

        
PrintToChat(i"[DEBUG] ASSIST+");

        
CS_SetClientAssists(i10);   
    }

What it should do?
At round end => Give every player 10 assist's

BUT

On round end, assist's are assigned, so each player have 10 assist's, and then immediately after NEW round start, assist's are in state before setting them to 10

Debug message are working too btw.

Can you guys please help me fix this somehow? So assist's will stay?
__________________


Last edited by Jcrr; 07-21-2016 at 16:00. Reason: little mistake
Jcrr is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 07-21-2016 , 16:23   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #2

First of all, check your error logs. You will find something about client invalidity.
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-21-2016 , 17:07   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #3

Quote:
Originally Posted by KissLick View Post
First of all, check your error logs. You will find something about client invalidity.
Error log:
PHP Code:
L 07/21/2016 23:03:34: [SMException reportedClient 2 is not in game
L 07
/21/2016 23:03:34: [SMBlamingtest.smx()
L 07/21/2016 23:03:34: [SMCall stack trace:
L 07/21/2016 23:03:34: [SM]   [0PrintToChat
L 07
/21/2016 23:03:34: [SM]   [1Line 17test.sp::OnRoundEnd()
L 07/21/2016 23:03:34: [SM]   [3AcceptEntityInput 

Is this: L 07/21/2016 - 23:034: [SM] Exception reported: Client 2 is not in game
indicating, that my actual Client ID is different than plugin got??
__________________

Jcrr is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-21-2016 , 17:17   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #4

Check if client is in game before setting assist count.
__________________
hleV is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-21-2016 , 17:26   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #5

Quote:
Originally Posted by hleV View Post
Check if client is in game before setting assist count.
As i predicted it didn't help, dunno why it should help... but still tried.

Same issue, on end of round assist's are assigned, then on start of next round they are cleared to state before assign.
__________________


Last edited by Jcrr; 07-21-2016 at 17:42.
Jcrr is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 07-21-2016 , 22:25   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #6

Try doing it at post:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

public OnPluginStart()
{
    
HookEvent("round_end"OnRoundEndEventHookMode_Post);
}

public 
OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
PrintToChat(i"[DEBUG] ASSIST+");
            
CS_SetClientAssists(i10);   
        }
    }

What about doing this at the start of the round as well or instead?
__________________
Maxximou5 is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-22-2016 , 05:46   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #7

Quote:
Originally Posted by Maxximou5 View Post
Try doing it at post:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

public OnPluginStart()
{
    
HookEvent("round_end"OnRoundEndEventHookMode_Post);
}

public 
OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            
PrintToChat(i"[DEBUG] ASSIST+");
            
CS_SetClientAssists(i10);   
        }
    }

What about doing this at the start of the round as well or instead?

Doing this on post didn't help
It must be done at round end, because i need to do something on players that survive whole round.
__________________

Jcrr is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 07-22-2016 , 06:30   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #8

So far from what I have tested, setting the value to players will be reset on the start of the new round.
The values set for BOTS will remain; however, the value set for a client will reset at the start of the new round.
Not sure why clients are being reset but BOTS aren't; probably to block achievements. I'll do more testing...
__________________
Maxximou5 is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-22-2016 , 06:42   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #9

Got some more informations:

round_end dont have short:userid : https://wiki.alliedmods.net/Generic_...ents#round_end
As you can see, for example, player_death have short:userid : https://wiki.alliedmods.net/Generic_...s#player_death

When im getting clientID from userid of player_death, on event when player die it's working fine, assist's will stay forever

+More informations:
Assists are assignet properly on player_death UNTILL, player will survive whole round and respawn in next round, after that it's completly broken, assists aren't assigned on death at all.
__________________


Last edited by Jcrr; 07-22-2016 at 11:34.
Jcrr is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-25-2016 , 02:25   Re: [CS:GO] Problem with assists manipulation
Reply With Quote #10

Quote:
Originally Posted by Jcrr View Post
It must be done at round end, because i need to do something on players that survive whole round.
Maybe explain what your trying to do?

Why not just store if a player survived in a simple bool array?
__________________
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

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 20:52.


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