AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help setting maxspeed (https://forums.alliedmods.net/showthread.php?t=170550)

winds 10-26-2011 10:24

Help setting maxspeed
 
Hey guys,
I am trying to make a menu for special rounds and I have this code:

PHP Code:

public logevent_round_start()
{
    static 
iMaxPlayers;
    if ( !
iMaxPlayers )
        
iMaxPlayers get_maxplayers();

    for(new 
id 1id <= get_maxplayers(); id++) 
    {
        if ( 
SpecialDay == )
        {
            
server_cmd("sv_maxspeed 1000");
            
set_user_maxspeed(11000.0);
            
set_hudmessage();
            
show_hudmessage(0"This is a speed round");
            
b_Speed false
            b_SpeedWeapon 
true
            SpecialDay 
0
        


and also

PHP Code:

public CurWeapon(id)
{
    if(
b_SpeedWeapon == true);
    {
        
set_user_maxspeed(id1000.0);
    }


Everything works except actually changing the players speed. It doesn't matter if I don't change weapons or I do, I stay the same speed. What am I doing wrong?
Also, how do I change it so it gives everyone maxspeed? I tried setting that to set_user_maxspeed(0, 1000.0) with a 0 instead of 1 but that didn't work at all.
Thanks!

Evaldas.Grigas 10-26-2011 10:29

Re: Help setting maxspeed
 
You set only max speed. You need to set player speed.

EDIT: I don't know maybe I am wrong.

Bugsy 10-26-2011 10:31

Re: Help setting maxspeed
 
http://forums.alliedmods.net/showpos...2&postcount=11

winds 10-26-2011 16:27

Re: Help setting maxspeed
 
Hmm, i'm not quite sure I understand what's happening in that plugin :(

ConnorMcLeod 10-26-2011 18:21

Re: Help setting maxspeed
 
Your way is fine, Bugsy way is more accurate but it won't help with your problem.
Your problem is that clients cvars limit clients maxspeed. Those cvars are cl_forwardspeed, cl_backspeed and cl_sidespeed. Changing them without asking clients permission is considerated as slowhacking and is not allowed.

Bugsy 10-26-2011 18:30

Re: Help setting maxspeed
 
If you set speed too high, does the value get clamped or just ignored? I assumed it was working but getting reset on him frequently that's why I was hinting towards using ResetMaxSpeed for setting speed.

winds 10-26-2011 19:05

Re: Help setting maxspeed
 
Hm, when I put this in it, it still doesn't work.

PHP Code:

if ( SpecialDay == )
        {
            
server_cmd("sv_maxspeed 700");
            
set_user_maxspeed(1700.0);
            
client_cmd(id"cl_forwardspeed 700");
            
client_cmd(id"cl_sidespeed 700");
            
client_cmd(id"cl_backspeed 700");
            
set_hudmessage();
            
show_hudmessage(0"This is a speed round");
            
b_Speed false
            b_SpeedWeapon 
true
            SpecialDay 
0
        



F0RCE 10-26-2011 20:14

Re: Help setting maxspeed
 
You speed is still 320? [MAX]

You are setting the speed on server side.
Why don't You set it on client side too?

PHP Code:

client_cmd(id"sv_maxspeed 700"); 


winds 10-26-2011 20:49

Re: Help setting maxspeed
 
sv_maxspeed as a client command? I think thats a server side command, thats what the sv_ stands for. Correct me if i'm wrong though.

I tried already setting the client command cl_forwardspeed, sidespeed, and backspeed to 700, but the effect was still the same. No change in speed :(

Bugsy 10-26-2011 21:11

Re: Help setting maxspeed
 
Did you search the forums yet because there are a lot of threads on the topic, you can even look at an existing plugin to see how its done and maybe it'll help solve your problem.

In that plugin thread:
Code:

Make sure that server cvars sv_maxspeed and sv_maxvelocity are set in
consequence to the plugin settings. Also, you have to alter client cvars
cl_forwardspeed, cl_backspeed and cl_sidespeed if you want to have more than 400
as maxspeed.



All times are GMT -4. The time now is 14:20.

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