AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with slay after speed > 2x (https://forums.alliedmods.net/showthread.php?t=9151)

srx 01-07-2005 13:03

Help with slay after speed > 2x
 
Hi, im not quite sure f its possible, but can never know the limits of amx scripting. would it be possible to slay each person that reaches a forward speed of say 2x. im not quite sure what the max speed is thats possible ingame. possibly around 1.3? just wondering as it would stop speed hacking on our servers.

an example would be great thanks.

regards srx

XxAvalanchexX 01-07-2005 15:59

Well, this code would be a start:

Code:
#include <amxmodx> #include <engine>  public check_speed(id) {    if(is_user_alive(id)) {      if(get_speed(id) > get_cvar_num("sv_maxspeed")) {        server_cmd("amx_slay #%d",id);      }    }  }

However, deciding when to call it would be tricky. You could call it on a client prethink, but it might cause a bit of lag. You could set a task for every player that is run every X seconds, but that might not catch everyone.

srx 01-07-2005 17:30

mmmm i see. how laggy do you think it would get say checking every 5 - 10 seconds? seems as a good idea may not be quite as good any more >.<

thanks for your help avalanche

XxAvalanchexX 01-07-2005 20:00

Code:
#include <amxmodx> #include <engine> public check_speed(id) {    if(is_user_alive(id) && get_cvar_num("sv_speedcheck") >= 1) {      if(get_speed(id) > get_cvar_num("sv_maxspeed")) {        server_cmd("amx_slay #%d",id);      }    }    set_task(get_cvar_float("sv_speedcheckrate"),"check_speed",id); } public client_putinserver(id) {   set_task(get_cvar_float("sv_speedcheckrate"),"check_speed",id); } public client_disconnect(id) {   remove_task(id); } public plugin_init() {   register_plugin("Speed Slayer","0.10","Avalanche");   register_cvar("sv_speedcheck","1");   register_cvar("sv_speedcheckrate","5.0"); }

This will theoretically work, but it hasn't been tested. sv_speedcheck (0 or 1) will turn the plugin on or off, and sv_speedcheckrate will determine the rate at which it checks.


All times are GMT -4. The time now is 19:22.

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