AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CSGO] Fake Ping (https://forums.alliedmods.net/showthread.php?t=296442)

Mc_Daived 04-21-2017 07:38

[CSGO] Fake Ping
 
1 Attachment(s)
Hello ,This is new plugin was developed by me
but i think it's against to the valve policy :(
PHP Code:

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>


new String:g_szPlayerManager[50] = "";

// Entities
new g_iPlayerManager    = -1;

// Offsets
new g_iPing                = -1;

#define PLUGIN_URL "https://github.com/McDaived"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "McDaived"

public Plugin:myinfo =
{
    
name "Ping Faker",
    
author PLUGIN_AUTHOR,
    
description "Change ping for the players on scoreboard",
    
version PLUGIN_VERSION,
    
url PLUGIN_URL
};

public 
OnPluginStart()
{
    
CreateConVar("fp_version"PLUGIN_VERSION""FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT|FCVAR_DONTRECORD);
    
    
g_iPing    FindSendPropOffs("CPlayerResource""sm_iPing");

    
decl String:szBuffer[64];
    
GetGameFolderName(szBuffersizeof(szBuffer));

    if (
StrEqual("cstrike"szBuffer))
        
strcopy(g_szPlayerManagersizeof(g_szPlayerManager), "cs_player_manager");
    else if (
StrEqual("dod"szBuffer))
        
strcopy(g_szPlayerManagersizeof(g_szPlayerManager), "dod_player_manager");
    else
        
strcopy(g_szPlayerManagersizeof(g_szPlayerManager), "player_manager");
    
    
CreateTimer(2.0LoopClients_TIMER_REPEAT);
}

public 
OnMapStart()
{
    
g_iPlayerManager    FindEntityByClassname(MaxClients 1g_szPlayerManager);
    if (
g_iPlayerManager == -|| g_iPing == -1)
    {
        
SetFailState("Something is missing!");
    }
    
SDKHook(g_iPlayerManagerSDKHook_ThinkPostOnThinkPost);
    
}

new 
iPing[MAXPLAYERS+1];
public 
Action:LoopClients(Handle:timer)
{
    for (new 
1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i)) continue;
        
        new 
ping Client_GetFakePing(ifalse);
        if (
ping <= 30)
        {
            continue;
        }
        else if (
ping <= 50)
        {
            
iPing[i] = GetRandomInt(2025);
        }
        else if (
ping <= 90)
        {
            
iPing[i] = GetRandomInt(5055);
        }
        else
        {
            
iPing[i] = GetRandomInt(7077);
        }
    }
}

public 
OnClientDisconnect(client)
{
    
iPing[client] = 0;
}

public 
OnThinkPost(entity)
{
    for (new 
target 1target <= MaxClientstarget++)
    {
        if (
iPing[target] != 0)
        {
            
SetEntData(g_iPlayerManagerg_iPing + (target 4), iPing[target]);
        }
    }
}

#define TICKS_TO_TIME(%1)    ( GetTickInterval() * %1 )

stock Client_GetFakePing(clientbool:goldSource=true)
{
    
decl ping;
    new 
Float:latency GetClientLatency(clientNetFlow_Outgoing); // in seconds
        
    // that should be the correct latency, we assume that cmdrate is higher 
    // then updaterate, what is the case for default settings
    
decl String:cl_cmdrate[4];
    
GetClientInfo(client"cl_cmdrate"cl_cmdratesizeof(cl_cmdrate));

    new 
Float:tickRate GetTickInterval();
    
latency -= (0.5 StringToInt(cl_cmdrate)) + TICKS_TO_TIME(1.0); // correct latency

    
if (goldSource) {
        
// in GoldSrc we had a different, not fixed tickrate. so we have to adjust
        // Source pings by half a tick to match the old GoldSrc pings.
        
latency -= tickRate 0.5;
    }

    
ping RoundFloat(latency 1000.0); // as msecs
    
ping Math_Clamp(ping51000); // set bounds, dont show pings under 5 msecs
    
    
return ping;
}

stock any:Math_Clamp(any:valueany:minany:max)
{
    
value Math_Min(valuemin);
    
value Math_Max(valuemax);

    return 
value;
}

stock any:Math_Max(any:valueany:max)
{    
    if (
value max) {
        
value max;
    }
    
    return 
value;
}

stock any:Math_Min(any:valueany:min)
{
    if (
value min) {
        
value min;
    }
    
    return 
value;
}

public 
Action OnClientCommand(int clientint args)
{
    
char cmd[16];
    
GetCmdArg(0cmdsizeof(cmd));
 
    if (
StrEqual(cmd"p_faker"))
    {

        return 
Plugin_Handled;
    }
 
    return 
Plugin_Continue;
}

