Raised This Month: $ Target: $400
 0% 

switch player to spec


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-30-2008 , 23:55   switch player to spec
Reply With Quote #1

im using this code to switch player to spec but for some reason its glitching. it switches the player to spec for 5 seconds and then switches them back to their old team. when u tab it shows ur on ur old team but ur really in spec and wont spawn next round or round after that. any1 know why the score board is glitching heres the code

Code:
stock fm_set_user_team(id, CsTeams:team)
{
   set_pdata_int(id, OFFSET_TEAM, _:team)
 
   dllfunc(DLLFunc_ClientUserInfoChanged, id)
 
   static teaminfo[12], iMsgid_TeamInfo
 
   switch(team)
   {
        case CS_TEAM_UNASSIGNED: 
            teaminfo="UNASSIGNED"
       case CS_TEAM_T: 
           teaminfo="TERRORIST"
       case CS_TEAM_CT: 
           teaminfo="CT"
       case CS_TEAM_SPECTATOR: 
           teaminfo="SPECTATOR"
    }
 
   if(!iMsgid_TeamInfo)
       iMsgid_TeamInfo = get_user_msgid("TeamInfo")
 
 
   message_begin(MSG_ALL, iMsgid_TeamInfo)
   write_byte(id)
   write_string(teaminfo)
   message_end()
}
whosyourdaddy is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-31-2008 , 00:54   Re: switch player to spec
Reply With Quote #2

Does cs_set_user_team() not work?
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2008 , 01:23   Re: switch player to spec
Reply With Quote #3

Depending on what you want, you can also use :
dllfunc(DLLFunc_ClientPutInServer, id)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-31-2008 , 01:34   Re: switch player to spec
Reply With Quote #4

naw cs_set_user_team does hte same thing ill try the clientputinserver thing
whosyourdaddy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-31-2008 , 02:15   Re: switch player to spec
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Depending on what you want, you can also use :
dllfunc(DLLFunc_ClientPutInServer, id)
well put in server shows me in spec on tab but also pops up the motd and team selection menu, do u think theres other ways in doing it without having those popping up?
whosyourdaddy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-31-2008 , 11:00   Re: switch player to spec
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Depending on what you want
If you don't want to allow the player to choose, then, just kill him and set gis team to spec, example in plmenu.sma
PHP Code:
            if (g_cstrike)
            {
                if (
is_user_alive(player))
                {
                    new 
deaths cs_get_user_deaths(player)
                    
user_kill(player1)
                    
cs_set_user_deaths(playerdeaths)
                }
                
// This modulo math just aligns the option to the CsTeams-corresponding number
                
cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
                
cs_reset_user_model(player)
            } 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-31-2008 , 17:53   Re: switch player to spec
Reply With Quote #7

what would i replace with
Code:
(g_menuOption[id] % 3) + 1

to make it become spectator
whosyourdaddy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-31-2008 , 18:15   Re: switch player to spec
Reply With Quote #8

CS_TEAM_SPECTATOR, or 3
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 12-31-2008, 18:22
Dores
This message has been deleted by Dores. Reason: oops, you already did it
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-31-2008 , 18:30   Re: switch player to spec
Reply With Quote #9

You can use this instead of your code:
PHP Code:
fm_set_user_teamindexteam )
{
    
set_pdata_intindexOFFSET_TEAMteam );
    
dllfuncDLLFunc_ClientUserInfoChangedindexengfuncEngFunc_GetInfoKeyBufferindex ) );
    switch( 
team )
    {
        case 
3:    dllfuncDLLFunc_ClientKillindex );
        
        default:    
dllfuncDLLFunc_Spawnindex );
    }
    
    
message_beginMSG_ONEg_Msg_TeamInfo_index );
    
write_byteindex );
    static 
Teams[][] =
    {
        
""// LOL NULL
        
"TERRORIST",
        
"CT",
        
"SPECTATOR"
    
}
    
write_stringTeamsteam ] );
    
message_end();
    
    return;

g_Msg_TeamInfo is a global variable with the "TeamInfo" message id.
Also, this code doesn't require cstrike tags.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-31-2008 , 19:02   Re: switch player to spec
Reply With Quote #10

g_Msg_TeamInfo = get_user_msgid("TeamInfo")?? in plugin_init

and if so it just puts me in spec for 2 seconds and then back to my old team. but i dont respawn on new round i just stay dead

Last edited by whosyourdaddy; 12-31-2008 at 19:14.
whosyourdaddy 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 09:19.


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