Raised This Month: $ Target: $400
 0% 

Team capts players spawned no weapons help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Hectik17
AlliedModders Donor
Join Date: Oct 2005
Old 03-03-2017 , 03:46   Team capts players spawned no weapons help
Reply With Quote #1

I just found this code and when i used it all players were spanwed without guns or knives. I thin it has somthing to do with player_silentkill. Restarting the round dosent fix it or lo3 i have to reaload the map. That defeates the purpose of captins culhoosing a team because all the players have to pick same teams. Or start picking over again.

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

#define TASK_MENUCLOSE 9001
#define TASK_PLAYERSLIST 9002

#define MinPlayers 10

new const Prefix[] = "[Captain]";

new 
RandomPlayer1;
new 
RandomPlayer2;

new 
bool:CaptainSort;

public 
plugin_init()
{
    
register_plugin("Captain Sorting""1.0""kramesa");
    
    
register_clcmd("say /capsort""StartCaptain");
    
    
register_clcmd("chooseteam""Block");
    
register_clcmd("jointeam""Block");
}

public 
StartCaptain(id)
{
    if(
is_user_admin(id))
    {
        if(
CaptainSort == true)
        {
            
client_print(idprint_chat"%s Captain Sort already running."Prefix);
            return 
PLUGIN_HANDLED;
        }
        
Captain();
        return 
PLUGIN_HANDLED;
    }
    
client_print(idprint_chat"%s Only admins have access to this command."Prefix);
    return 
PLUGIN_HANDLED;
}

public 
Block(id)
{
    if(
CaptainSort == true)
    {
        
client_print(idprint_chat"%s Captain Sort is running."Prefix);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id
{
    if(!
is_user_connected(RandomPlayer1) && CaptainSort && get_user_flags(id) & ADMIN_KICK)
    {
        
RandomPlayer1 id;
        
        new 
First_Captain[35];
        
get_user_name(RandomPlayer1First_Captaincharsmax(First_Captain));
        
        
client_print(0print_chat"%s The new Captain of CTs is: %s"PrefixFirst_Captain);
        
set_cvar_num("sv_restartround"1);
    }
    if(!
is_user_connected(RandomPlayer2) && CaptainSort && get_user_flags(id) & ADMIN_KICK)
    {
        
RandomPlayer2 id;
        
        new 
Second_Captain[35];
        
get_user_name(RandomPlayer2Second_Captaincharsmax(Second_Captain));
        
        
client_print(0print_chat"%s The new Captain of Ts is: %s"PrefixSecond_Captain);
        
set_cvar_num("sv_restartround"1)
    }
}

public 
Captain()
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"ch");
    
    if(
iNum MinPlayers)
    {
        
client_print(0print_chat"%s Need have more %d players to start Captain Sort."Prefix, (iNum MinPlayers));
        return 
PLUGIN_HANDLED;
    }
    for(new 
iiNumi++)
    {
        
user_silentkill(iPlayers[i]);
        
cs_set_user_team(iPlayers[i], 3);
    }
    if(
get_user_flags(iPlayers[iNum]) & ADMIN_KICK) {
        
RandomPlayer1 iPlayers[random(iNum)];
        
RandomPlayer2 iPlayers[random(iNum)];
    }
    
    while(
RandomPlayer1 == RandomPlayer2)
    {
        
RandomPlayer2 iPlayers[random(iNum)];
    }
    
cs_set_user_team(RandomPlayer1CS_TEAM_CT);
    
cs_set_user_team(RandomPlayer2CS_TEAM_T);
    
    new 
First_Captain[35], Second_Captain[35];
    
    
get_user_name(RandomPlayer1First_Captaincharsmax(First_Captain));
    
get_user_name(RandomPlayer2Second_Captaincharsmax(Second_Captain));
    
    
client_print(0print_chat"%s The Captain's are: %s (TRs) and %s (CTs)."PrefixFirst_CaptainSecond_Captain);
    
client_print(0print_chat"%s If no player is selected in 10 seconds, a player will be chosen random."Prefix);
    
    
set_cvar_num("sv_restartround"1)
    
    new 
First random(2)
    
    
set_task(1.5"captain_menu"First RandomPlayer1 RandomPlayer2);
    
set_task(0.2"PlayersList"TASK_PLAYERSLIST__"b");
    
    
CaptainSort true
    
return PLUGIN_CONTINUE
}