public 
void_OnPluginStart()
{
    
RegConsoleCmd("iping"Command_Test);
}
 
public 
Action Command_Test(int clientint args)
{
    
char arg[128];
    
char full[256];
 
    
GetCmdArgString(fullsizeof(full));
 
    if (
client)
    {
        
PrintToServer("Ur Ping : %N");
    } else {
        
PrintToServer("done Fake ur Ping.");
    }
 
    
PrintToServer("done Fake ur Ping: %s"full);
    
PrintToServer("done Fake ur Ping: %d"args);
    for (
int i=1i<=argsi++)
    {
        
GetCmdArg(iargsizeof(arg));
        
PrintToServer("Argument %d: %s"iarg);
    }
    return 
Plugin_Handled;



Arkarr 04-21-2017 08:44

Re: [CSGO] Fake Ping
 
Pretty sure it's against the Valve policy.

EDIT: Or at least, I can't see anything that will prevent a admin from faking the ping of the bot.

Mc_Daived 04-21-2017 12:34

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Arkarr (Post 2514038)
Pretty sure it's against the Valve policy.

EDIT: Or at least, I can't see anything that will prevent a admin from faking the ping of the bot.

:nono: I don't think it is against a valve policy, because it's simple plugin

Mitchell 04-21-2017 12:40

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Mc_Daived (Post 2514104)
:nono: I don't think it is against a valve policy, because it's simple plugin

Faking information is against valve's policy. We've had this kind of submission several times before.
See: https://forums.alliedmods.net/showth...ight=fake+ping

Mc_Daived 04-21-2017 12:58

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Mitchell (Post 2514108)
Faking information is against valve's policy. We've had this kind of submission several times before.
See: https://forums.alliedmods.net/showth...ight=fake+ping

hhmmmmmmmmmmmm :)

Mc_Daived 04-21-2017 13:08

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Mitchell (Post 2514108)
Faking information is against valve's policy. We've had this kind of submission several times before.
See: https://forums.alliedmods.net/showth...ight=fake+ping

this makes it similar to plugins knifes :(

Zuby24 04-22-2017 04:30

Re: [CSGO] Fake Ping
 
did you try this plugin? because it gave me errors, also in compilation and when i try to load...

L 04/22/2017 - 07:45:04: [SM] Exception reported: Something is missing!
L 04/22/2017 - 07:45:04: [SM] Blaming: ping.smx
L 04/22/2017 - 07:45:04: [SM] Call stack trace:
L 04/22/2017 - 07:45:04: [SM] [0] SetFailState
L 04/22/2017 - 07:45:04: [SM] [1] Line 51, C:\Users\zuby\Documents\scripting\ping.sp::On MapStart
L 04/22/2017 - 07:45:04: [SM] [3] ServerCommandEx
L 04/22/2017 - 07:45:04: [SM] [4] Line 400, /home/builds/sourcemod/linux-1.9/build/plugins/basecommands.sp::Command_Rcon

Mc_Daived 04-22-2017 11:33

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Zuby24 (Post 2514220)
did you try this plugin? because it gave me errors, also in compilation and when i try to load...

L 04/22/2017 - 07:45:04: [SM] Exception reported: Something is missing!
L 04/22/2017 - 07:45:04: [SM] Blaming: ping.smx
L 04/22/2017 - 07:45:04: [SM] Call stack trace:
L 04/22/2017 - 07:45:04: [SM] [0] SetFailState
L 04/22/2017 - 07:45:04: [SM] [1] Line 51, C:\Users\zuby\Documents\scripting\ping.sp::On MapStart
L 04/22/2017 - 07:45:04: [SM] [3] ServerCommandEx
L 04/22/2017 - 07:45:04: [SM] [4] Line 400, /home/builds/sourcemod/linux-1.9/build/plugins/basecommands.sp::Command_Rcon

I'll see where the problem is and resolve this mistake , :up:

Zuby24 04-23-2017 03:16

Re: [CSGO] Fake Ping
 
Quote:

Originally Posted by Mc_Daived (Post 2514315)
I'll see where the problem is and resolve this mistake , :up:

Ok thanks.. I dont care about Valve policy....

cravenge 04-27-2017 11:53

Re: [CSGO] Fake Ping
 
PHP Code:

 g_iPing    FindSendPropOffs("CPlayerResource""sm_iPing"); 

A little extra there. It should be "m_iPing".

PHP Code:

g_iPlayerManager    FindEntityByClassname(MaxClients 1g_szPlayerManager); 

Shouldn't MaxClients + 1 be -1 instead?

Also, I think this should be ANY? instead of just CSGO. Just by looking at the code, it seems to support multiple mods.


All times are GMT -4. The time now is 13:11.

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