AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Speed down (https://forums.alliedmods.net/showthread.php?t=95373)

One 06-23-2009 03:57

Speed down
 
How to do that when player do nothing, speed goes down from the speed what player had.
example players speed is 999. player lose the forward key & speed must go down from 999 to 998 , 997, 9996 >>> 0.
this is what i have but problem is when u dont press the key, ur speed is 0 :(

PHP Code:

/***************************************************************************************************



Group A = Movement
Group B = Speed


***************************************************************************************************/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>

new Float:A_GAS 0.0
new Float:A_SORAT
new B_DANDEH 0

public plugin_init() 
{
    
register_plugin("Movements""0.1""One")
    
register_forward(FM_CmdStart"fwdCmdStart");
}
public 
fwdCmdStart(id,iHandle)
{
    
A_SORAT get_user_maxspeed(id)
    if(
A_GAS >= 1000.0)
    {
        
A_GAS 1000.0
    
}
    if(
A_GAS <= 0.0)
    {
        
A_GAS 0.0
    
}
    if(
A_SORAT >= 1000.0)
    {
        
A_SORAT 1000.0
    
}
    if(
A_SORAT <= 0.0)
    {
        
A_SORAT 0.0
    
}
    if (
get_uc(iHandleUC_Buttons) & IN_FORWARD)
    {
        
B_DANDEH  1
        A_GAS 
A_GAS 0.3
        set_user_maxspeed
(id,A_GAS)
        if(
A_SORAT >= 120.0)
        {
            
B_DANDEH 2
            A_GAS 
A_GAS 0.5
        
}
        else if(
A_SORAT >= 200.0)
        {
            
B_DANDEH 3
            A_GAS 
A_GAS 0.7
        
}
        else if(
A_SORAT >= 400.0)
        {
            
B_DANDEH 4
            A_GAS 
A_GAS 1.0
        
}
        else if(
A_SORAT >= 700.0)
        {
            
B_DANDEH 5
            A_GAS 
A_GAS 0.2
        
}
        else if(
A_SORAT >= 1000.0)
        {
            
set_user_maxspeed(id,1000.0)
        }
    }
    else
    {
        if(
B_DANDEH >= 5)
        {
            
A_GAS A_GAS 1.0
            A_SORAT 
A_SORAT 20.0
        
}
        else if(
B_DANDEH && 4)
        {
            
A_GAS A_GAS 1.0
            A_SORAT 
A_SORAT 16.0
        
}
        else if(
B_DANDEH && 3)
        {
            
A_GAS A_GAS 1.0
            A_SORAT 
A_SORAT 13.0
        
}
        else if(
B_DANDEH && 2)
        {
            
A_GAS A_GAS 1
            A_SORAT 
A_SORAT 20.0
        
}
        else if(
B_DANDEH && 1)
        {
            
A_GAS A_GAS 2.0
            A_SORAT 
A_SORAT 30.0
        
}
        else if(
B_DANDEH && 0)
        {
            
A_GAS 0.0
            A_SORAT 
0.0
        
}
    }


better said, ur speed must go slowly slower.

minimiller 06-23-2009 04:00

Re: Speed down
 
im not sure if its what u need, but you could make a "new gVariable = 1000" and a repeating task and do "gVariable--;" then "set_user_maxspeed(id, floatround(gVariable);"

One 06-23-2009 04:02

Re: Speed down
 
hmmm this sounds good. ill try. ty for first.

tpt 06-23-2009 07:18

Re: Speed down
 
Code:
set_user_maxspeed( id, float( gVariable ) );

floatround - Rounds a float into an integer value.
float - Returns the floating point value of the given number.

minimiller 06-23-2009 07:48

Re: Speed down
 
my bad


All times are GMT -4. The time now is 15:33.

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