AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Lock players. (https://forums.alliedmods.net/showthread.php?t=313273)

thEsp 01-03-2019 13:31

Lock players.
 
Hello peeps, I want to make an plugin which stops users/players for moving (For obvious reasons). And this is code Im using, It compiles but doesn't work as expected.
Code:

public LockPlayer(id)
{
        engfunc(EngFunc_SetClientMaxspeed, id, 0.0)
        set_pev(id, pev_maxspeed, 0.0);
}

Thanks in advance :).


Edit: I searched for "cs_maxspeed_api" (as idea of CrazY.) and included it on plugin. But the compiler returns an error "fatal error 100: cannot read from file: "cs_maxspeed_api_const" but I added
Code:

#include <cs_maxspeed_api>
#include <cs_maxspeed_api_const>
#include <cs_maxspeed_api_stocks>

and still doesn't works.

CrazY. 01-03-2019 13:48

Re: Lock players.
 
cs_maxspeed_api

thEsp 01-03-2019 13:52

Re: Lock players.
 
Quote:

Originally Posted by CrazY. (Post 2632620)
cs_maxspeed_api

Can you please include more information?!

CrazY. 01-03-2019 14:14

Re: Lock players.
 
It's an API of Zombie Plague 5.0. You got the error because it's a third party plugin, it's not included in default amxx package.

Download the zp_plugin_50.zip, compile the cs_maxspeed_api and enable it in plugins.ini. After that, include the cs_maxspeed_api in your plugin and set user max speed to 1.0 (cs_set_player_maxspeed(player, 1.0)). You should call it only once, not in client_PreThink.

https://forums.alliedmods.net/showthread.php?t=72505

eat1k 01-03-2019 14:22

Re: Lock players.
 
Quote:

Originally Posted by thEsp (Post 2632614)
Hello peeps, I want to make an plugin which stops users/players for moving (For obvious reasons). And this is code Im using, It compiles but doesn't work as expected.
Code:
public LockPlayer(id) {     engfunc(EngFunc_SetClientMaxspeed, id, 0.0)     set_pev(id, pev_maxspeed, 0.0); }

Why are you using the same twice? Use set_pev(id, pev_maxspeed, 0.0).
Is it not working according to you why? Because when you switch to another weapon your speed resets? In that case you need to do for example this:

Code:
new bool:g_bHasSpeed[MAX_PLAYERS+1]; public LockPlayer(id) {     g_bHasSpeed[id] = true;     set_pev(id, pev_maxspeed, 0.0); }

And then block reset speed (RG_CBasePlayer_ResetMaxSpeed for example in ReAPI) checking if the player has speed:
Code:
if(g_bHasSpeed[id])     return HC_SUPERCEDE; return HC_CONTINUE;

CrazY. 01-03-2019 14:32

Re: Lock players.
 
Only change max speed won't affect anything if you don't call reset_maxspeed.

eat1k 01-03-2019 15:24

Re: Lock players.
 
Change max_speed + block resetmaxspeed. That's all.

fysiks 01-03-2019 21:14

Re: Lock players.
 
I've used the FL_FROZEN method before and it works well.

thEsp 01-04-2019 05:17

Re: Lock players.
 
Quote:

Originally Posted by fysiks (Post 2632708)
I've used the FL_FROZEN method before and it works well.

Thanks man, this really works. :)


All times are GMT -4. The time now is 07:38.

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