Raised This Month: $ Target: $400
 0% 

Team Alert -Version 2.0 Coming soon.


Post New Thread Reply   
 
Thread Tools Display Modes
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 07-18-2006 , 09:06   Re: Team Alert ::v1.5::
Reply With Quote #51

Replace the showteam function with the following as see if it fixes your problem.
Code:
public showteam(id) {     if(!get_cvar_num("sv_teamalert"))     {         return PLUGIN_HANDLED     }         new CsTeams:playerTeam = cs_get_user_team(id)         if(get_cvar_num("sv_tatext") && is_user_connected(id))     {         switch(playerTeam)         {             case CS_TEAM_CT:             {                 set_hudmessage(0, 0, 255, 0.42, 0.53, 2, 6.0, 4.0, 0.1, 0.2, -1)                 show_hudmessage(id, "Your Current Team is CT")             }             case CS_TEAM_T:             {                 set_hudmessage(255, 0, 0, 0.42, 0.53, 2, 6.0, 4.0, 0.1, 0.2, -1)                 show_hudmessage(id, "Your Current Team is T")             }         }     }     if(get_cvar_num("sv_tafade") && is_user_connected(id))     {         switch(playerTeam)         {             case CS_TEAM_CT:             {                 set_task(0.1,"ct_fade",id)             }             case CS_TEAM_T:             {                 set_task(0.1,"t_fade",id)             }         }     }     return PLUGIN_CONTINUE }
I went for the simplest bandaid I could. IMO, the plugin needs to be refactored.


Edit:

@allenwr:

I suggest removing the following three commands. Rationale being that none of them will be called with any regularity and the functionality of each can be, and is being, handled by CVARs. Therefore they are useless at best. They unnecessarily add to the size and complexity of both your code and the amx_help command listing.

Code:
    register_concmd("amx_teamalert","alert10",ADMIN_CVAR,"1/0 Turns Team Alert on or off") //commands     register_concmd("amx_tafade","fade10",ADMIN_CVAR,"1/0 Turns color fade on or off")     register_concmd("amx_tatext","text10",ADMIN_CVAR,"1/0 Turns Printed Message fade on or off")

I also recommend you change your get_cvar_ functions with the get_pcvar_ family of functions. They are more efficient.
__________________

Last edited by Brad; 07-18-2006 at 09:20. Reason: Needed to get some more things off my chest.
Brad is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 07-18-2006 , 09:29   Re: Team Alert ::v1.5::
Reply With Quote #52

Will do when i rescript it, and those concmds, are just to make it easier for admins to edit the cvars...
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 07-18-2006 , 10:07   Re: Team Alert ::v1.6::
Reply With Quote #53

That's not a good argument. The difference between amx_cvar sv_teamalert 0 and amx_teamalert 0 is minimal. And that's just for changing them mid-game, which will be done very rarely.

It's MUCH more likely that they'll add the approriate CVARs to their amxx.cfg file or to specific map cfg files. Then, it's even easier... They just put sv_teamalert 0 in the config file.

Heck, this wasn't the best example as there already is a command to enable and disable plugins, thus sv_teamalert itself isn't needed.
__________________
Brad is offline
qsush
Member
Join Date: Apr 2006
Location: Germany
Old 07-18-2006 , 13:10   Re: Team Alert ::v1.5::
Reply With Quote #54

Quote:
Originally Posted by Brad
Replace the showteam function with the following as see if it fixes your problem.
Code:
public showteam(id) {     if(!get_cvar_num("sv_teamalert"))     {         return PLUGIN_HANDLED     }         new CsTeams:playerTeam = cs_get_user_team(id)         if(get_cvar_num("sv_tatext") && is_user_connected(id))     {         switch(playerTeam)         {             case CS_TEAM_CT:             {                 set_hudmessage(0, 0, 255, 0.42, 0.53, 2, 6.0, 4.0, 0.1, 0.2, -1)                 show_hudmessage(id, "Your Current Team is CT")             }             case CS_TEAM_T:             {                 set_hudmessage(255, 0, 0, 0.42, 0.53, 2, 6.0, 4.0, 0.1, 0.2, -1)                 show_hudmessage(id, "Your Current Team is T")             }         }     }     if(get_cvar_num("sv_tafade") && is_user_connected(id))     {         switch(playerTeam)         {             case CS_TEAM_CT:             {                 set_task(0.1,"ct_fade",id)             }             case CS_TEAM_T:             {                 set_task(0.1,"t_fade",id)             }         }     }     return PLUGIN_CONTINUE }
I went for the simplest bandaid I could. IMO, the plugin needs to be refactored.
I does that and compiled it, the compiler say´s me this:
warning 217: loose indentation
__________________

qsush is offline
Send a message via ICQ to qsush Send a message via AIM to qsush Send a message via MSN to qsush Send a message via Yahoo to qsush
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 07-18-2006 , 13:22   Re: Team Alert ::v1.6::
Reply With Quote #55

Ignore that warning for now. Apparently allenwr used spaces while I use tabs to indent.
__________________
Brad is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 07-18-2006 , 15:20   Re: Team Alert ::v1.6::
Reply With Quote #56

I tab BTW
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
mercury
Member
Join Date: Jun 2004
Old 07-18-2006 , 19:10   Re: Team Alert ::v1.6::
Reply With Quote #57

Quote:
This Plugin tells a player what team he is on at the start of every round.
Quote:
This Plugin alerts a player what team he or she has join / been transfered too
so this plugin will notify players on every round start or only after player has join a team or has been transferred?
__________________
mercury is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 07-18-2006 , 19:26   Re: Team Alert ::v1.6::
Reply With Quote #58

It displays the message everyround upon joining a team, spectators do not see this message. and if they player is transfered, at the start of the next round the player will see his new team.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
mercury
Member
Join Date: Jun 2004
Old 07-18-2006 , 21:02   Re: Team Alert ::v1.6::
Reply With Quote #59

first of all, it's great plugin. this functionality should be definitely included in PTB Team Balancer. Displaying these messages on every round start seem to be annoying. So i suggest to show them only when player has changed team or has been transfered.. imo. it can be optional by cvar.
__________________
mercury is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 07-18-2006 , 21:38   Re: Team Alert ::v1.6::
Reply With Quote #60

Good idea, but unfortunatly, I do not currently know how to find out if a player has changed teams, or if this is definable...

This recommendation will stay on note.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
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 22:46.


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