Team Changer

Started by SchlumPF
05/10/2008 13:39
Page 1 of 2
SchlumPF05/10/2008 13:39(edited 06/04/2009 10:58)

This plugin is SAFE for demo recording. -SchlumPF

Team Changer

Description
This plugin allows players to switch their team, even if the teamchooser is blocked or the 'switch to spectators' button does not appear.

Requires AMXX 1.8 or later

DOWNLOAD ME!

PepoMerca07/10/2008 05:47

Gj, downloading :D

drumandbass07/11/2008 01:46

big thx

Alucard^05/04/2009 17:36(edited 05/04/2009 21:59)

i need to ask something...

i made this simple plugin:

[blockquote]#include
#include
#include

new const g_BlankInfo[] = "";

new nv_disableteam
new CsTeams:zTeam[33]

public plugin_init()
{
register_plugin( "nV Spec", "1.0", "Alucard" )
register_clcmd("chooseteam", "changeteam", -1, g_BlankInfo)
register_clcmd("say /spec", "spec")
register_clcmd("say_team /spec", "spec")
register_clcmd("say /spect", "spec")
register_clcmd("say_team /spect", "spec")
register_clcmd("say /unspec", "back")
register_clcmd("say_team /unspec", "back")
register_clcmd("say /ct", "ct")
register_clcmd("say_team /ct", "ct")
register_clcmd("say /t", "tt")
register_clcmd("say_team /t", "tt")

nv_disableteam = register_cvar("nv_disableteams", "1")
}

public changeteam(id)
{
return (get_pcvar_num(nv_disableteam) == 1 ) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}

public spec(id)
{
zTeam[id] = cs_get_user_team(id)

if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
cs_set_user_team(id, CS_TEAM_CT)

else

cs_set_user_team(id, CS_TEAM_SPECTATOR)
user_kill(id, 1)
client_print(1, print_chat, "Para salir de spec: /unspec o /ct y /t.")
return 1
}

public back(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
cs_set_user_team(id, zTeam[id])
return 1
}

public ct(id)
{
cs_set_user_team(id, CS_TEAM_CT)
user_kill(id, 1)
return 1
}

public tt(id)
{
cs_set_user_team(id, CS_TEAM_T)
user_kill(id, 1)
return 1
}[/blockquote]

but, now i see ur plugin and.. i need to now what plugin i have to use?

why ur plugin is better than this? i am saying that ur plugin is the same (in code), but i dont know why is better... more fast? less CPU usage? or what?

thx

Alucard^05/04/2009 17:40(edited 05/04/2009 17:41)

well sry for doble post but... i posted without [ CODE] bbcode and... i tried to edit the post but:

http://img217.imageshack.us/img217/3711/asddsa.jpg

SchlumPF05/04/2009 22:02

well, basically both plugins do the same but my code is a lot cleaner. anyway yours should be slightly faster cuz mine is interacting more often with the modules than yours but this doesnt matter since both plugins just do things which are not called very often.

kielorz06/04/2009 09:51

schlumpf your plugin dont transfer ct(t)-spec correctly
there should be user_kill( plr ); or hlsdk code of transferring but not set_pev( plr, pev_deadflag, DEAD_DISCARDBODY );

SchlumPF06/04/2009 10:59

but my plugin works, doesnt it? as long as it works and DEAD_DISCARDBODY should everything will be fine. if anything does not work, tell me and ill fix it cuz i wasnt able to test this plugin myself since Ham_CsRoundRespawn is crashing my server.

adidasd06/04/2009 12:05

shclum i got another team changer which user /spec and /ct commands , i think its better than yours , or maybe u can combine them

SchlumPF06/04/2009 12:48

send me the source although i should really update some of my plugins... for example this: found a few things i should add ^^

Alucard^07/04/2009 04:32

schlumpf... is posible to add the "SPECTATOR" option in the canger team menu? when u are dead or alive... i think u understand..

cuz if u press M to change team... and u are alive, u cant change to spec...

if not, u can made a menu using M? i know this is posible cuz i have a plugin like that but is very bug... tell me if u need the source..

SchlumPF07/04/2009 10:05

allow_spectators 1; sv_restart 1

adidasd07/04/2009 11:19(edited 07/04/2009 11:20)

Here is which i got :)
[blockquote]#include
#include
#include
#include
#include

#define MAXPLAYER 32

enum Color
{
YELLOW = 1,
GREEN,
TEAM_COLOR,
GREY,
RED,
BLUE,
}

new TeamInfo
new SayText
new MaxSlots

new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}

new bool:IsConnected[MAXPLAYER + 1]

new PLUGIN[]="Team Change"
new AUTHOR[]="st0ka"
new VERSION[]="1.00"

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_concmd("say /ct","team_ct")
register_concmd("say_team /ct","team_ct")
register_concmd("say /spec","team_spec")
register_concmd("say_team /spec","team_spec")
register_concmd("say /respawn","player_respawn")
register_concmd("say_team /respawn","player_respawn")
TeamInfo = get_user_msgid("TeamInfo")
SayText = get_user_msgid("SayText")
MaxSlots = get_maxplayers()
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
}

