Raised This Month: $ Target: $400
 0% 

Radio Gag System


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Admin Commands       
CT_Spawn
Junior Member
Join Date: Apr 2024
Old 04-22-2024 , 11:40   Radio Gag System
Reply With Quote #1

Radio Gag System

Description:
  • This plugin is to silence annoying people who spam radio messages (note that the plugin does not depend on a database, it only works once per map)

Commands Usage:
  • amx_rgag <nick | authid | #userid> (for gag radio spammer by name or steamid or 'userid but use # before userid' )
  • amx_ip_rgag <ip> (for gag radio spammer by ip)
  • amx_unrgag <nick | authid | #userid> (for ungag radio user by name or steamid or 'userid but use # before userid' )
  • amx_ip_unrgag <ip> (for ungag radio user by ip)
Video:


Screenshot:


Attached Thumbnails
Click image for larger version

Name:	screenshot.jpg
Views:	61
Size:	49.0 KB
ID:	204162  
Attached Files
File Type: sma Get Plugin or Get Source (radio_gag.sma - 72 views - 7.5 KB)
File Type: zip cstrike (addons and sounds).zip (27.0 KB, 42 views)

Last edited by CT_Spawn; 04-22-2024 at 11:52.
CT_Spawn is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 04-22-2024 , 23:05   Re: Radio Gag System
Reply With Quote #2

good idea but poorly executed
very hardcoded and i recommend browsing the web api and in this case reading about Trie array...
https://www.amxmodx.org/api
https://forums.alliedmods.net/showthread.php?t=201872
and since youre blocking `STEAM_ID_LAN` and `localhost` where this only happens when youre running a lan server than theres a function that detects just that `is_dedicated_server`
__________________
bigdaddy424 is offline
CT_Spawn
Junior Member
Join Date: Apr 2024
Old 04-23-2024 , 15:38   Re: Radio Gag System
Reply With Quote #3

Quote:
Originally Posted by bigdaddy424 View Post
good idea but poorly executed
very hardcoded and i recommend browsing the web api and in this case reading about Trie array...
https://www.amxmodx.org/api
https://forums.alliedmods.net/showthread.php?t=201872
and since youre blocking `STEAM_ID_LAN` and `localhost` where this only happens when youre running a lan server than theres a function that detects just that `is_dedicated_server`
Thanks for your comment and ideas
But regarding dynamic arrays
I actually intended to work with it, but I changed my mind and put static arrays
Because I didn't trust the plugin_end function
And you know that the server works 24/24 and 7/7
If there is an error in the plugin_end function, the memory will fill up with arrays. This will do more harm than good.

That's why I decided to put static

Detecting the IP using the is_dedicated_server function is a good idea, but I think I will not update it for this reason only.

As for the percentage of STEAM_ID_LAN and others

You are completely wrong, because I have seen cases of some players entering the server with these IDs

Regarding the latter, above all this, this code is a quote from the official admincmd.sma
CT_Spawn is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 04-23-2024 , 21:48   Re: Radio Gag System
Reply With Quote #4

in order to occupy around 1mb of ram memory you need an array of 20-30k entries so its safe to say that memory isnt an excuse not that it ever has been something to consider especially working on mods for games.
the last major update admincmd.sma file has had was when 1.75 was introduced according to some sources and this was in 2007 or 2008. since then there've been minor edits and additions. theres no such cases as players having STEAM_ID_LAN on multiplayer, unless you account for reunion or dproto which is against ToS.
__________________
bigdaddy424 is offline
CT_Spawn
Junior Member
Join Date: Apr 2024
Old 04-24-2024 , 09:06   Re: Radio Gag System
Reply With Quote #5

Quote:
Originally Posted by bigdaddy424 View Post
in order to occupy around 1mb of ram memory you need an array of 20-30k entries so its safe to say that memory isnt an excuse not that it ever has been something to consider especially working on mods for games.
the last major update admincmd.sma file has had was when 1.75 was introduced according to some sources and this was in 2007 or 2008. since then there've been minor edits and additions. theres no such cases as players having STEAM_ID_LAN on multiplayer, unless you account for reunion or dproto which is against ToS.


image link
You get this picture. Don't deny it, I saw it myself, my friend

Last edited by CT_Spawn; 04-27-2024 at 19:45. Reason: edited
CT_Spawn is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-24-2024 , 12:33   Re: Radio Gag System
Reply With Quote #6

