AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   this is simple but i just cant figure it out (https://forums.alliedmods.net/showthread.php?t=51581)

Voi 02-20-2007 12:53

this is simple but i just cant figure it out
 
Code:

public client_putinserver(id)
{

  if(g_crowd[id] == 0)
    {
    g_crowd[id] = 1
    set_task(1.0, "crowd_sound")
    }
    else
    {
    return PLUGIN_HANDLED
    }
}
public crowd_sound(id)
{

        client_cmd(id, "spk voi/sj/crowd_b1")

}

i want to play sound of crowd in map soccerjam to each player on connect(and this has to be only once since the sound is looped), but this is actually called everytime player is connected(so the client_cmd is called to player when each player gets connected and sound is played multiple times), how do i fix this ?

organizedKaoS 02-20-2007 15:03

Re: this is simple but i just cant figure it out
 
Your not declaring id in the set task parameters.

So set task is executing on all clients, not just the one client you want.

Also, if(g_crowd[id] == 0) is the same as if(!g_crowd[id]).

Voi 02-20-2007 16:05

Re: this is simple but i just cant figure it out
 
Quote:

Originally Posted by organizedKaoS (Post 442970)

So set task is executing on all clients, not just the one client you want.

uh, so how to do this ?
btw thx for reply

organizedKaoS 02-20-2007 19:28

Re: this is simple but i just cant figure it out
 
set_task(1.0, "task", id)

Voi 02-20-2007 19:39

Re: this is simple but i just cant figure it out
 
aahhh, i didnt saw this was missing :D thx


All times are GMT -4. The time now is 00:36.

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