Raised This Month: $109 Target: $400
 27% 

Why doesn't this code work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-13-2006 , 19:14   Why doesn't this code work?
Reply With Quote #1

Hi, this code is "supposed" to play a sound when say_team is used, to ONLY the team of the player that typed. I don't know why it doesn't work, and hoping some of you elite coders can help me debug it.

Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_clcmd("say_team", "chatSoundTeam"); } public chatSoundTeam(id) {     new CsTeams:teamSaid = cs_get_user_team(id);     new players[32], playersDead[32];     new playerCount, i, playerCountDead, iDead;         get_players(players, playerCount, "a");     for(i=0; i<playerCount; i++) {         if(cs_get_user_team(i) == teamSaid) {             client_cmd(i, "speak sound/testing/talk.wav");         }     }         if(is_user_alive(id)) {         return PLUGIN_CONTINUE;     }     get_players(playersDead, playerCountDead, "b");     for(iDead=0; iDead<playerCountDead; iDead++) {         if(cs_get_user_team(iDead) == teamSaid) {             client_cmd(iDead, "speak sound/testing/talk.wav");         }     }         return PLUGIN_CONTINUE; }
hlstriker is offline
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-13-2006 , 19:41   Re: Why doesn't this code work?
Reply With Quote #2

client_cmd(i, "speak sound/testing/talk.wav");Shouldent it be spk instead of speak? I think it should
bloodypizza is offline
Send a message via MSN to bloodypizza
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-13-2006 , 19:42   Re: Why doesn't this code work?
Reply With Quote #3

No, that works fine, it's something to do with the cs_get_user_team or something. Not to sure : / I just know speak works hehe
hlstriker is offline
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-13-2006 , 19:51   Re: Why doesn't this code work?
Reply With Quote #4

Does it work when you remove

if(cs_get_user_team(i) == teamSaid) {


}
?
BTW, you should post the whole code (#include thepiratebaymodule)

Last edited by bloodypizza; 09-13-2006 at 19:53.
bloodypizza is offline
Send a message via MSN to bloodypizza
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-13-2006 , 19:52   Re: Why doesn't this code work?
Reply With Quote #5

Yes
hlstriker is offline
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-13-2006 , 19:55   Re: Why doesn't this code work?
Reply With Quote #6

new CsTeams:teamSaid = cs_get_user_team(id);to:
new teamSaid = cs_get_user_team(id);

or

if(cs_get_user_team(i) == teamSaid) {
to
if(cs_get_user_team(i) == CsTeams:teamSaid) {
does it work then?
bloodypizza is offline
Send a message via MSN to bloodypizza
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 09-13-2006 , 19:56   Re: Why doesn't this code work?
Reply With Quote #7

When you use get_players it stores the player id into the array. So to use it you need to do. players[i]

Code:
cs_get_user_team(players[i])

Same for the other get_players you used. You need to access it by using the array.

Code:
cs_get_user_team(playersDead[iDead])
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 09-13-2006 at 19:58.
teame06 is offline
Send a message via AIM to teame06
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:25.


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