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

Players get no crosshair when changing teams


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WhiteFang1319
Senior Member
Join Date: Jan 2017
Old 06-17-2023 , 03:09   Players get no crosshair when changing teams
Reply With Quote #1

I have one of the match/captain plugin where two captains are selected, they duel it out, select teams and then select players. But when the players selected from the spectator, some of them lose their crosshair and have to reconnect.
Can anyone help me fix this please? Its a real nuisance to players.

LetsSecondChoosePlayers() is similar to LetsFirstChoosePlayers()
Code:
// transferring all players to spectator

 public Spec()
{
    new iPlayers[32], iPlayersNum, iPlayer
    get_players(iPlayers, iPlayersNum)
    for(new i;i < iPlayersNum;i++)
    {
        iPlayer = iPlayers[i]

        if(is_user_alive(iPlayer))
        {
            user_silentkill(iPlayer)
        }

        if(cs_get_user_team(iPlayer) < CS_TEAM_SPECTATOR)
        {
            cs_set_user_team(iPlayer, CS_TEAM_SPECTATOR)
        }
    }
}

// MENU TO CHOOSE PLAYERS FOR FIRST CAPTAIN !!!
public LetsFirstChoosePlayers(id){

    new players[32], count;
    get_players(players, count,"eh","SPECTATOR");

    if(count > 0){
        new iChoosePlayers = LetsFirstChoosePlayersMenu( id, "Choose A player.", "LetsFirstChoosePlayersHandler" );
        menu_setprop( iChoosePlayers, MPROP_NUMBER_COLOR, "\y" );
        menu_display( id, iChoosePlayers );

        return PLUGIN_HANDLED;
    }
    else{

        set_cvar_string("amx_warname","Teams Are Set!")


        set_dhudmessage(0,255, 0, -1.0, -1.0, 0, 2.0, 6.0, 0.8, 0.8)
        show_dhudmessage(0,"Teams are SET ! ^n ^n First Half will start Now.......")
        // Set Tasks
        set_task(0.1,"SetMatchCap");
        set_task(1.0,"LiveInThree");
        set_task(1.2, "SV_Restart", .flags="a", .repeat=3);
        set_task(3.0,"StartMatch");


        return PLUGIN_HANDLED;
    }
}

LetsFirstChoosePlayersMenu(id, const szMenuTitle[], const szMenuHandler[]){

    new iChoosePlayers = menu_create( szMenuTitle, szMenuHandler );
    new iPlayers[32], iNum, iPlayer, szPlayerName[32], szUserId[32];
    get_players( iPlayers, iNum, "h" );

    new PlayerWithPoints[128]

    for(new i = 0 ;i<iNum;i++){
        iPlayer = iPlayers[i];
        //Add user in the menu if - CONNECTED and TEAM IS T.
        if(get_user_team(iPlayer) == 3 ){
            get_user_name( iPlayer, szPlayerName, charsmax( szPlayerName ) );
            formatex(PlayerWithPoints,127,"%s",szPlayerName)
            formatex( szUserId, charsmax( szUserId ), "%d", get_user_userid( iPlayer ) );
            menu_additem( iChoosePlayers, PlayerWithPoints, szUserId, 0 );
        }
    }
    return iChoosePlayers;
}

public LetsFirstChoosePlayersHandler( id, iChoosePlayers, iItem ){

    if ( iItem == MENU_EXIT ){
        new iChoosePlayers = LetsFirstChoosePlayersMenu( id, "Choose A player.", "LetsFirstChoosePlayersHandler" );
        menu_setprop( iChoosePlayers, MPROP_NUMBER_COLOR, "\y" );
        menu_display( id, iChoosePlayers );

        return PLUGIN_HANDLED;
    }

    new szUserId[32], szPlayerName[32], iPlayer,  iCallback;
    menu_item_getinfo( iChoosePlayers, iItem, iCallback, szUserId, charsmax( szUserId ), szPlayerName, charsmax( szPlayerName ), iCallback );

    if ( ( iPlayer = find_player( "k", str_to_num( szUserId ) ) )  ){
        new ChoosenPlayer[32]
        get_user_name(iPlayer, ChoosenPlayer, charsmax(ChoosenPlayer))
        CromChat(0,"  &x04Captain &x03%s &x04chose &x01Player &x04%s ",g_Captain1,ChoosenPlayer);

        if(!is_user_connected(iPlayer)){
            new iChoosePlayers = LetsFirstChoosePlayersMenu( id, "Choose A player.", "LetsFirstChoosePlayersHandler" );
            menu_setprop( iChoosePlayers, MPROP_NUMBER_COLOR, "\y" );
            menu_display( id, iChoosePlayers );

            return PLUGIN_HANDLED;
        }
        else{
            CaptainChoosenID = id
            WhoChoseThePlayer = 1
            cs_set_user_team(iPlayer, cs_get_user_team(id))
            LetsSecondChoosePlayers(ShowMenuSecond)
            return PLUGIN_HANDLED;
        }
    }
    return PLUGIN_HANDLED;
}

Last edited by WhiteFang1319; 06-17-2023 at 03:10.
WhiteFang1319 is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 06-18-2023 , 15:26   Re: Players get no crosshair when changing teams
Reply With Quote #2

Leave the entire code
Uzviseni Bog 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 13:31.


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