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

[HELP] fix transfer player in plmenu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 07-26-2016 , 02:14   [HELP] fix transfer player in plmenu
Reply With Quote #1

PHP Code:
public actionTeamMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            
g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike 2);
            
displayTeamMenu(idg_menuPosition[id])
        }
        case 
8displayTeamMenu(id, ++g_menuPosition[id])
        case 
9displayTeamMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
authid[32], authid2[32], name[32], name2[32]

            
get_user_name(playername231)
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)

            static 
logdata[100]
            
formatex(logdatacharsmax(logdata), "[ADMIN] %s: transfer %s to %s"namename2g_CSTeamNames[g_menuOption[id] % 3])
            
log_to_file("Admins commands.log"logdata)            
            
            
ColorChat(0GREY"^1[ADMIN]^4 %s^1: transfer^4 %s^1 to^4 %s"namename2g_CSTeamNames[g_menuOption[id] % 3])    

            if (
g_cstrike)
            {
                if (
is_user_alive(player))
                {
                    new 
deaths cs_get_user_deaths(player)                                    
                    
cs_set_user_deaths(playerdeaths
                }

            
setUserTeam_cs(player, (g_menuOption[id] % 3) + 1,1,1)
            static 
iorigin[3]
            
get_user_origin(playeriorigin)
            
message_begin(MSG_PVSSVC_TEMPENTITYiorigin)
            
write_byte(TE_TELEPORT);
            
write_coord(iorigin[0]);
            
write_coord(iorigin[1]);
            
write_coord(iorigin[2]);
            
message_end();  
            
                
cs_reset_user_model(player)
            } else {
                new 
limit_setting get_cvar_num("mp_limitteams")
                
                
set_cvar_num("mp_limitteams"0)
                
engclient_cmd(player"jointeam"g_CSTeamNumbers[g_menuOption[id] % 2])
                
engclient_cmd(player"joinclass""1")
                
set_cvar_num("mp_limitteams"limit_setting)
            }

            
displayTeamMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

stock setUserTeam_cs(index,team,respawn=0,updatescoreboard=1) {
  if(
is_user_connected(index)) {
    if(
team >= && team <= 3) {
      
set_pdata_int(index114team)
      if(
is_user_alive(index)) {
        
engclient_cmd(index"drop""weapon_c4")
        if(
team != 2)
        {
          new 
defuser get_pdata_int(index193)
          if(
defuser & (1<<16)) {
            
defuser -= (1<<16)
            
set_pdata_int(index193defuser)
          }
          
message_begin(MSG_ONEget_user_msgid("StatusIcon"), {0,0,0}, index)
          
write_byte(0)
          
write_string("defuser")
          
write_byte(0)
          
write_byte(255)
          
write_byte(0)
          
message_end()
        }
      }
      if(
respawn)
      {
        new 
health get_user_health(index)
        new 
armor get_user_armor(index)
        
set_pev(indexpev_spawnflags3)
        
dllfunc(DLLFunc_Spawnindex)
        
set_pev(indexpev_iuser10)
        
set_pev(indexpev_healthfloat(health))
        
set_pev(indexpev_armorvaluefloat(armor))
      }
      if(
updatescoreboard) {
        
message_begin(MSG_ALLget_user_msgid("TeamInfo"))
        
write_byte(index)
        switch(
team) {
          case 
1write_string("TERRORIST")
          case 
2write_string("CT")
        }
        
message_end()
      }
      return 
1
    
}
  }
  return 
0

i have problem in section "transfer to spectators"
when i transfer any player to spectators he still alive :/
and in next round he will be die + in spectators
see this proof



i need to fix it, when i choose transfer to spectators i need the target die + transfer direct to spectators
__________________

Last edited by arvEL.; 07-26-2016 at 02:27.
arvEL. is offline
Send a message via Skype™ to arvEL.
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-26-2016 , 02:31   Re: [HELP] fix transfer player in plmenu
Reply With Quote #2

Because you don't use default plmenu.
It should be like this:

PHP Code:
if (is_user_alive(player))
{
    new 
deaths cs_get_user_deaths(player)
    
user_kill(player1)
    
cs_set_user_deaths(playerdeaths)

Or you can use user_silentkill(player) to block rank count and death message.

Last edited by siriusmd99; 07-26-2016 at 02:32.
siriusmd99 is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 07-26-2016 , 03:21   Re: [HELP] fix transfer player in plmenu
Reply With Quote #3

Quote:
Originally Posted by siriusmd99 View Post
Because you don't use default plmenu.
It should be like this:

PHP Code:
if (is_user_alive(player))
{
    new 
deaths cs_get_user_deaths(player)
    
user_kill(player1)
    
cs_set_user_deaths(playerdeaths)

Or you can use user_silentkill(player) to block rank count and death message.
no bro i don't need use default plmenu you know why?
this plugin transfer players without die!!
the default plmenu transfer + die
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-26-2016 , 06:15   Re: [HELP] fix transfer player in plmenu
Reply With Quote #4

Quote:
Originally Posted by arvEL. View Post
no bro i don't need use default plmenu you know why?
this plugin transfer players without die!!
the default plmenu transfer + die
And you said:

Quote:
Originally Posted by arvEL. View Post
i need to fix it, when i choose transfer to spectators i need the target die + transfer direct to spectators
Logic killed.

Default plmenu does what you need. It kill target and then transfers to specified team.

Last edited by siriusmd99; 07-26-2016 at 06:15.
siriusmd99 is offline
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 07-26-2016 , 13:27   Re: [HELP] fix transfer player in plmenu
Reply With Quote #5

Quote:
Originally Posted by siriusmd99 View Post
And you said:



Logic killed.

Default plmenu does what you need. It kill target and then transfers to specified team.
i think you don't understand my idea
listen bro..

this stock:

PHP Code:
stock setUserTeam_cs(index,team,respawn=0,updatescoreboard=1
can transfer players to T & CT without die! ok ??
i need fix it to transfer to spectators with die!

transfer to T without die
transfer to CT without die

transfer to spectators with die
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-26-2016 , 14:05   Re: [HELP] fix transfer player in plmenu
Reply With Quote #6

Try:

PHP Code:
public actionTeamMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            
g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike 2);
            
displayTeamMenu(idg_menuPosition[id])
        }
        case 
8displayTeamMenu(id, ++g_menuPosition[id])
        case 
9displayTeamMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
authid[32], authid2[32], name[32], name2[32]

            
get_user_name(playername231)
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)

            static 
logdata[100]
            
formatex(logdatacharsmax(logdata), "[ADMIN] %s: transfer %s to %s"namename2g_CSTeamNames[g_menuOption[id] % 3])
            
log_to_file("Admins commands.log"logdata)            
            
            
ColorChat(0GREY"^1[ADMIN]^4 %s^1: transfer^4 %s^1 to^4 %s"namename2g_CSTeamNames[g_menuOption[id] % 3])    

            if (
g_cstrike)
            {
                if (
is_user_alive(player))
                {
                    new 
deaths cs_get_user_deaths(player)                                    
                    
cs_set_user_deaths(playerdeaths
                }
            new 
iTeam = (g_menuOption[id] % 3) + 1;
            
setUserTeam_cs(playeriTeam,1,1)
            if(
iTeam != 3//If it's not spectator then teleport him
            
{
            new 
iorigin[3]
            
get_user_origin(playeriorigin)
            
message_begin(MSG_PVSSVC_TEMPENTITYiorigin)
            
write_byte(TE_TELEPORT);
            
write_coord(iorigin[0]);
            
write_coord(iorigin[1]);
            
write_coord(iorigin[2]);
            
message_end();  
            }
                
cs_reset_user_model(player)
            } else {
                new 
limit_setting get_cvar_num("mp_limitteams")
                
                
set_cvar_num("mp_limitteams"0)
                
engclient_cmd(player"jointeam"g_CSTeamNumbers[g_menuOption[id] % 2])
                
engclient_cmd(player"joinclass""1")
                
set_cvar_num("mp_limitteams"limit_setting)
            }

            
displayTeamMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

stock setUserTeam_cs(index,team,respawn=0,updatescoreboard=1) {
  if(
is_user_connected(index)) {
    if(
team >= && team <= 3) {
      
set_pdata_int(index114team)
      if(
is_user_alive(index)) 
      {
        
engclient_cmd(index"drop""weapon_c4")
        if(
team != 2)
        {
          new 
defuser get_pdata_int(index193)
          if(
defuser & (1<<16)) 
          {
            
defuser -= (1<<16)
            
set_pdata_int(index193defuser)
          }
          
message_begin(MSG_ONEget_user_msgid("StatusIcon"), {0,0,0}, index)
          
write_byte(0)
          
write_string("defuser")
          
write_byte(0)
          
write_byte(255)
          
write_byte(0)
          
message_end()
        }
        else
        {
          if(
team == 3)
           {
              
user_silentkill(index)
              return 
0;
           }
        }
      }
      if(
respawn)
      {
        new 
health get_user_health(index)
        new 
armor get_user_armor(index)
        
set_pev(indexpev_spawnflags3)
        
dllfunc(DLLFunc_Spawnindex)
        
set_pev(indexpev_iuser10)
        
set_pev(indexpev_healthfloat(health))
        
set_pev(indexpev_armorvaluefloat(armor))
      }
      if(
updatescoreboard) {
        
message_begin(MSG_ALLget_user_msgid("TeamInfo"))
        
write_byte(index)
        switch(
team) {
          case 
1write_string("TERRORIST")
          case 
2write_string("CT")
        }
        
message_end()
      }
      return 
1
    
}
  }
  return 
0

I checked if team == 3 which means spectator and then added user_silentkill function . Also i checked team to avoid teleporting the spectator.

Last edited by siriusmd99; 07-26-2016 at 14:16.
siriusmd99 is offline
Old 07-26-2016, 15:35
addons_zz
This message has been deleted by addons_zz. Reason: wrong post
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 07-27-2016 , 06:55   Re: [HELP] fix transfer player in plmenu
Reply With Quote #7

Quote:
Originally Posted by siriusmd99 View Post
Try:

PHP Code:
public actionTeamMenu(idkey)
{
    switch (
key)
    {
        case 
7:
        {
            
g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike 2);
            
displayTeamMenu(idg_menuPosition[id])
        }
        case 
8displayTeamMenu(id, ++g_menuPosition[id])
        case 
9displayTeamMenu(id, --g_menuPosition[id])
        default:
        {
            new 
player g_menuPlayers[id][g_menuPosition[id] * key]
            new 
authid[32], authid2[32], name[32], name2[32]

            
get_user_name(playername231)
            
get_user_authid(idauthid31)
            
get_user_authid(playerauthid231)
            
get_user_name(idname31)

            static 
logdata[100]
            
formatex(logdatacharsmax(logdata), "[ADMIN] %s: transfer %s to %s"namename2g_CSTeamNames[g_menuOption[id] % 3])
            
log_to_file("Admins commands.log"logdata)            
            
            
ColorChat(0GREY"^1[ADMIN]^4 %s^1: transfer^4 %s^1 to^4 %s"namename2g_CSTeamNames[g_menuOption[id] % 3])    

            if (
g_cstrike)
            {
                if (
is_user_alive(player))
                {
                    new 
deaths cs_get_user_deaths(player)                                    
                    
cs_set_user_deaths(playerdeaths
                }
            new 
iTeam = (g_menuOption[id] % 3) + 1;
            
setUserTeam_cs(playeriTeam,1,1)
            if(
iTeam != 3//If it's not spectator then teleport him
            
{
            new 
iorigin[3]
            
get_user_origin(playeriorigin)
            
message_begin(MSG_PVSSVC_TEMPENTITYiorigin)
            
write_byte(TE_TELEPORT);
            
write_coord(iorigin[0]);
            
write_coord(iorigin[1]);
            
write_coord(iorigin[2]);
            
message_end();  
            }
                
cs_reset_user_model(player)
            } else {
                new 
limit_setting get_cvar_num("mp_limitteams")
                
                
set_cvar_num("mp_limitteams"0)
                
engclient_cmd(player"jointeam"g_CSTeamNumbers[g_menuOption[id] % 2])
                
engclient_cmd(player"joinclass""1")
                
set_cvar_num("mp_limitteams"limit_setting)
            }

            
displayTeamMenu(idg_menuPosition[id])
        }
    }
    
    return 
PLUGIN_HANDLED
}

stock setUserTeam_cs(index,team,respawn=0,updatescoreboard=1) {
  if(
is_user_connected(index)) {
    if(
team >= && team <= 3) {
      
set_pdata_int(index114team)
      if(
is_user_alive(index)) 
      {
        
engclient_cmd(index"drop""weapon_c4")
        if(
team != 2)
        {
          new 
defuser get_pdata_int(index193)
          if(
defuser & (1<<16)) 
          {
            
defuser -= (1<<16)
            
set_pdata_int(index193defuser)
          }
          
message_begin(MSG_ONEget_user_msgid("StatusIcon"), {0,0,0}, index)
          
write_byte(0)
          
write_string("defuser")
          
write_byte(0)
          
write_byte(255)
          
write_byte(0)
          
message_end()
        }
        else
        {
          if(
team == 3)
           {
              
user_silentkill(index)
              return 
0;
           }
        }
      }
      if(
respawn)
      {
        new 
health get_user_health(index)
        new 
armor get_user_armor(index)
        
set_pev(indexpev_spawnflags3)
        
dllfunc(DLLFunc_Spawnindex)
        
set_pev(indexpev_iuser10)
        
set_pev(indexpev_healthfloat(health))
        
set_pev(indexpev_armorvaluefloat(armor))
      }
      if(
updatescoreboard) {
        
message_begin(MSG_ALLget_user_msgid("TeamInfo"))
        
write_byte(index)
        switch(
team) {
          case 
1write_string("TERRORIST")
          case 
2write_string("CT")
        }
        
message_end()
      }
      return 
1
    
}
  }
  return 
0

I checked if team == 3 which means spectator and then added user_silentkill function . Also i checked team to avoid teleporting the spectator.
sorry not work :/
still not die when i transfer to spectators
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 07-27-2016 , 17:01   Re: [HELP] fix transfer player in plmenu
Reply With Quote #8

please help guys
__________________
arvEL. is offline
Send a message via Skype™ to arvEL.
Old 07-27-2016, 19:23
addons_zz
This message has been deleted by addons_zz. Reason: wrong code
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 07-27-2016 , 19:35   Re: [HELP] fix transfer player in plmenu
Reply With Quote #9

Think about it:
Code:
        engclient_cmd(index, "drop", "weapon_c4")         if(team != 2)         {           new defuser = get_pdata_int(index, 193)           if(defuser & (1<<16)) {             defuser -= (1<<16)             set_pdata_int(index, 193, defuser)           }           message_begin(MSG_ONE, get_user_msgid("StatusIcon"), {0,0,0}, index)           write_byte(0)           write_string("defuser")           write_byte(0)           write_byte(255)           write_byte(0)           message_end()         }
-->
Code:
        engclient_cmd(index, "drop", "weapon_c4")         switch(team)         {             case _:CS_TEAM_T:             {                 new defuser = get_pdata_int(index, 193)                 if(defuser & (1<<16))                 {                     defuser -= (1<<16)                     set_pdata_int(index, 193, defuser)                 }             }             case _:CS_TEAM_CT:             {                 message_begin(MSG_ONE, get_user_msgid("StatusIcon"), {0,0,0}, index)                 write_byte(0)                 write_string("defuser")                 write_byte(0)                 write_byte(255)                 write_byte(0)                 message_end()             }             case _:CS_TEAM_SPECTATOR:             {                 user_silentkill(index)             }         }
If does not work, attach the full code.

Attachment example:
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 07-27-2016 at 20:02. Reason: misspellings
addons_zz 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 03:00.


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