AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Codding help.Function ignored. (https://forums.alliedmods.net/showthread.php?t=163734)

Menethil 08-02-2011 15:43

Codding help.Function ignored.
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "Anti Developer"
#define VERSION "1.0"
#define AUTHOR "NeuTroN & TCO"

#define TASK_CHECK 912651

new FramesPer[33], CurFps[33], Fps[33];

new cvar_Fps;
new Float:GameTime[33];


public plugin_init()
{
    register_plugin("PLUGIN", "VERSION","AUTHOR");
   
    cvar_Fps = register_cvar("amx_developer_fps_max","120");
   
    register_forward(FM_PlayerPreThink,"fwdPlayerPreThink");
}

public fwdPlayerPreThink(id)
{
    if(is_user_alive(id))
    {
        GameTime[id] = get_gametime();
           
        if(FramesPer[id] >= GameTime[id])
            Fps[id] += 1;
        else
        {
            FramesPer[id]    +=1;
            CurFps[id]    = Fps[id];
            Fps[id]        = 0;
        }

        if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {
            new name[32],steamid[32];
            get_user_name(id,name,31);

            client_print(0,print_chat,"[Developer] %s<%s> detected with FPS higher then allowd.Scaning started",name,steamid,CurFps[id]);
            set_task(5.0, "scan", TASK_CHECK, _, _, "a", 2)
            user_kill(id)
            client_print(0,print_chat,"[Developer] %s<%s> slayed for playing with  %i FPS",name,steamid,CurFps[id]);       
        }       
    }
}

public scan(id)
{
    id -= 912651   
    new name[32],steamid[32];
    get_user_name(id,name,31);
    get_user_authid(id,steamid,31);
   
   
    if(is_user_alive(id))
    {
        GameTime[id] = get_gametime();
           
        if(FramesPer[id] >= GameTime[id])
            Fps[id] += 1;
        else
        {
            FramesPer[id]    +=1;
            CurFps[id]    = Fps[id];
            Fps[id]        = 0;
        }

        if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {
            client_print(0,print_chat,"%s - Scan Status: %d FPS", name, CurFps[id])
        }
               
        if(CurFps[id] < get_pcvar_num(cvar_Fps))
        {
            client_print(0,print_chat,"%s - Fps normal  status: lower then 101 ", name)
        }
    }
}     
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

This is not working quite good.
No compilling errors.
But i feel that task is not readed .. no client_prints printed on chat from the "scan" function.
And also i want if anyone is kind and sweet to implement a function that slay the player when fps > then the cvar not just slay after the task .. there is no point.

If there is no way to make this task run 3 times ... that means to scan the player for fps 3 times and slay after all 3 scans found fps > the the cvar
Make it just once...

If there is anyone can help me to clean this kz / hns cheaters PM. I have a private plugin with an similar function.. to complex for me.

hornet 08-03-2011 00:59

Re: Codding help.Function ignored.
 
PHP Code:

set_task(5.0"scan"TASK_CHECK__"a"2

:arrow:

PHP Code:

set_task(5.0"scan"id TASK_CHECK__"a"2


Menethil 08-03-2011 02:52

Re: Codding help.Function ignored.
 
Ok now its look like this, and i got the error the function scan is undefinited.
Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "Anti Developer"
#define VERSION "1.0"
#define AUTHOR "NeuTroN & TCO"

#define TASK_CHECK 912651

new FramesPer[33], CurFps[33], Fps[33];

new cvar_Fps;
new Float:GameTime[33];


public plugin_init()
{
    register_plugin("PLUGIN", "VERSION","AUTHOR");
   
    cvar_Fps = register_cvar("amx_developer_fps_max","120");
   
    register_forward(FM_PlayerPreThink,"fwdPlayerPreThink");
}

public fwdPlayerPreThink(id)
{
    if(is_user_alive(id))
    {
        GameTime[id] = get_gametime();
           
        if(FramesPer[id] >= GameTime[id])
            Fps[id] += 1;
        else
        {
            FramesPer[id]    +=1;
            CurFps[id]    = Fps[id];
            Fps[id]        = 0;
        }

        if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {
            new name[32],steamid[32];
            get_user_name(id,name,31);

            client_print(0,print_chat,"[Developer] %s<%s> detected with FPS higher then allowd.Scaning started",name,steamid,CurFps[id]);
            set_task(5.0, "scan", id + TASK_CHECK, _, _, "a", 2) 
    }
}

public scan(id)
{
    id -= 912651   
    new name[32];
    get_user_name(id,name,31);

    if(is_user_alive(id))
    {
    if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {
    client_print(0,print_chat,"%s - Scan Status: %d FPS", name, CurFps[id])
        }
    }
    if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {   
            user_kill(id)
        }
            client_print(0,print_chat,"[Developer] %s slayed for playing with  %i FPS",name,CurFps[id]);           
    }     
}


Exolent[jNr] 08-03-2011 03:18

Re: Codding help.Function ignored.
 
You deleted a closing brace after the set_task() line.

Menethil 08-03-2011 04:16

Re: Codding help.Function ignored.
 
Okey dokey. Now its working but there still be some problems
Its spamming the first client_print .. and after the task complete spamming the last client_print .. and no user_kill(id) user.

gamer99 08-03-2011 04:38

Re: Codding help.Function ignored.
 
Code:


public scan(id)
{
    id -= 912651   
    new name[32];
    get_user_name(id,name,31);

    if(is_user_alive(id))
    {
    if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {
    client_print(0,print_chat,"%s - Scan Status: %d FPS", name, CurFps[id])
        }
    }
    if(CurFps[id] > get_pcvar_num(cvar_Fps))
        {   
            user_kill(id)
        }
            client_print(0,print_chat,"[Developer] %s slayed for playing with  %i FPS",name,CurFps[id]);           
    }     
}

why the braces are not matching ?

Quote:

Its spamming the first client_print .. and after the task complete spamming the last client_print
remove the client print if you don't want

Why do you need scan function if you are detecting in the prethink itself ?
Also why do you need engine and fakemeta both ?

Menethil 08-03-2011 05:25

Re: Codding help.Function ignored.
 
Ok i cleaned the code a bit. Now its working.. but not as i want.
Im wondering how to detect if developer 1 is enabled. And if dev 1 is detected to start my set_task with curFps and slay after that :P.
Any ideas ?

P.S: I have this code for detecting dev. But its incomplete i mean have just to set the "new" and some others..
If anyone can use this
Code:

public fwdPlayerPreThink_Pre(id)
{
    static Float:last_check[33], Float:game_time;
    static frames[33];
    if(is_user_connected(id))
    {
        if(get_pcvar_num(check_dev) == 1)
        {
            game_time = get_gametime();
            if(game_time - last_check[id] > 1.0)
            {
                if(checking_player[id] == 1)
                {
                    console_cmd(id, "fps_max 1000")
                    if(check_dev_wait[id] == 0)
                    {
                        // if the player has more than 'check_fpslimit cvar' fps he will be using developer; frames[id] will be 100 on 99.99 fps
                        checking_dev_frames[id] = frames[id]-1
                        if(frames[id] > get_pcvar_num(check_fpslimit))
                        {
                            client_cmd(id, "snapshot")
                            developer_illegal_detected[id]++
                        }
                        check_dev_wait[id] = 1
                    }
                }
                else
                    console_cmd(id, "developer 0;fps_max 101")
               
                frames[id] = 0
                last_check[id] = game_time;
            }
            frames[id]++;
        }
    }
}

instead mine and on the set task to detect the CurFps[id] and slay when its detected >

gamer99 08-03-2011 05:35

Re: Codding help.Function ignored.
 
Its being detected on the basis that when you use developer 1 sometimes you get more than 100 FPS ... so if you are getting more than 100 FPS that menas you are using developer 1

gamer99 08-03-2011 05:39

Re: Codding help.Function ignored.
 
why don't you are not using the unaltered version of the plugin ?

Also calulating so much thing in prethink is not a good idea .
You just take one global variable like

g_dFpsCount[33]

and put

g_dFpsCount[id]++

in prethink and start one more task each second which will check how much value the variable g_dFpsCount holds after one secods and will compare it with the thresold ( also it will reset it to 0 )

In this was it will require less resource and will be a better developer detector .. Hope you the idea :)

gamer99 08-03-2011 05:40

Re: Codding help.Function ignored.
 
P.S.

Quote:

console_cmd(id, "developer 0;fps_max 101")

Quote:

console_cmd(id, "fps_max 1000")

These are actually slowhacking ... so better you read the rules first :)


All times are GMT -4. The time now is 03:24.

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