PHP Code:
new array_cells[30000
32-bit system:

30000 * 4 = 120000

120000 Bytes -> 0.114 Megabytes

64-bit system:

0.228 Megabytes
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-24-2024 , 12:39   Re: Radio Gag System
Reply With Quote #7

Quote:
Originally Posted by CT_Spawn View Post


image link
You get this picture. Don't deny it, I saw it myself, my friend

I did not understand what you meant by dproto, but if you meant that the server targets “non steam player”, the server definitely targets them. Who is the idiot who opens a server and does not put dproto in it?
First you have no idea what you are doing and you should consider learn more before posting plugins.
Second you should read rules, we do not support non-steam. If people use, we don’t care, but we do not support it so don’t say that kind of things.
Third, no one is idiot for wanting steam only servers, they are cleaner.
__________________
Jhob94 is offline
CT_Spawn
Junior Member
Join Date: Apr 2024
Old 04-28-2024 , 19:35   Re: Radio Gag System
Reply With Quote #8

Quote:
Originally Posted by WATCH_D0GS UNITED View Post
PHP Code:
new array_cells[30000
32-bit system:

30000 * 4 = 120000

120000 Bytes -> 0.114 Megabytes

64-bit system:

0.228 Megabytes
32*32*4=4096 .....(1)
+
39*32*4=4992 ....(2)

(1) + (2) = 9088 Bytes
************************
24 * 60 = 1440 minutes

map time = 10 minutes
1440/10 ======> have 144 map in one day
so
9088 * 144 = 1308672 Bytes = 1.25 mb in one day

so
1.25 * 30 = 37.5 mb in 1 month

so
37.5*12=450 mb

This is just what we calculated on my plugin

So what if we count the other plugins?
Also, the system and the server software, we assume that they both carry 750 MB without taking into account additional other plugins, and I add only my 450 MB program to them.

That means the total is 1.2 GB
Imagine that the server only has 1 GB of RAM


It's strange to see a programmer bragging about memory loss like you

Didn't you study web programming and learn from it that you should do your best to reduce the volume, even if it is small?
CT_Spawn is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 04-28-2024 , 22:46   Re: Radio Gag System
Reply With Quote #9

Quote:
Originally Posted by CT_Spawn View Post


image link
You get this picture. Don't deny it, I saw it myself, my friend
that activity only happens when running a non steam server
Quote:
Originally Posted by CT_Spawn View Post
32*32*4=4096 .....(1)
+
39*32*4=4992 ....(2)

(1) + (2) = 9088 Bytes
************************
24 * 60 = 1440 minutes

map time = 10 minutes
1440/10 ======> have 144 map in one day
so
9088 * 144 = 1308672 Bytes = 1.25 mb in one day

so
1.25 * 30 = 37.5 mb in 1 month

so
37.5*12=450 mb

This is just what we calculated on my plugin

So what if we count the other plugins?
Also, the system and the server software, we assume that they both carry 750 MB without taking into account additional other plugins, and I add only my 450 MB program to them.

That means the total is 1.2 GB
Imagine that the server only has 1 GB of RAM


It's strange to see a programmer bragging about memory loss like you

Didn't you study web programming and learn from it that you should do your best to reduce the volume, even if it is small?
im not sure what you mean about these numbers but youre taking it on extreme levels. my lazy calculations were made using nvault_set on a loop 30000 times and the result came to about 1.5mb
PHP Code:
#include <amxmodx>
#include <nvault>

public plugin_init()
{
    new 
k[MAX_NAME_LENGTH], nvault_open("v")
    for (new 
030000i++)
    {
        for (new 
0MAX_NAME_LENGTHj++)
            
k[j] = random_num(97122)
        
nvault_set(vkNULL_STRING)
        
server_print "%d[%s]"ik
    
}
    
nvault_close(v)

we're going against all odds when we assume banning 30'000 players. daily player base of counter-strike peaks around 15'000 and majority are players who play everyday https://steamdb.info/app/10/charts/
ive been mining steam ids using nvault to save certain values and this has been going on from around 3 years and ive accumulated around 7000 unique players. this includes players who connected to the server by mistake, players having multiple accounts and those using family sharing with friends. now do the math
__________________
bigdaddy424 is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-29-2024 , 12:44   Re: Radio Gag System
Reply With Quote #10

Quote:
Originally Posted by CT_Spawn View Post
32*32*4=4096 .....(1)
+
39*32*4=4992 ....(2)

(1) + (2) = 9088 Bytes
************************
24 * 60 = 1440 minutes

map time = 10 minutes
1440/10 ======> have 144 map in one day
so
9088 * 144 = 1308672 Bytes = 1.25 mb in one day

so
1.25 * 30 = 37.5 mb in 1 month

so
37.5*12=450 mb

This is just what we calculated on my plugin

So what if we count the other plugins?
Also, the system and the server software, we assume that they both carry 750 MB without taking into account additional other plugins, and I add only my 450 MB program to them.

That means the total is 1.2 GB
Imagine that the server only has 1 GB of RAM


It's strange to see a programmer bragging about memory loss like you

Didn't you study web programming and learn from it that you should do your best to reduce the volume, even if it is small?
Who are you mentioning in the end of your comment?

These calculations you did makes no sense man.

PHP Code:
    new steamid[32],ip[39
These variables were created locally inside the public function in your plugin, which means they are created in the moment the function is called.
Their memory is allocated in the moment they are created, and deallocated/deleted/freed as soon as the function execution ends.

All this is handled by your server computer at runtime.

Differently of this, global variables memory usage is kept during all the time your plugin is running and their memory usage does not change during gameplay.

PHP Code:
new global_variable_outside_codeblock
In Small (Pawn) this integer-type variable will occupy 4 bytes in a 32-bit system and 8 bytes in a 64-bit system.

This memory will be released only when the server shuts down.


For example, this is what occurs supposing your function is called every time a player connects:

Using local variables (RAM friendly, CPU expensive)
PHP Code:
public On_Client_Connect(id) {
    
// Creates the variables and allocate their memory as soon as a player connects.
    
new steamid[32],ip[39]

    if(
something(steamid || ip)) {
        
make_something
    
}
    
}   
// Deletes the variables and frees their memory after all the steps are finished. 


Using global variables (RAM expensive, CPU friendly)

PHP Code:
// Creates the variables and allocate their memory once when the plugin is initialized.
//This is outside the code blocks.
new steamid[32],ip[39]

public 
On_Client_Connect(id) {

    if(
something(steamid || ip)) {
        
make_something
    
}
    

This code will execute faster, although the memory used by the variables will not be freed.
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com

Last edited by WATCH_D0GS UNITED; 04-29-2024 at 12:47. Reason: {
WATCH_D0GS UNITED is offline
Reply



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 12:48.


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