Raised This Month: $32 Target: $400
 8% 

Solved Lock players.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thEsp
BANNED
Join Date: Aug 2017
Old 01-03-2019 , 13:31   Lock players.
Reply With Quote #1

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.

Last edited by thEsp; 01-04-2019 at 05:18. Reason: Solved
thEsp is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-03-2019 , 13:48   Re: Lock players.
Reply With Quote #2

cs_maxspeed_api
__________________








CrazY. is offline
thEsp
BANNED
Join Date: Aug 2017
Old 01-03-2019 , 13:52   Re: Lock players.
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
cs_maxspeed_api
Can you please include more information?!
thEsp is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-03-2019 , 14:14   Re: Lock players.
Reply With Quote #4

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
__________________








CrazY. is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 01-03-2019 , 14:22   Re: Lock players.
Reply With Quote #5

Quote:
Originally Posted by thEsp View Post
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;
__________________

Last edited by eat1k; 01-03-2019 at 14:23.
eat1k is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-03-2019 , 14:32   Re: Lock players.
Reply With Quote #6

Only change max speed won't affect anything if you don't call reset_maxspeed.
__________________









Last edited by CrazY.; 01-03-2019 at 14:35.
CrazY. is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 01-03-2019 , 15:24   Re: Lock players.
Reply With Quote #7

Change max_speed + block resetmaxspeed. That's all.
__________________
eat1k is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-03-2019 , 21:14   Re: Lock players.
Reply With Quote #8

I've used the FL_FROZEN method before and it works well.
__________________
fysiks is online now
thEsp
BANNED
Join Date: Aug 2017
Old 01-04-2019 , 05:17   Re: Lock players.
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
I've used the FL_FROZEN method before and it works well.
Thanks man, this really works.
thEsp 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 03:50.


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