AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   only ct (https://forums.alliedmods.net/showthread.php?t=242888)

nixh 06-26-2014 11:29

only ct
 
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);
    }



Flick3rR 06-26-2014 14:10

Re: only ct
 
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.

nixh 06-26-2014 14:17

Re: only ct
 
thanks for the help, but now it doesnt work at all.

mottzi 06-26-2014 15:44

Re: only ct
 
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.

nixh 06-27-2014 14:51

Re: only ct
 
still cant figure it out how to do it.

HamletEagle 06-28-2014 03:53

Re: only ct
 
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


All times are GMT -4. The time now is 21:12.

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