AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me PLZ. (https://forums.alliedmods.net/showthread.php?t=62873)

sQn 11-06-2007 13:10

Help me PLZ.
 
Hey.Sry for my bad en. I wont sounds when user is disconnected, but i wont sounds if he was on stats list TAB PRESS [no he dowload my server files and disconnected, but play on my server and disconnected] Help me PLZ this is my plug-in:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#define PLUGIN "LeAvE SoUnDs"
#define VERSION "0.1"
#define AUTHOR "sQn"
#define MIN_LEAVE 0.1
#define MAX_LEAVE 6.0
new wital[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("ResetHUD", "leave_event", "be")

}
public plugin_precache()
{
precache_sound("FtF/konczyc.wav")
precache_sound("FtF/naraska.wav")
precache_sound("FtF/3maj.wav")
precache_sound("FtF/cya.wav")
precache_sound("FtF/narka.wav")
precache_sound("FtF/elo.wav")
}
public client_putinserver( id )
{
wital[id] = 1
}

public client_disconnect( id )
{
wital[id] = 0
}
public client_connect( id )
{
wital[id] = 1
}
public leave_event(id)
{
if(!(wital[id] == 0))
{
set_task(random_float(MIN_LEAVE, MAX_LEAVE),"greetings",id)
wital[id] = 0
}
}
public greetings( id )
{
if (!(wital[id] == 0))
{
wital[id] = 0
new randomizer[33]
randomizer[id] = (random_num(1,6))

if(randomizer[id] == 1)
{
emit_sound(id, CHAN_AUTO, "FtF/konczyc.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if(randomizer[id] == 2)
{
emit_sound(id, CHAN_AUTO, "FtF/naraska.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if(randomizer[id] == 3)
{
emit_sound(id, CHAN_AUTO, "FtF/3maj.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if(randomizer[id] == 4)
{
emit_sound(id, CHAN_AUTO, "FtF/cya.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if(randomizer[id] == 5)
{
emit_sound(id, CHAN_AUTO, "FtF/narka.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else if(randomizer[id] == 6)
{
emit_sound(id, CHAN_AUTO, "FtF/elo.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}

}
return PLUGIN_HANDLED
}

Styles 11-06-2007 13:52

Re: Help me PLZ.
 
I don't understand what you want exactly. When a player leaves there is a sound played ( To him or everyone? ). Also, whats the thing about players with stats?

try this though. This will play a sound on HIM leaving ot him.
Code:

#include <amxmodx>
#define PLUGIN "Leave Sounds"
#define VERSION "1.0"
#define AUTHOR "Amxx Community"


public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
}

public plugin_precache()
{
        precache_sound("FtF/konczyc.wav")
        precache_sound("FtF/naraska.wav")
        precache_sound("FtF/3maj.wav")
        precache_sound("FtF/cya.wav")
        precache_sound("FtF/narka.wav")
        precache_sound("FtF/elo.wav")
}

public client_disconnect(id)
{
        new rand = (random_num(1,6))

        if(rand == 1)
                emit_sound(id, CHAN_AUTO, "FtF/konczyc.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        else if(rand == 2)
                emit_sound(id, CHAN_AUTO, "FtF/naraska.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        else if(rand == 3)
                emit_sound(id, CHAN_AUTO, "FtF/3maj.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        else if(rand == 4)
                emit_sound(id, CHAN_AUTO, "FtF/cya.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        else if(rand == 5)
                emit_sound(id, CHAN_AUTO, "FtF/narka.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        else if(rand == 6)
                emit_sound(id, CHAN_AUTO, "FtF/elo.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
       
}


sQn 11-06-2007 14:03

Re: Help me PLZ.
 
Quote:

Originally Posted by sQn (Post 550152)
I don't understand what you want exactly. When a player leaves there is a sound played ( To him or everyone? ). Also, whats the thing about players with stats?

I want sounds played for erveryone when player leaves server.

M249-M4A1 11-06-2007 14:06

Re: Help me PLZ.
 
Um, I guess you could just change (in the original script)

This line
PHP Code:

emit_sound(idCHAN_AUTO"FtF/cya.wav"1.0ATTN_NORM0PITCH_NORM

To:
PHP Code:

client_cmd(0"spk ^"FtF/cya.wav^""


Styles 11-06-2007 14:08

Re: Help me PLZ.
 
Quote:

Originally Posted by M249-M4A1 (Post 550174)
Um, I guess you could just change (in the original script)

This line
PHP Code:

emit_sound(idCHAN_AUTO"FtF/cya.wav"1.0ATTN_NORM0PITCH_NORM

To:
PHP Code:

client_cmd(0"spk ^"FtF/cya.wav^""



Dam you! I was doing that as we speek! StOP! GOD! M249 you must be really bored.

update:
Code:

#include <amxmodx>

#define PLUGIN "Leave Sounds"
#define VERSION "1.0"
#define AUTHOR "Amxx Community"


public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
}

public plugin_precache()
{
        precache_sound("FtF/konczyc.wav")
        precache_sound("FtF/naraska.wav")
        precache_sound("FtF/3maj.wav")
        precache_sound("FtF/cya.wav")
        precache_sound("FtF/narka.wav")
        precache_sound("FtF/elo.wav")
}

public client_disconnect(id)
{
        new rand = (random_num(1,6))

        if(rand == 1)
                client_cmd(0, "spk ^"FtF/konczyc.wav^"")
        else if(rand == 2)
                client_cmd(0, "spk ^"FtF/naraska.wav^"")
        else if(rand == 3)
                client_cmd(0, "spk ^"FtF/3maj.wav^"")
        else if(rand == 4)
                client_cmd(0, "spk ^"FtF/cya.wav^"")
        else if(rand == 5)
                client_cmd(0, "spk ^"FtF/narka.wav^"")
        else if(rand == 6)
                client_cmd(0, "spk ^"FtF/elo.wav^"")
       
}

Does this work though M249,
emit_sound(0, CHAN_AUTO, "FtF/cya.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

I wasn't sure so I didn't want to risk doing it since lol it wouldn't work.

ConnorMcLeod 11-06-2007 14:12

Re: Help me PLZ.
 
Quote:

Originally Posted by styles (Post 550165)
Code:
public client_disconnect(id) {     new rand = (random_num(1,6))     if(rand == 1)         emit_sound(id, CHAN_AUTO, "FtF/konczyc.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     else if(rand == 2)         emit_sound(id, CHAN_AUTO, "FtF/naraska.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     else if(rand == 3)         emit_sound(id, CHAN_AUTO, "FtF/3maj.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     else if(rand == 4)         emit_sound(id, CHAN_AUTO, "FtF/cya.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     else if(rand == 5)         emit_sound(id, CHAN_AUTO, "FtF/narka.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     else if(rand == 6)         emit_sound(id, CHAN_AUTO, "FtF/elo.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     }

This won't work. When client_disconnect is called, the player is disconnected.

sQn 11-06-2007 14:31

Re: Help me PLZ.
 
But that beguile zrobic in order to played all [ it (him) ] plug-in dzialal.Ja che zeby dzwiek byl oprocz, when given player server opusci

sQn 11-06-2007 14:39

Re: Help me PLZ.
 
It wants in order to player erverybody listen sounds as one player server leaves

ConnorMcLeod 11-06-2007 14:41

Re: Help me PLZ.
 
Something like this :

Code:
#include <amxmodx> #if AMXX_VERSION_NUM < 180     #define charsmax(%1)    sizeof(%1) - 1 #endif #define PLUGIN "Leave Sounds" #define VERSION "1.0" #define AUTHOR "Amxx Community" new const soundlist[][] = {     "konczyc.wav",     "naraska.wav",     "3maj.wav",     "cya.wav",     "narka.wav",     "elo.wav" } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public plugin_precache() {     new file[32]     for(new i; i<sizeof soundlist; i++)     {         formatex(file, charsmax(file), "FtF/%s", soundlist[i])         precache_sound(file)     } } public client_disconnect(id) {     new rand = random_num(0, charsmax(soundlist))     client_cmd(0, "spk FtF/%s", soundlist[rand]) }

sQn 11-06-2007 14:51

Re: Help me PLZ.
 
I try this, but not close this topic [I say when this code will be bad]


All times are GMT -4. The time now is 01:23.

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