AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to switch a player of team in game without slaying him ? (https://forums.alliedmods.net/showthread.php?t=30049)

speedycvc 06-21-2006 07:33

How to switch a player of team in game without slaying him ?
 
Hi, I want to know if I am not wrong about this idea:
I want to switch a player for example a terror in ct team, he is alive and I want to switch Him by the team menu. Evidently, I want to switch him without slaying him.

I think this is in the player menu. sma that I have to change something.

In this plug I find:

/* Team menu */

....
....
....
....

switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%L",id,"ADMIN_TRAN SF_2",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" )
case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRAN SF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
}

new limitt = get_cvar_num("mp_limitteams")
set_cvar_num("mp_limitteams",0)
user_kill(player,1) I think that I have to change the value to "0"
engclient_cmd(player, "chooseteam")
engclient_cmd(player, "menuselect", g_menuOption[id] ? "1" : "2" )
engclient_cmd(player, "menuselect", "5")
client_cmd(player,"slot1")
set_cvar_num("mp_limitteams",limitt)

displayTeamMenu(id,g_menuPosition[id])


Do you think that it's all ?

SweatyBanana 06-21-2006 07:37

Wait to execute it until you know the user has died or the end of the round.

Cheap_Suit 06-21-2006 07:39

Code:
/* Set user team without killing player.  * If model is anything other than CS_DONTCHANGE, that will be set as player's model.  */ native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE); eg. cs_set_user_team(id, CS_TEAM_CT)

speedycvc 06-21-2006 07:51

Quote:

Originally Posted by SweatyBanana
Wait to execute it until you know the user has died or the end of the round.

SweatyBanana it is really interessant, but I know that! This IS exactly why I search a different solution!
Cheap_Suit I don't understand where I put this script? Is it an independant ittle plug to compile ?

Cheap_Suit 06-21-2006 08:03

Remove all of this:
Code:
engclient_cmd(player, "chooseteam") engclient_cmd(player, "menuselect", g_menuOption[id] ? "1" : "2" ) engclient_cmd(player, "menuselect", "5") client_cmd(player,"slot1")

and add this
Code:
cs_set_user_team(id, g_menuOption[id])

and include cstrike:
Code:
#include <cstrike>

VEN 06-21-2006 09:37

Actually should be
Code:
cs_set_user_team(player, g_menuOption[id] ? CS_TEAM_T : CS_TEAM_CT)
Because g_menuOption[id] can be 1 or 0, and you need CsTeams:1 or CsTeams:2.
CsTeams tag is needed because obviously that he is using old amxx version (take a look at the code) and old cstrike.inc doesn't support untagged team variable for cs_set_user_team native.


All times are GMT -4. The time now is 07:59.

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