AlliedModders (
-   Scripting Help (
-   -   Why doesn't this code work? (

hlstriker 09-13-2006 19:14

Why doesn't this code work?
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.

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; }

bloodypizza 09-13-2006 19:41

Re: Why doesn't this code work?
client_cmd(i, "speak sound/testing/talk.wav");Shouldent it be spk instead of speak? I think it should

hlstriker 09-13-2006 19:42

Re: Why doesn't this code work?
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

bloodypizza 09-13-2006 19:51

Re: Why doesn't this code work?
Does it work when you remove

if(cs_get_user_team(i) == teamSaid) {

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

hlstriker 09-13-2006 19:52

Re: Why doesn't this code work?

bloodypizza 09-13-2006 19:55

Re: Why doesn't this code work?
new CsTeams:teamSaid = cs_get_user_team(id);to:
new teamSaid = cs_get_user_team(id);


if(cs_get_user_team(i) == teamSaid) {
if(cs_get_user_team(i) == CsTeams:teamSaid) {
does it work then?

teame06 09-13-2006 19:56

Re: Why doesn't this code work?
When you use get_players it stores the player id into the array. So to use it you need to do. players[i]


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


All times are GMT -4. The time now is 22:56.

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