public 
captain_menu(id)
{
    new 
menu menu_create("Select a Player:""captainmenu_handler")
    
    
set_task(11.5"menu_task"id TASK_MENUCLOSE);
    
    new 
players[32], pnumtempid;
    new 
szName[32], szTempid[10];
    
    
get_players(playerspnum"ch")
    
    if(
pnum == 0)
    {
        
remove_task(id+TASK_MENUCLOSE)
        
remove_task(TASK_PLAYERSLIST)
        
CaptainSort false
        
        client_print
(0print_chat"%s Closing Captain Sort. Missing players."Prefix);
        return 
PLUGIN_HANDLED;
    }
    for(new 
ii<pnumi++)
    {
        
tempid players[i];
        
        if(
cs_get_user_team(tempid) != CS_TEAM_SPECTATOR) continue;
        
        
get_user_name(tempidszNamecharsmax(szName));
        
num_to_str(tempidszTempidcharsmax(szTempid));
        
        
menu_additem(menuszNameszTempid,0);
    }
    
menu_setprop(menuMPROP_EXITMEXIT_NEVER);
    
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
captainmenu_handler(id,menu,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_display(id,menu,0)
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback);
    
    new 
tempid str_to_num(data)
    
    new 
name[35], namec[35];
    
get_user_name(tempidnamecharsmax(name));
    
get_user_name(idnameccharsmax(namec));
    
    
cs_set_user_team(tempidcs_get_user_team(id));
    
client_print(0print_chat"%s %s choose the player %s"Prefixnamecname);
    
    
set_cvar_num("sv_restart",1)
    
    
remove_task(id+TASK_MENUCLOSE)
    
    new 
iPlayers[32],pnum
    get_players
(iPlayers,pnum,"h")
    
    if(
is_user_connected(RandomPlayer1) && is_user_connected(RandomPlayer2))
    {
        
set_task(1.5,"captain_menu",id == RandomPlayer1 RandomPlayer2 RandomPlayer1)
    }
    else
    {
        
set_task(5.0,"CheckCaptainJoin",id == RandomPlayer1 RandomPlayer1 RandomPlayer2)
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
menu_task(id)
{
    
id -= TASK_MENUCLOSE
    
    
new players[32], pnum;
    
get_players(playerspnum"ch");
    
    new 
randomnum random(pnum)
    new 
bool:has_spec
    
    
for(new ipnumi++)
    {
        if(
cs_get_user_team(players[i]) == CS_TEAM_SPECTATOR)
        {
            
has_spec true
        
}
    }
    if(!
has_spec)
    {
        
remove_task(TASK_PLAYERSLIST);
        
CaptainSort false;
        return;
    }
    while(
cs_get_user_team(players[randomnum]) != CS_TEAM_SPECTATOR)
    {
        
randomnum random(pnum)
    }
    if(
is_user_connected(id))
    {
        
set_cvar_num("sv_restart",1)
        
cs_set_user_team(players[randomnum],cs_get_user_team(id))
        
        
set_task(1.5"captain_menu"id == RandomPlayer1 RandomPlayer2 RandomPlayer1);
    }
    else
    {
        
set_task(5.0"CheckCaptainJoin"id == RandomPlayer1 RandomPlayer2 RandomPlayer1);
        
        
client_print(0print_chat"%s Awaiting the arrival of a new Captain."Prefix);
    }
    
show_menu(id0"^n"1);
}

public 
CheckCaptainJoin(NextCaptainMenu)
{
    if(
is_user_connected(RandomPlayer1) && is_user_connected(RandomPlayer2))
    {
        
set_task(1.5"captain_menu"NextCaptainMenu)
    }
    else
    {
        
set_task(5.0"CheckCaptainJoin"NextCaptainMenu)
    }
}

public 
PlayersList()
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"ch");
    
    new 
posTRposCTposSPEC;
    new 
HudTextTR[512], HudTextCT[512], HudTextSPEC[512];
    new 
szName[38], name[38];
    
    for(new 
iiNumi++)
    {
        
get_user_name(iPlayers[i], szNamecharsmax(szName));
        
        if(
iPlayers[i] == RandomPlayer1 || iPlayers[i] == RandomPlayer2)
        {
            
formatex(namecharsmax(name), "%s (C)"szName);
        }
        else
        {
            
name szName;
        }
        if(
cs_get_user_team(iPlayers[i]) == CS_TEAM_T)
        {
            
posTR += formatex(HudTextTR[posTR], 511-posTR,"%s^n"name);
        }
        else if(
cs_get_user_team(iPlayers[i]) == CS_TEAM_CT)
        {
            
posCT += formatex(HudTextCT[posCT], 511-posCT"%s^n"name);
        }
        else
        {
            
posSPEC += formatex(HudTextSPEC[posSPEC], 511-posSPEC"%s^n"name);
        }
    }
    for(new 
iiNumi++)
    {
        
set_hudmessage(255000.700.1600.01.10.00.01);
        
show_hudmessage(iPlayers[i], "Terrorists:");
        
        
set_hudmessage(2552552550.700.1900.01.10.00.02);
        
show_hudmessage(iPlayers[i], HudTextTR);
        
        
set_hudmessage(002550.700.5100.01.10.00.03);
        
show_hudmessage(iPlayers[i], "Counter-Terrorist:");
        
        
set_hudmessage(2552552550.700.5400.01.10.00.04);
        
show_hudmessage(iPlayers[i], HudTextCT);
    }

If u can also remove the team list hud text or convert it to normal chat that would be helpfull. Thanks in advance
Hectik17 is offline
 


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 20:47.


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