AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Protection code help.. (https://forums.alliedmods.net/showthread.php?t=184019)

iBrazilian 04-29-2012 20:16

Protection code help..
 
I'm learning still, I just want to know why this is taking the user render too quickly.. about 2 seconds even if i set it to 10 seconds.

PHP Code:

#include <amxmodx>
#include <fun>
#include <hamsandwich>


new shellthick,glow,protect_time;

public 
plugin_init()
    { 
    
register_plugin("Spawn Protection""1.0""iBrazilian")
    
    
RegisterHam(Ham_Spawn"player""protect"1);
    
    
protect_time register_cvar("Protection_time""10")
    
shellthick register_cvar("Shell_thickness""25"
    
glow register_cvar("Allow_glow""1"
}

public 
protect(iPlayer)
    {
    new 
Shell get_pcvar_num(shellthick)
    new 
Float:time get_pcvar_float(protect_time)
    
set_user_godmode(iPlayer1)
    
    if(
get_pcvar_num(glow)) { 
        
        if(
get_user_team(iPlayer) == CS_TEAM_CT)
            {
            
set_user_rendering(iPlayerkRenderFxGlowShell25500kRenderNormalShell)
        }
        
        if(
get_user_team(iPlayer) == CS_TEAM_T)
            {
            
set_user_rendering(iPlayerkRenderFxGlowShell00255kRenderNormalShell)
        }
    }
    
    
set_task(time"StopProtection")
    return 
PLUGIN_HANDLED;
}

public 
StopProtection(iPlayer)
    {
    
set_user_godmode(iPlayer0)     
    
set_user_rendering(iPlayerkRenderFxGlowShell00,0kRenderNormal0)
    
    return 
PLUGIN_HANDLED;



Napoleon_be 04-29-2012 20:37

Re: Protection code help..
 
new Float:time = get_pcvar_float(protect_time)

Your pcvar ain't a float. set it to 10.0 in your register_cvar

Emp` 04-29-2012 21:57

Re: Protection code help..
 
Quote:

Originally Posted by Napoleon_be (Post 1699027)
new Float:time = get_pcvar_float(protect_time)

Your pcvar ain't a float. set it to 10.0 in your register_cvar

This does not matter. It will convert an integer to a float.

@iBrazilian:

You are not passing a player in set_task. I.e. you are continuously doing: StopProtection( 0 )


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

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