Raised This Month: $ Target: $400
 0% 

only ct


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nixh
Member
Join Date: Nov 2013
Old 06-26-2014 , 11:29   only ct
Reply With Quote #1

hey i got this code and i need that this would affect only ct team, i mean that ct only get that godmode for 10 sec. Would be cool if someone helps me.

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

#define TASK_GM 10001

new Float:gfProtectTime 10.0;

public 
plugin_init() 
{
    
register_plugin"Spawn Protection""0.1""hornet" );
    
    
register_event"HLTV""evRoundStart""a""1=0""2=0" );
}

public 
evRoundStart()
{
    
remove_taskTASK_GM );
    
    new 
players32 ], playernum;
    
get_playersplayersnum );
    for( new 
num ++ )
    {
        
player players];
        if( 
is_user_aliveplayer ) && is_user_connectedplayer ) )
            
set_user_godmodeplayer);
    }
    
    
set_taskgfProtectTime"godmodeOff"TASK_GM )
}

public 
godmodeOff()
{
    new 
players32 ], playernum;
    
get_playersplayersnum );
    for( new 
num ++ )
    {
        
player players];
        if( 
is_user_aliveplayer ) && is_user_connectedplayer ) )
            
set_user_godmodeplayer);
    }

nixh is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-26-2014 , 14:10   Re: only ct
Reply With Quote #2

Change this:
PHP Code:
get_playersplayersnum ); 
to this
PHP Code:
get_playersplayersnum"aeh""CT" ); 

And then you can remove this check:
PHP Code:
if( is_user_aliveplayer ) && is_user_connectedplayer ) ) 
because with flag "a" we get only alive players. And if the players are alive - they are obviously connected.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
nixh
Member
Join Date: Nov 2013
Old 06-26-2014 , 14:17   Re: only ct
Reply With Quote #3

thanks for the help, but now it doesnt work at all.
nixh is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 06-26-2014 , 15:44   Re: only ct
Reply With Quote #4

If you're using get_players() you need to either set a delay using set_task() or you use the NewRound-logevent. Players might not be alive when the HLTV-Event is called.
mottzi is offline
Send a message via MSN to mottzi
nixh
Member
Join Date: Nov 2013
Old 06-27-2014 , 14:51   Re: only ct
Reply With Quote #5

still cant figure it out how to do it.
nixh is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-28-2014 , 03:53   Re: only ct
Reply With Quote #6

Then you should go to suggestions/request forum, it's obvious that you don't know how to do this simple thing.

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

#define TASK_GM 10001

new Float:gfProtectTime 10.0;

public 
plugin_init() 
{
    
register_plugin"Spawn Protection""0.1""hornet" );
    
    
register_logevent("OnRoundStart"2"1=Round_Start")  
}

public 
OnRoundStart ( )
{
    
remove_taskTASK_GM );
    
    new 
players32 ], playernum;
    
get_playersplayersnum"aeh""CT" );
    
    for( new 
num ++ )
    {
        
player players];
        
set_user_godmodeplayer);
    }
    
    
set_taskgfProtectTime"godmodeOff"TASK_GM )
}

public 
godmodeOff()
{
    new 
players32 ], playernum;
    
get_playersplayersnum"aeh""CT" );
    for( new 
num ++ )
    {
        
player players];
        
set_user_godmodeplayer);
    }

This is how you should done it. Also read here: https://forums.alliedmods.net/showth...=42159?t=42159
HamletEagle 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 11:36.


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