AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple way to spawn all spectators to RANDOM team (CT or T)? (https://forums.alliedmods.net/showthread.php?t=205232)

alonelive 01-08-2013 11:04

Simple way to spawn all spectators to RANDOM team (CT or T)?
 
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? :)

AngeIII 01-08-2013 11:36

Re: Simple way to spawn all spectators to RANDOM team (CT or T)?
 
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


ANTICHRISTUS 01-11-2013 03:32

Re: Simple way to spawn all spectators to RANDOM team (CT or T)?
 
idk if it will help you: https://forums.alliedmods.net/images...s/viewpost.gif just search in the plugins made by Exolent[jNr] and VEN (approved, or all).


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

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