Raised This Month: $51 Target: $400
 12% 

Team/player speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
russy
Senior Member
Join Date: Sep 2010
Old 10-16-2010 , 12:52   Team/player speed
Reply With Quote #1

whats wrong with this code? it wont increase terrosit speed eventhough i get no warnings or errors for this code

PHP Code:
public Action:Event_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));    
        if( 
GetClientTeamclient ) == CS_TEAM_T )
        {
        
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"1.1);
        }
    
StripAndGiveclient );

russy is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 10-16-2010 , 13:02   Re: Team/player speed
Reply With Quote #2

That seems to be correct, but a problem with modifying the speed is a number of other factors can override it, losing your speed. The only solution is to either create a timer and reapply it every x seconds, or run it in OnGameFrame and set the speed if it's not equal to default (1.0).
__________________
thetwistedpanda is offline
russy
Senior Member
Join Date: Sep 2010
Old 10-16-2010 , 13:24   Re: Team/player speed
Reply With Quote #3

so something like this?

PHP Code:
public Action:OnGameFrame(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));    
        if( 
GetClientTeamclient ) == CS_TEAM_T )
        {
        
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"1.1);
        }

russy is offline
russy
Senior Member
Join Date: Sep 2010
Old 10-16-2010 , 16:07   Re: Team/player speed
Reply With Quote #4

well it does work but it also causes everything else not to work lol
russy is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 10-16-2010 , 16:10   Re: Team/player speed
Reply With Quote #5

Uhm, no, not like that. You'd have to do something like:
PHP Code:
public OnGameFrame()
{
        for(new 
1<= MaxClientsi++)
        {
            
//Strongly advised you create an array and manually monitor the client's team,
            // rather than calling this native every frame. I.e., in player_team, 
            // g_iTeam[client] = <their new team>. Then Check g_iTeam[client] vs CS_TEAM_T
            
if (IsClientInGame(i) && GetClientTeam(i) == CS_TEAM_T)
                if (
GetEntPropFloat(iProp_Data"m_flLaggedMovementValue") == 1.0)
                    
SetEntPropFloat(iProp_Data"m_flLaggedMovementValue"1.1);
        }

I'm running a similar setup on my DeathRun server for my RTD plugin, with several other calls in OnGameFrame without a performance impact, but you always want to be careful doing anything here. Optimized code will be your friend, to that end, I added a suggestion as to how to optimized the code by adding an array and monitoring the client's team, rather than using that native.
__________________

Last edited by thetwistedpanda; 10-16-2010 at 16:15.
thetwistedpanda is offline
russy
Senior Member
Join Date: Sep 2010
Old 10-16-2010 , 16:55   Re: Team/player speed
Reply With Quote #6

i'll see about susing arrays later but for now i think i'll use this for the time being rather than takeing hours to learn arrays XD thanks
russy is offline
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 10-17-2010 , 20:36   Re: Team/player speed
Reply With Quote #7

m_flLaggedMovementValue doesn't increase the speed. It simulates lag and the server teleports the player to fix. It won't show any speed changes but the player actually goes faster (In a buggy way, fall faster to). The recommended way is though m_flMaxspeed.
Sammy-ROCK! is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 10-17-2010 , 20:37   Re: Team/player speed
Reply With Quote #8

Sammy, that was broken in the most recent update, the ZR team is currently attempting to find away around it.
__________________
thetwistedpanda is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 10-17-2010 , 20:43   Re: Team/player speed
Reply With Quote #9

We're just as lost as everyone else and definitely need help. LMV is the only thing working now.

I only have time to watch these forums.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 10-17-2010 , 21:42   Re: Team/player speed
Reply With Quote #10

Sec I'll call my debugger he's a superhero!
Sammy-ROCK! 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 18:28.


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