Raised This Month: $ Target: $400
 0% 

Simple way to spawn all spectators to RANDOM team (CT or T)?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 01-08-2013 , 11:04   Simple way to spawn all spectators to RANDOM team (CT or T)?
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#include <cstrike>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "alonelive"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""SpecSpawn""a""1=0""2=0"// catch the round start moment
    // Add your code here...
}

public 
SpecSpawn() {

    new 
players[32], inum
    get_players
(playersinum)

    for (new 
0inum; ++i) {                                  // for all..
        
        
if(is_user_connected(i))                                       // connected..
        
if(cs_get_user_team(i) == CS_TEAM_SPECTATOR)                    // spectator players
    
            // cs_set_user_team(i, AUTO)        ??
            // engclient_cmd(id, joinclass, 5)   ??
            // need to spawn spect. player to T or CT (random) team with random model..
            
ExecuteHamB(Ham_Spawn,i
    }

Can anyone help me with this?
__________________
sorry my bad english...

Last edited by alonelive; 01-08-2013 at 11:10.
alonelive is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-08-2013 , 11:36   Re: Simple way to spawn all spectators to RANDOM team (CT or T)?
Reply With Quote #2

no needs to check if is_user_connected. if you are using get_players procedure.

also error: you don't need to use "i" as argument for function, you should use players[i] argument for function.
as for team, you should set team to user before spawn
PHP Code:
new team=random_num(1,2);
cs_set_user_team(players[i], (team==1)?CS_TEAM_T:CS_TEAM_CT
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 01-11-2013 , 03:32   Re: Simple way to spawn all spectators to RANDOM team (CT or T)?
Reply With Quote #3

idk if it will help you: just search in the plugins made by Exolent[jNr] and VEN (approved, or all).
__________________

Last edited by ANTICHRISTUS; 01-11-2013 at 03:33.
ANTICHRISTUS is offline
Reply


Thread Tools
Display Modes

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 13:21.


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