Raised This Month: $ Target: $400
 0% 

Playing an effect and sound at the player location


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TCSM.Overlord
Junior Member
Join Date: Jul 2011
Old 07-21-2011 , 14:53   Playing an effect and sound at the player location
Reply With Quote #1

hello everybody,

I am new to scripting for sourcemod and for my first script i would like to make a plugin where somebody can type !explodeme in chat or something like that or !burnme and it play an effect and sound at the player location but not harm them. My problem is i don't know what functions i would need to use for this,

Does anybody have any example scripts or the functions and syntax i would have to use?

Thanks

TSCM.Overlord
TCSM.Overlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-21-2011 , 16:14   Re: Playing an effect and sound at the player location
Reply With Quote #2

The function you want for the sound is EmitAmbientSound.

If I'm right, you'll also need GetClientAbsOrigin to get the players location to pass as the second argument to EmitAmbientSound.

So, something like this:
PHP Code:
new Float:origin[3] = GetClientAbsOrigin(client);
EmitAmbientSound("path/to/sound"originGetClientUserId(client)); 
Note: As I recall, a client's UserId is an entity ID, but if I'm wrong, the previous line will cause an error.

Likely you'll need a tempent for the effect, but sadly I know nothing about them.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-21-2011 at 16:30.
Powerlord is offline
TCSM.Overlord
Junior Member
Join Date: Jul 2011
Old 07-21-2011 , 16:49   Re: Playing an effect and sound at the player location
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
The function you want for the sound is EmitAmbientSound.

If I'm right, you'll also need GetClientAbsOrigin to get the players location to pass as the second argument to EmitAmbientSound.

So, something like this:
PHP Code:
new Float:origin[3] = GetClientAbsOrigin(client);
EmitAmbientSound("path/to/sound"originGetClientUserId(client)); 
Note: As I recall, a client's UserId is an entity ID, but if I'm wrong, the previous line will cause an error.

Likely you'll need a tempent for the effect, but sadly I know nothing about them.
Thanks alot Powerlord, This is realy usefull for me, Also if anybody can help with playing an effect at the Client vector created by GetClientAbsOrigin it would be gratefully appreciated
TCSM.Overlord is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 07-21-2011 , 21:41   Re: Playing an effect and sound at the player location
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
PHP Code:
new Float:origin[3] = GetClientAbsOrigin(client);
EmitAmbientSound("path/to/sound"originGetClientUserId(client)); 
Note: As I recall, a client's UserId is an entity ID, but if I'm wrong, the previous line will cause an error.
Lol. No. Entity number = Client number.

And GetClientAbsOrigin doesn't work that way. Nothing does. (You can't return arrays)

PHP Code:
new Float:Origin[3];
GetClientAbsOrigin(clientOrigin);
EmitAmbientSound("path"Originclient /* Default (SOUND_FROM_WORLD) would work here too*/); 
And directed more towards OP: Take a look at the commands you're talking about's actual code. You'll see the damage they do is often induced by the commands themselves. (Except for ignite, though).
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
TCSM.Overlord
Junior Member
Join Date: Jul 2011
Old 07-27-2011 , 09:25   Re: Playing an effect and sound at the player location
Reply With Quote #5

ok, ive manage to get the sound to play at the location, how do i play a effect ? at the same orgin created,

Thanks
TCSM.Overlord 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 15:17.


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