public team_ct(id)
{
new CsTeams:team = cs_get_user_team(id)
if (team == CS_TEAM_CT)
{
return PLUGIN_HANDLED
}
else
{
cs_set_user_team(id,CS_TEAM_CT,CS_DONTCHANGE)
cs_user_spawn(id)
give_item(id,"weapon_knife")
give_item(id,"weapon_usp")
give_item(id,"weapon_usp")
give_item(id,"weapon_usp")
new playerName[33]
get_user_name(id,playerName,32)
ColorChat(0,BLUE,"%s has been switched to CT",playerName)
}
return PLUGIN_HANDLED
}

public team_spec(id)
{
new CsTeams:team = cs_get_user_team(id)
if (team == CS_TEAM_SPECTATOR)
{
return PLUGIN_HANDLED
}
else
{
entity_set_int(id,EV_INT_deadflag,DEAD_DISCARDBODY)
cs_set_user_team(id,CS_TEAM_SPECTATOR,CS_DONTCHANGE)
new playerName[33]
get_user_name(id,playerName,32)
ColorChat(0,GREY,"%s has been switched to Spectator",playerName)
}
return PLUGIN_HANDLED
}

public player_respawn(id)
{
new CsTeams:team = cs_get_user_team(id)
if (team == CS_TEAM_SPECTATOR)
{
return PLUGIN_HANDLED
}
else if (!is_user_alive(id))
{
cs_user_spawn(id)
give_item(id,"weapon_knife")
give_item(id,"weapon_usp")
give_item(id,"weapon_usp")
give_item(id,"weapon_usp")
new playerName[33]
get_user_name(id,playerName,32)
ColorChat(0,RED,"%s has been respawned",playerName)
}
return PLUGIN_HANDLED
}

public client_putinserver(player)
{
IsConnected[player] = true
}

public client_disconnect(player)
{
IsConnected[player] = false
}

public ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
static message[256]
switch(type)
{
case YELLOW:
{
message[0] = 0x01
}
case GREEN:
{
message[0] = 0x04
}
default:
{
message[0] = 0x03
}
}
vformat(message[1], 251, msg, 4)
message[192] = '^0'
new team, ColorChange, index, MSG_Type
if(!id)
{
index = FindPlayer()
MSG_Type = MSG_ALL
}
else
{
MSG_Type = MSG_ONE
index = id
}
team = get_user_team(index)
ColorChange = ColorSelection(index, MSG_Type, type)
ShowColorMessage(index, MSG_Type, message)
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team])
}
}

ShowColorMessage(id, type, message[])
{
message_begin(type, SayText, _, id)
write_byte(id)
write_string(message)
message_end()
}

Team_Info(id, type, team[])
{
message_begin(type, TeamInfo, _, id)
write_byte(id)
write_string(team)
message_end()
return 1
}

ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1])
}
case BLUE:
{
return Team_Info(index, type, TeamName[2])
}
case GREY:
{
return Team_Info(index, type, TeamName[0])
}
}
return 0
}

FindPlayer()
{
new i = -1
while(i <= MaxSlots)
{
if(IsConnected[++i])
{
return i
}
}
return -1
}[/blockquote]

kielorz07/04/2009 12:54(edited 07/04/2009 13:05)

ljstats isn't shown in spec whit your plugin:)

SchlumPF07/04/2009 15:18

thats a ljstats bug :/

adidasd07/04/2009 18:18

schlump, could u edit my found plugin, because it teleport uu to spec with spectator,but so i cant see what ct ar writing :((, could u make to i look like DEAD CT , and i cant watch CT team :) Please, or just i dont know how to make that all can talk :(

kielorz08/04/2009 06:20

SchlumPF - newest version of ljstats hasn't got this bug, if you don't believe me ask Lt.RAT for sure

SchlumPF08/04/2009 13:54

im just forcing the player to die, there not fault in this plugin, seriously.

kielorz08/04/2009 14:15

try using user_kill( plr ); instead of DEAD_DISCARDBODY and see the result(ljs new version)
and also disable specinfo or modify it from hudmsg channels 1 and 2 to 3 and 4

Alucard^09/04/2009 22:06

maybe have incompatibiltys with the ljstats plugin but the plugin of schlumpf dont have bugs o.o..

btw,

Originally posted by adidasd
schlump, could u edit my found plugin, because it teleport uu to spec with spectator,but so i cant see what ct ar writing :((, could u make to i look like DEAD CT , and i cant watch CT team :) Please, or just i dont know how to make that all can talk :(


http://www.amxmodx.org/compiler.php?mod=1&cat=0&plugin=allchat&author=&go=search

Page 1 of 2

Please log in to post replies.