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

How to Set Player Team (random player)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thebro
Senior Member
Join Date: Jan 2011
Old 11-27-2013 , 19:29   How to Set Player Team (random player)
Reply With Quote #1

Hello, I am working on a small plugin called Traitor. Basically I was requesting if it is possible for when the round starts, after "lets say about 7" seconds, a random player is forced to the other team? Example.

10 Players are on CT.
After 7 seconds, a random player is forced to team T?


Please and thankyou
thebro is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-27-2013 , 19:48   Re: How to Set Player Team (random player)
Reply With Quote #2

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

public plugin_init()
{
    
register_logevent("OnRoundStart"2"1=Round_Start");
}

public 
OnRoundStart()
{
    
set_task(7.0"StartBetrayal");
}

public 
StartBetrayal()
{
    new 
players[32], count;
    
get_players(playerscount"aceh""CT");

    if (
count >= 2)
    {
        new 
traitor players[random(count)];
        
cs_set_user_team(traitorCS_TEAM_TCS_T_TERROR);
        
client_print(traitorprint_center"YOU'RE THE TRAITOR!");
    }

__________________

Last edited by hleV; 11-27-2013 at 19:50.
hleV is offline
thebro
Senior Member
Join Date: Jan 2011
Old 11-29-2013 , 17:13   Re: How to Set Player Team (random player)
Reply With Quote #3

Works perfectly! Thanks
thebro 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 06:01.


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