Raised This Month: $ Target: $400
 0% 

small edit please.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 09-06-2020 , 12:40   Re: small edit please.
Reply With Quote #13

Quote:
Originally Posted by Stefanos View Post
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;


Last edited by Foxa; 09-07-2020 at 05:07.
Foxa is offline
 



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 09:01.


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