Raised This Month: $51 Target: $400
 12% 

Plugin Welcome Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Danvic
New Member
Join Date: Jan 2013
Old 08-12-2014 , 18:58   Plugin Welcome Sound
Reply With Quote #1

Hi guys, i need help to complete my plugin, i was create that plugin for play sound when player connect to my server, but I need only the player that connects listen to the sound, but do not know how to do, is playing for all to hear even if another player connects you hear.

Could anyone help me please ?!

Thanks in advance and sorry for my english ...

FYI: Danvic


Code:
  #include <amxmodx> 

public plugin_init() 
{
register_plugin("WelcomeSound","1.0","nOSounD")
register_event("SendAudio", "client_putinserver", "a", "2&%!MRAD_client_putinserver")
}
  
  public client_putinserver() 
  
{
  new rand = random_num(0,0)

  client_cmd(0,"stopsound")

  switch(rand)
  {
    case 0: client_cmd(0,"spk misc/welcomesound/player_connect0")

  }

  return PLUGIN_CONTINUE
}

public plugin_precache() 
{
  precache_sound("misc/welcomesound/player_connect0.wav")

  return PLUGIN_CONTINUE
 }
Danvic is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 08-12-2014 , 19:42   Re: Plugin Welcome Sound
Reply With Quote #2

client_cmd(0
0 = all players ...
You can try with id but you need (set_task... )
ex:
PHP Code:
public client_putinserver(id
    
set_task(5.0,"start_music",id)
public 
start_music(id
    
client_cmd(id,"spk misc/welcomesound/player_connect0")
    
public 
plugin_precache() 
{
    
precache_sound("misc/welcomesound/player_connect0.wav")
    return 
PLUGIN_CONTINUE

__________________

Last edited by Eagle07; 08-12-2014 at 19:42.
Eagle07 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 08-12-2014 , 19:43   Re: Plugin Welcome Sound
Reply With Quote #3

Code:
client_cmd(0,"spk misc/welcomesound/player_connect0")
Your problem is here, you need to get the index of the player.

Also, your plugin is poorly coded. You should look at some other plugins for reference or just use one of them.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Danvic
New Member
Join Date: Jan 2013
Old 08-13-2014 , 17:05   Re: Plugin Welcome Sound
Reply With Quote #4

Thanks guys!!! i will try to solve it now, i will use
PHP Code:
set_task 
, but I need to use more than one task, how do?

I tried using this way:

PHP Code:
  #include <amxmodx>
  #define TASK_ONE 9283
  #define TASK_TWO 2973
  

public plugin_init() 
{    
register_plugin("WelcomeSound","1.0","nOSounD")
register_event("SendAudio""client_putinserver""a""2&%!MRAD_client_putinserver")
}

public 
client_putinserver() 
        
    
enum (+= 1234)
{
TASK_ONE,9283
TASK_TWO
,2973
}
{
    
TASK_ONE(3.0"start_music"id 9283_task)
}
{

    
TASK_TWO(5.0"welcome"id 2973_task)
    
        return 
PLUGIN_CONTINUE
}

public 
start_music9283_task 

{
    
client_cmd(id,"spk misc/welcomesound/player_connect0")
    
        return 
PLUGIN_CONTINUE
}

public 
welcome2973_task 


new 
name 32 
get_user_nameidname31 
set_hudmessage(02550, -1.0, -1.0)
show_hudmessage(id"Welcome to MK-Line Server Game")

    return 
PLUGIN_CONTINUE
}

public 
plugin_precache() 

{
    
precache_sound("misc/welcomesound/player_connect0.wav")
    return 
PLUGIN_CONTINUE

But dont works, are experiencing some errors when compiling, and I have tried to solve them, but I can not, do not know how ... it's the first time I'm doing plugins ... always just edited, but also wanted to learn to do ... anyway, thanks for the help you are giving me is helping a lot !!!


PS: I will give feedback, if i fix problems (Sound Working!!!)

Last edited by Danvic; 08-13-2014 at 19:38.
Danvic is offline
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 02:18.


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