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

[Solved] Spawn protection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 05-27-2012 , 10:42   [Solved] Spawn protection
Reply With Quote #1

I was looking for spawn protection and i found this:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

new g_pProtectTime

public plugin_init()
{
    
register_plugin"Spawn Protection""0.2""ConnorMcLeod" )

    
g_pProtectTime register_cvar"sp_protecttime" "10.0" )

    
RegisterHamHam_Spawn"player""CBasePlayer_Spawn_Post")
}

public 
CBasePlayer_Spawn_Postid )
{
    
remove_taskid )
    if( 
is_user_aliveid ) )
    {
        switch( 
cs_get_user_teamid ) )
        {
            case 
CS_TEAM_T:
            {
                
set_user_renderingidkRenderFxGlowShell25500kRenderNormal10 )
            }
            case 
CS_TEAM_CT:
            {
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal10 )
            }
        }

        
set_user_godmodeidtrue )
        
set_taskget_pcvar_floatg_pProtectTime ), "RemoveProtect"id )
    }
}

public 
RemoveProtectid )
{
    if( 
is_user_connectedid ) )
    {
        
set_user_renderingidkRenderFxGlowShell000kRenderNormal)
        
set_user_godmodeidfalse )
    }

It works perfectly, just if someone can make a HUD timer with taht how much seconds left till the end of the protection.

Last edited by Lolz0r; 06-15-2012 at 12:24.
Lolz0r is offline
Alekkkk
Member
Join Date: Mar 2012
Location: Bulgaria
Old 05-27-2012 , 17:11   Re: [Requests] Spawn protection + timer
Reply With Quote #2

Something like this ?

PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <cstrike> 
#include <fun> 

#define MAX_PLAYERS 32

new g_pProtectTime
new g_TimerMAX_PLAYERS 
new 
szAddItemText[555 char]

public 
plugin_init() 

    
register_plugin"Spawn Protection""0.2""ConnorMcLeod" 

    
g_pProtectTime register_cvar"sp_protecttime" "10.0" 

    
RegisterHamHam_Spawn"player""CBasePlayer_Spawn_Post"


public 
CBasePlayer_Spawn_Postid 

    
remove_taskid 
    if( 
is_user_aliveid ) ) 
    { 
        switch( 
cs_get_user_teamid ) ) 
        { 
            case 
CS_TEAM_T
            { 
                
set_user_renderingidkRenderFxGlowShell25500kRenderNormal10 
            } 
            case 
CS_TEAM_CT
            { 
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal10 
            } 
        } 

        
set_user_godmodeidtrue 
        
        
g_Timerid ] = get_pcvar_numg_pProtectTime )
        
set_task1.0"Timer"id,_,_"b")
    } 


public 
RemoveProtectid 

    if( 
is_user_connectedid ) ) 
    { 
        
set_user_renderingidkRenderFxGlowShell000kRenderNormal
        
set_user_godmodeidfalse 
    } 

public 
Timerid )
{    
    
formatszAddItemTextcharsmax(szAddItemText), "Spawn Protection %d Seconds"g_Timerid ] )
    
set_hudmessage255255255, -1.00.2901.01.0,_,_,)
    
show_hudmessageidszAddItemText )
    
    
g_Timerid ]--
    
    if( 
g_Timerid ] <= )
    {
        
remove_taskid )
        
RemoveProtectid )
    }

}
public 
client_disconnectid )
{
    
remove_taskid )

__________________
Alekkkk is offline
Send a message via Skype™ to Alekkkk
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 05-28-2012 , 06:25   Re: [Requests] Spawn protection + timer
Reply With Quote #3

The timer and the protection aren't synchronized. When the round start it waits 1 second and then starts counting and when the proection end the timer has 1 more second.
Lolz0r is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-28-2012 , 07:36   Re: [Requests] Spawn protection + timer
Reply With Quote #4

i suggest you to use a set_pev to use witch a protection and replace the fun module to fakemeta
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 05-31-2012 , 17:46   Re: [Requests] Spawn protection + timer
Reply With Quote #5

Quote:
Originally Posted by ^SmileY View Post
i suggest you to use a set_pev to use witch a protection and replace the fun module to fakemeta
Can you make this with set_pev?
Lolz0r is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-31-2012 , 22:43   Re: [Requests] Spawn protection + timer
Reply With Quote #6

PHP Code:
#include <amxmodx> 
#include <fakemeta>
#include <hamsandwich> 
#include <cstrike>

#define MAX_PLAYERS 32

new g_pProtectTime
new g_TimerMAX_PLAYERS 
new 
szAddItemText[555 char]

public 
plugin_init() 

    
register_plugin"Spawn Protection""0.2""ConnorMcLeod" 

    
g_pProtectTime register_cvar"sp_protecttime" "10.0" 

    
RegisterHamHam_Spawn"player""CBasePlayer_Spawn_Post"


public 
CBasePlayer_Spawn_Postid 

    
remove_taskid 
    if( 
is_user_aliveid ) ) 
    { 
        switch( 
cs_get_user_teamid ) ) 
        { 
            case 
CS_TEAM_T
            { 
                
set_user_renderingidkRenderFxGlowShell25500kRenderNormal10 
            } 
            case 
CS_TEAM_CT
            { 
                
set_user_renderingidkRenderFxGlowShell00255kRenderNormal10 
            } 
        } 

        
set_pevidpev_takedamage0.0)
        
        
g_Timerid ] = get_pcvar_numg_pProtectTime )
        
set_task1.0"Timer"id,_,_"b")
    } 


public 
RemoveProtectid 

    if( 
is_user_connectedid ) ) 
    { 
        
set_user_renderingidkRenderFxGlowShell000kRenderNormal
        
set_pevidpev_takedamage2.0)
    } 

public 
Timerid )
{    
    
formatszAddItemTextcharsmax(szAddItemText), "Spawn Protection %d Seconds"g_Timerid ] )
    
set_hudmessage255255255, -1.00.2901.01.0,_,_,)
    
show_hudmessageidszAddItemText )
    
    
g_Timerid ]--
    
    if( 
g_Timerid ] <= )
    {
        
remove_taskid )
        
RemoveProtectid )
    }

}
public 
client_disconnectid )
{
    
remove_taskid )

Ps.
I prefer to use the fakemeta module
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 06-01-2012 , 05:41   Re: [Requests] Spawn protection + timer
Reply With Quote #7

Thanks, later will test it.

Fakemeta better fun in this case? And fixed problems in my last post?
Lolz0r is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 06-01-2012 , 11:36   Re: [Requests] Spawn protection + timer
Reply With Quote #8

Quote:
Originally Posted by ^SmileY View Post
i suggest you to use a set_pev to use witch a protection and replace the fun module to fakemeta
Any idea why fakemeta must use fakemeta here? fun is easy by the way.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-01-2012 , 11:47   Re: [Requests] Spawn protection + timer
Reply With Quote #9

There isn't really a difference in this case. Fun works faster and set_user_rendering is part of it (not of fakemeta), though.
__________________
<VeCo> is offline
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 06-01-2012 , 13:07   Re: [Requests] Spawn protection + timer
Reply With Quote #10

The plugin cant'be compiled, the problem is: undefined symbol: "set_user_rendering"

If osmeone can do it the best way without bugs.
Lolz0r 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 03:43.


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