AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   small edit please. (https://forums.alliedmods.net/showthread.php?t=327149)

Foxa 09-05-2020 18:11

Re: small edit please.
 
Why is your code a .dat file??

Of course everyone gets slayed, cause he changed the task delay from 1.0 to 5.0 which results in players having (about) "500 fps", you can't reset a variable that counts something PER SECOND every 5 seconds..

PHP Code:

set_task(5.0"ShowFps",id+DEVELOPER_OFFSET__"b"); 

->
PHP Code:

set_task(1.0"ShowFps",id+DEVELOPER_OFFSET__"b"); 

This
PHP Code:

if(get_user_flags(id) & ADMIN_RCON)
                
ChatColor(0"Player !g%s!t slayed for using more fps than allowed(100)",name

does not do what he asked, that prints a message to EVERYONE (since the index is set to 0) when someone with ADMIN_RCON level had been slayed

This is just ridiculous..
PHP Code:

else
                
ChatColor(id"!g%s!t slayed for using more fps than allowed(100)",name)
                
ChatColor(id"!g%s!t slayed for using more fps than allowed(100)",name)
                
ChatColor(id"!g%s!t slayed for using more fps than allowed(100)",name)
                
ChatColor(id"!g%s!t slayed for using more fps than allowed(100)",name)
                
ChatColor(id"!g%s!t slayed for using more fps than allowed(100)",name


Stefanos 09-05-2020 18:39

Re: small edit please.
 
aj mi ti uradi molim te xd <3

Stefanos 09-06-2020 00:05

Re: small edit please.
 
anyone help me fast please...

Foxa 09-06-2020 12:40

Re: small edit please.
 
Quote:

Originally Posted by Stefanos (Post 2716830)
aj mi ti uradi molim te xd <3

The plugin doesn't count frames correctly anyways, something like this would be better, although it can still result in false positives

PHP Code:

#include <amxmodx>

#include <fakemeta>
#include <colorchat>
#include <cstrike>

#pragma semicolon true

new const    PLUGIN[]    =    "My",
        
VERSION[]    =    "Name",
        
AUTHOR[]    =    "Jeff";
        
#define MAX_PLAYERS     32
#define DELAY         1.0
#define DELAY_DO    5.0
#define TASKID_DO     312

new g_iFPS[MAX_PLAYERS+1];
new 
g_iPunishFPS[MAX_PLAYERS+1];
new 
cvFPSLimit;
new 
cvSlay;

public 
plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_PlayerPreThink"fwdPlayerPreThink");
    
    
cvFPSLimit=register_cvar("fps_limit""101");
    
cvSlay=register_cvar("fps_slay""1");
}

public 
fwdPlayerPreThink(id){
    static 
FloatfgametimeFloatfcountnext[MAX_PLAYERS+1], iframes[MAX_PLAYERS+1];
    
    if(
fcountnext[id]>=(fgametime=get_gametime())){
        
iframes[id]++;
        return 
FMRES_IGNORED;
    }
    
    
g_iFPS[id]=iframes[id];
    if(
g_iFPS[id]>get_pcvar_num(cvFPSLimit) && is_user_alive(id) && !task_exists(id+TASKID_DO) && cs_get_user_team(id)==CS_TEAM_CT){
        
g_iPunishFPS[id]=g_iFPS[id];
        
set_task(DELAY_DO"task_DoWhatever"id+TASKID_DO);
    }
    
    
iframes[id]=0;
    
    
fcountnext[id]=fgametime+DELAY;
    return 
FMRES_IGNORED;
}

public 
task_DoWhatever(const taskid){
    new 
id=taskid-TASKID_DO;
    new 
name[32];
    
get_user_name(idnamecharsmax(name));
    if(
get_pcvar_num(cvSlay)!=0){
        
ColorChat(idRED"You are slayed for using more FPS than allowed (type fps_max 100 in console)");
        
user_silentkill(id);
    }
    
    new 
players[MAX_PLAYERS], num;
    
get_players(playersnum);
    for(new 
i=0i<numi++){
        if(
get_user_flags(players[i]) & ADMIN_RCON)
            
ColorChat(players[i], RED"%s - FPS: %d"nameg_iPunishFPS[id]);
    }


colorchat.inc
PHP Code:

/* Fun functions
*
* by Numb
*
* This file is provided as is (no warranties).
*/


enum Color
{
    
NORMAL 1// clients scr_concolor cvar color
    
GREEN// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}

new 
TeamName[][] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
NORMAL// clients scr_concolor cvar color
        
{
            
message[0] = 0x01;
        }
        case 
GREEN// Green
        
{
            
message[0] = 0x04;
        }
        default: 
// White, Red, Blue
        
{
            
message[0] = 0x03;
        }
    }

    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';

    static 
teamColorChangeindexMSG_Type;
    
    if(
id)
    {
        
MSG_Type MSG_ONE;
        
index id;
    } else {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    }
    
    
team get_user_team(index);
    
ColorChange ColorSelection(indexMSG_Typetype);

    
ShowColorMessage(indexMSG_Typemessage);
        
    if(
ColorChange)
    {
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[])
{
    
message_begin(typeget_user_msgid("SayText"), _id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[])
{
    
message_begin(typeget_user_msgid("TeamInfo"), _id);
    
write_byte(id);
    
write_string(team);
    
message_end();

    return 
1;
}

ColorSelection(indextypeColor:Type)
{
    switch(
Type)
    {
        case 
RED:
        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:
        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:
        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }

    return 
0;
}

FindPlayer()
{
    static 
i;
    
= -1;

    while(
<= get_maxplayers())
    {
        if(
is_user_connected(++i))
        {
            return 
i;
        }
    }

    return -
1;



Cirovic 09-06-2020 14:28

Re: small edit please.
 
it bugs, player got slayed and i got message that they had 89 fps and still got slayed.. can we try on my plugin edit what i wanted?

Foxa 09-06-2020 20:28

Re: small edit please.
 
Ah yes, it shows different FPS since the task if created once the player HAS more than the said FPS and it takes 5 seconds to execute the task, hence the number of frames changes.
Should work now (i edited the code above), I also told you that the plugin you were using displays wrong number of frames A LOT
Code:

99
99
110
99
99
109
99
99
99
109


Cirovic 09-06-2020 20:35

Re: small edit please.
 
okay i will test now, can you add message for player that got slayed why he got slayed

* You are slayed for using more FPS than allowed (type fps_max 100 in console)

Supremache 09-06-2020 20:40

Re: small edit please.
 
Quote:

Originally Posted by Cirovic (Post 2716967)
okay i will test now, can you add message for player that got slayed why he got slayed

* You are slayed for using more FPS than allowed (type fps_max 100 in console)

I dont know why you are important about this plugin and you can add simple plugin for replace 100 fps to all players automatically

Cirovic 09-06-2020 20:43

Re: small edit please.
 
there are guardians that does not allow for server to change players settings :/

Foxa 09-06-2020 20:45

Re: small edit please.
 
Quote:

Originally Posted by Cirovic (Post 2716967)
okay i will test now, can you add message for player that got slayed why he got slayed

* You are slayed for using more FPS than allowed (type fps_max 100 in console)

Done

Quote:

Originally Posted by Supremache (Post 2716968)
I dont know why you are important about this plugin and you can add simple plugin for replace 100 fps to all players automatically

Um... slowhacking??


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

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