Raised This Month: $ Target: $400
 0% 

Ambience Sound + Loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
matsi
Thinkosaur
Join Date: Sep 2006
Old 11-05-2009 , 10:07   Re: Warning: Loose indentation on line 53
Reply With Quote #1

Quote:
Originally Posted by drumzplaya13 View Post
I did that and it gave me 3 errors than.

Code:
Warning: Loose indentation on line 53
Warning: Loose indentation on line 56
Error: Invalid expression, assumed zero on line 56
Error: Undefined symbol "PlaySound" on line 56
Error: Expected token: "}", but found "-end of file-" on line 70
Edit: Fixed.
Error: Expected token: "}", but found "-end of file-" on line 70

Look at the end of the file and you see there is } missing. And what do you have in 56 line?
matsi is offline
drumzplaya13
Senior Member
Join Date: Feb 2008
Location: TEXAS
Old 11-05-2009 , 10:14   Re: Warning: Loose indentation on line 53
Reply With Quote #2

Quote:
Originally Posted by matsi View Post
Error: Expected token: "}", but found "-end of file-" on line 70

Look at the end of the file and you see there is } missing. And what do you have in 56 line?
I fixed the compile, the plugin doesnt seem to work as it is suppose to though. Here is the code.


PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ambience Sounds"
#define VERSION "1.0"
#define AUTHOR "Jon"

new gCvarMethod;

new 
gSound[64];
new 
gDuration[32];
new 
gMap[32];

new 
bool:gFoundMap;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
gCvarMethod register_cvar("amx_ambience_method""0"
    
    
set_task(20.0"PlaySound")
    
    
get_mapname(gMap31)
}

public 
plugin_cfg()
{
    new 
configfile[96];
    
get_configsdir(configfile96);
    
add(configfile96"/ambience_sounds.ini");
    
    new 
fopen(configfile"rt");
    
    while (!
feof(f))
    {
        new 
Data[160]
        new 
Map[32]
        new 
Sound[64];
        new 
Duration[32];
        
        
fgets(fData160);
        
parse(DataMap20Sound64Duration32);
        
        if(
equali(gMapMap) && strlen(Sound) > && strlen(Duration) > 0)
        {
            
gSound Sound
            gDuration 
Duration
            gFoundMap 
true;
        
            return;
        }
    }
    
    
fclose(f);
}

public 
PlaySound()
{
    if(!
gFoundMap)
        return;
        
    if(
get_pcvar_num(gCvarMethod) == 1)
        
client_cmd(0"spk %s"gSound)
        
    else
         
client_cmd(0"mp3 play %s"gSound)
    
    
set_task(float(str_to_num(gDuration)) + 5.0"PlaySound")

__________________
Think Positive - Stay Positive
drumzplaya13 is offline
drumzplaya13
Senior Member
Join Date: Feb 2008
Location: TEXAS
Old 11-05-2009 , 10:21   Re: Warning: Loose indentation on line 53
Reply With Quote #3

Quote:
Originally Posted by matsi View Post
Error: Expected token: "}", but found "-end of file-" on line 70

Look at the end of the file and you see there is } missing. And what do you have in 56 line?
I fixed the compile, the plugin doesnt seem to work as it is suppose to though. Here is the code. What I am trying to do is have a .wav file that plays as ambience and loops the whole time I am on a specific map.


PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ambience Sounds"
#define VERSION "1.0"
#define AUTHOR "Jon"

new gCvarMethod;

new 
gSound[64];
new 
gDuration[32];
new 
gMap[32];

new 
bool:gFoundMap;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
gCvarMethod register_cvar("amx_ambience_method""0"
    
    
set_task(20.0"PlaySound")
    
    
get_mapname(gMap31)
}

public 
plugin_cfg()
{
    new 
configfile[96];
    
get_configsdir(configfile96);
    
add(configfile96"/ambience_sounds.ini");
    
    new 
fopen(configfile"rt");
    
    while (!
feof(f))
    {
        new 
Data[160]
        new 
Map[32]
        new 
Sound[64];
        new 
Duration[32];
        
        
fgets(fData160);
        
parse(DataMap20Sound64Duration32);
        
        if(
equali(gMapMap) && strlen(Sound) > && strlen(Duration) > 0)
        {
            
gSound Sound
            gDuration 
Duration
            gFoundMap 
true;
        
            return;
        }
    }
    
    
fclose(f);
}

public 
PlaySound()
{
    if(!
gFoundMap)
        return;
        
    if(
get_pcvar_num(gCvarMethod) == 1)
        
client_cmd(0"spk %s"gSound)
        
    else
         
client_cmd(0"mp3 play %s"gSound)
    
    
set_task(float(str_to_num(gDuration)) + 5.0"PlaySound")

__________________
Think Positive - Stay Positive
drumzplaya13 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:32.


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