Raised This Month: $ Target: $400
 0% 

Protection code help..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iBrazilian
Senior Member
Join Date: May 2011
Old 04-29-2012 , 20:16   Protection code help..
Reply With Quote #1

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;

__________________
Pokemod Season 5 [ |||||||||| Complete]

Last edited by iBrazilian; 04-29-2012 at 20:32.
iBrazilian is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-29-2012 , 20:37   Re: Protection code help..
Reply With Quote #2

new Float:time = get_pcvar_float(protect_time)

Your pcvar ain't a float. set it to 10.0 in your register_cvar
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-29-2012 , 21:57   Re: Protection code help..
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
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 )
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 07:48.


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