|
Member
Join Date: Nov 2018
Location: Croatia
|

09-06-2020
, 12:40
Re: small edit please.
|
#13
|
Quote:
Originally Posted by Stefanos
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(PLUGIN, VERSION, AUTHOR); register_forward(FM_PlayerPreThink, "fwdPlayerPreThink"); cvFPSLimit=register_cvar("fps_limit", "101"); cvSlay=register_cvar("fps_slay", "1"); }
public fwdPlayerPreThink(id){ static Float: fgametime, Float: fcountnext[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(id, name, charsmax(name)); if(get_pcvar_num(cvSlay)!=0){ ColorChat(id, RED, "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(players, num); for(new i=0; i<num; i++){ if(get_user_flags(players[i]) & ADMIN_RCON) ColorChat(players[i], RED, "%s - FPS: %d", name, g_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(id, Color: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], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server. message[192] = '^0';
static team, ColorChange, index, MSG_Type; if(id) { MSG_Type = MSG_ONE; index = id; } else { index = FindPlayer(); MSG_Type = MSG_ALL; } team = get_user_team(index); ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message); if(ColorChange) { Team_Info(index, MSG_Type, TeamName[team]); } }
ShowColorMessage(id, type, message[]) { message_begin(type, get_user_msgid("SayText"), _, id); write_byte(id) write_string(message); message_end(); }
Team_Info(id, type, team[]) { message_begin(type, get_user_msgid("TeamInfo"), _, id); write_byte(id); write_string(team); message_end();
return 1; }
ColorSelection(index, type, Color:Type) { switch(Type) { case RED: { return Team_Info(index, type, TeamName[1]); } case BLUE: { return Team_Info(index, type, TeamName[2]); } case GREY: { return Team_Info(index, type, TeamName[0]); } }
return 0; }
FindPlayer() { static i; i = -1;
while(i <= get_maxplayers()) { if(is_user_connected(++i)) { return i; } }
return -1; }
Last edited by Foxa; 09-07-2020 at 05:07.
|
|