Raised This Month: $ Target: $400
 0% 

[Req] Working on Decoys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thebro
Senior Member
Join Date: Jan 2011
Old 05-26-2012 , 18:59   [Req] Working on Decoys
Reply With Quote #1

So i had this great idea, i started working on it too. The sound emits but it follows you, i wanted it to stay at the spot your purchased the item at. can somebody help?

Heres the piece of code. I just want the emit sound to NOT follow the player but it needs to be so where all players will hear it if they are within range of it. not just the user who pay for it.


Heres the piece of code.
PHP Code:
case 1:
        {
            if(
cs_get_user_money(id) >= 3000)
       {
    
emit_sound(id,CHAN_ITEM"cod/decoy2.wav"1.0ATTN_NORM0PITCH_NORM);
            
cs_set_user_money(id,cs_get_user_money(id) - 3000)
    
client_print(idprint_chat"Decoy has been placed! Length of decoy 0:13")
       }
        else
       
client_print(idprint_chat"Insufficient funds!")
        } 
thebro is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-26-2012 , 19:04   Re: [Req] Working on Decoys
Reply With Quote #2

Retrieve player origin and use engfunc(EngFunc_EmitAmbienSound
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
thebro
Senior Member
Join Date: Jan 2011
Old 05-26-2012 , 19:06   Re: [Req] Working on Decoys
Reply With Quote #3

how would I be able to do that?
And thanks for helping out with the "Last CT" plugin too
thebro is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-26-2012 , 19:12   Re: [Req] Working on Decoys
Reply With Quote #4

Also, see how cs_get_user_money(id) result is stored in a variable, making the code being more efficient, read wiki about optimizing plugins.

PHP Code:
    case 1:
    {
        new 
iNewMoney cs_get_user_money(id) - 3000
        
if( iNewMoney >= )
        {
            new 
Float:origin[3]
            
pev(idpev_originorigin)
            
EF_EmitAmbientSound(0origin"cod/decoy2.wav"1.0ATTN_NORM0PITCH_NORM)
            
            
cs_set_user_money(idiNewMoney)
            
client_print(idprint_chat"Decoy has been placed! Length of decoy 0:13")
        }
        else
        {
            
client_print(idprint_chat"Insufficient funds!")
        }
    } 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-26-2012 at 19:13.
ConnorMcLeod is offline
thebro
Senior Member
Join Date: Jan 2011
Old 05-26-2012 , 19:23   Re: [Req] Working on Decoys
Reply With Quote #5

I added it, compiled the .sma with this piece, it gave me this.

Code:
inshop.sma(73) : error 017: undefined symbol "EF_EmitAmbientSound"
inshop.sma(89) : warning 217: loose indentation
inshop.sma(90) : warning 217: loose indentation
inshop.sma(92) : warning 217: loose indentation
The loose parts are the other part of the Case 2 I have to remove, cause the thing im working on you can purchase 2 types of *Decoy* equipment. meaning yes, 2 emitting sounds but im not sure if copying the edited code you posted to a Case 2 would cause a problem.

Case 2 is the same pretty much its just different price and sound.

Fixed the problem. had to add
#Define EF_EmitAmbientSound

now I just have to figure out how to make this for Case 2

Last edited by thebro; 05-26-2012 at 19:39.
thebro is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-27-2012 , 06:32   Re: [Req] Working on Decoys
Reply With Quote #6

#include <fakemeta_stocks>
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 17:00.


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