AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   variable movement speed (https://forums.alliedmods.net/showthread.php?t=331519)

strikevz 03-24-2021 07:00

variable movement speed
 
heya!
I need a plugin which gives the admins a cmd to modify all players' speed to a custom value, from 0 to 1000 (I remember default is 250 :?). the found plugins so far are buggy or can't change the speed of steam players (console cmd spamming).

thank you so much

OciXCrom 03-24-2021 09:31

Re: variable movement speed
 
You can't force modify player's cvars. Slowhacking is not allowed.
The best you can do is instruct them to do so on their own with a friendly message.

strikevz 03-24-2021 10:01

Re: variable movement speed
 
it's not about slowhacking, I want to give all players speed, this is the point of the gameplay, as in soccerjam (turbo) or surf.

OciXCrom 03-24-2021 10:09

Re: variable movement speed
 
If you want to give speed, you would use AMXX's built-in functions instead of modifying their settings.
Give an example of such a "buggy plugin that doesn't work".

strikevz 03-24-2021 11:04

Re: variable movement speed
 
https://forums.alliedmods.net/showthread.php?p=461931

tried this one. steam on players with protected cs take endless errors in console when I enable the speed (including me), causing overflood
so I all want to do is to increase everyone's speed, how do I do that by using AMXX's built-in functions, as you said?

OciXCrom 03-24-2021 11:17

Re: variable movement speed
 
amx_speed <player> <speed amount|reset>

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <hamsandwich> #tryinclude <cromchat> #if !defined _cromchat_included     #error "cromchat.inc" is missing in your "scripting/include" folder. Download it from: "https://amxx-bg.info/inc/" #endif #define MAX_NAME_LENGTH 32 #if !defined MAX_PLAYERS const MAX_PLAYERS = 32 #endif const Float:SPEED_DEFAULT = -120.9 new Float:g_fSpeed[MAX_PLAYERS + 1] = { SPEED_DEFAULT, ... } public plugin_init() {     register_plugin("Change Speed Command", "1.0", "OciXCrom")     register_concmd("amx_speed", "Cmd_Speed", ADMIN_SLAY, "<player> <speed amount|reset>")     RegisterHam(Ham_CS_Player_ResetMaxSpeed, "player", "OnResetMaxSpeed", 1) } public OnResetMaxSpeed(id) {     if(g_fSpeed[id] != SPEED_DEFAULT)     {         set_user_maxspeed(id, g_fSpeed[id])     } } public client_putinserver(id) {     g_fSpeed[id] = SPEED_DEFAULT } public Cmd_Speed(id, iLevel, iCid) {     if(!cmd_access(id, iLevel, iCid, 3))     {         return PLUGIN_HANDLED     }     new szPlayer[MAX_NAME_LENGTH]     read_argv(1, szPlayer, charsmax(szPlayer))     new iPlayer = cmd_target(id, szPlayer, CMDTARGET_ALLOW_SELF|CMDTARGET_OBEY_IMMUNITY)     if(!iPlayer)     {         return PLUGIN_HANDLED     }     new szName[MAX_NAME_LENGTH], szName2[MAX_NAME_LENGTH], szAmount[8]     get_user_name(id, szName, charsmax(szName))     get_user_name(iPlayer, szName2, charsmax(szName2))     read_argv(2, szAmount, charsmax(szAmount))     if(equali(szAmount, "reset"))     {         g_fSpeed[iPlayer] = SPEED_DEFAULT         ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, iPlayer)         CC_LogMessage(0, _, "ADMIN &x03%s &x01reset &x03%s&x01's speed", szName, szName2)     }     else     {         g_fSpeed[iPlayer] = str_to_float(szAmount)         OnResetMaxSpeed(iPlayer)         CC_LogMessage(0, _, "ADMIN &x03%s &x01set &x04%s speed &x01on &x03%s", szName, szAmount, szName2)     }     return PLUGIN_HANDLED }

strikevz 03-24-2021 11:41

Re: variable movement speed
 
Compiled it successfully but it doesn't work. The command works but doesn't modify my speed. I'm using the last version of reHLDS

JocAnis 03-24-2021 13:38

Re: variable movement speed
 
OciXCrom seems correct, maybe this could be the issue (pre-post hook):

Code:

RegisterHam(Ham_CS_Player_ResetMaxSpeed, "player", "OnResetMaxSpeed")
->
RegisterHam(Ham_CS_Player_ResetMaxSpeed, "player", "OnResetMaxSpeed", 1 )


OciXCrom 03-24-2021 13:41

Re: variable movement speed
 
I mixed up id and iPlayer. Check now, I edited my code.

Try what JocAnis said if it doesn't work but I'm pretty sure it doesn't have to be post. Gonna check later what I use in my plugins.

If it still doesn't work, check your error logs. If there aren't any, then you have some terrible plugin that's overwriting it.

Natsheh 03-24-2021 13:46

Re: variable movement speed
 
You can increase any player speed by increasing their velocity....
But you need several checks for this method its kind hacky way.


All times are GMT -4. The time now is 17:36.

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