AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin compile error (old plugin) (https://forums.alliedmods.net/showthread.php?t=282797)

LithuanianJack 05-17-2016 11:40

Plugin compile error (old plugin)
 
3 Attachment(s)
Hello. Can anyone fix these errors?

PHP Code:

#include <amxmodx>
#include <dhudmessage>

#define PLUGIN "HUD MSG for VIP,Admin,Player"
#define VERSION "1.0"
#define AUTHOR "4iTGAME & Dim4ik"


public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
}
public 
client_putinserver(id)set_task(5.0,"flappybuird",id)
public 
flappybuird(id)
{
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
     
    if(
get_user_flags(id) & ADMIN_LEVEL_B)
    {
        
set_dhudmessage(025500.280.1606.012.0)
        
show_dhudmessage(id"Glad to see the Administrator %s! Enjoy the game."szName)
    }
    else if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
set_dhudmessage(025500.280.1606.012.0)
        
show_dhudmessage(id"Glad to see you VIP %s! Enjoy the game."szName)
    }
    else
    {
        
set_dhudmessage(025500.280.1606.012.0)
        
show_dhudmessage(id"Glad to see you %s ! Enjoy the game."szName)
    }
}
     
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


wickedd 05-17-2016 11:47

Re: Plugin compile error (old plugin)
 
It compiles fine without any errors for me.

Edit: What version of AMXX are you using to compile the plugin with?

Edit 2: If you're using AMXX 1.8.3 remove
PHP Code:

#include <dhudmessage> 

then the plugin should compile

LithuanianJack 05-17-2016 12:19

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by wickedd (Post 2419718)
It compiles fine without any errors for me.

Edit: What version of AMXX are you using to compile the plugin with?

Edit 2: If you're using AMXX 1.8.3 remove
PHP Code:

#include <dhudmessage> 

then the plugin should compile

1.8.3. Thank you, it works when I removed #include <dhudmessage> :)

siriusmd99 05-17-2016 12:24

Re: Plugin compile error (old plugin)
 
Use this one instead because you are not checking task on putinserver (+ added some optimizations and shortened the code :)):
P.S. Replace mysound.wav with your sound name ....

PHP Code:

#include <amxmodx> 
#include <dhudmessage> 

#define PLUGIN "HUD MSG for VIP,Admin,Player" 
#define VERSION "1.0" 
#define AUTHOR "4iTGAME & Dim4ik" 

new const welcome_sound[] = "mysound.wav"

public plugin_precache()
{
    
register_plugin(PLUGINVERSIONAUTHOR
    
precache_sound(welcome_sound)
}

public 
client_putinserver(id){ 
    if(
task_exists(id)) 
        
remove_task(id)
    
set_task(5.0,"flappybuird",id
}

public 
flappybuird(id){ 
    new 
szName[32],iflags
    
get_user_name(idszNamecharsmax(szName)) 
    
iflags get_user_flags(id);
    
set_dhudmessage(025500.280.1606.012.0)         
    
show_dhudmessage(id"Glad to see you %s%s ! Enjoy the game.", (iflags ADMIN_LEVEL_B) ? "Administrator " : (iflags ADMIN_LEVEL_H) ? "VIP " "" ,szName
    
client_cmd(id"spk %s"welcome_sound)



LithuanianJack 05-17-2016 13:30

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by siriusmd99 (Post 2419725)
Use this one instead because you are not checking task on putinserver (+ added some optimizations and shortened the code :)):
P.S. Replace mysound.wav with your sound name ....

PHP Code:

#include <amxmodx> 
#include <dhudmessage> 

#define PLUGIN "HUD MSG for VIP,Admin,Player" 
#define VERSION "1.0" 
#define AUTHOR "4iTGAME & Dim4ik" 

new const welcome_sound[] = "mysound.wav"

public plugin_precache()
{
    
register_plugin(PLUGINVERSIONAUTHOR
    
precache_sound(welcome_sound)
}

public 
client_putinserver(id){ 
    if(
task_exists(id)) 
        
remove_task(id)
    
set_task(5.0,"flappybuird",id
}

public 
flappybuird(id){ 
    new 
szName[32],iflags
    
get_user_name(idszNamecharsmax(szName)) 
    
iflags get_user_flags(id);
    
set_dhudmessage(025500.280.1606.012.0)         
    
show_dhudmessage(id"Glad to see you %s%s ! Enjoy the game.", (iflags ADMIN_LEVEL_B) ? "Administrator " : (iflags ADMIN_LEVEL_H) ? "VIP " "" ,szName
    
client_cmd(id"spk %s"welcome_sound)



That's okay, but i didn't hear the sound... :(
PHP Code:

new const welcome_sound[] = "myproject/mysound.wav" 

The sound location is: cstrike/sound/myproject/mysound.wav

wickedd 05-17-2016 13:58

Re: Plugin compile error (old plugin)
 
PHP Code:

#include <amxmodx>  

#define PLUGIN "HUD MSG for VIP,Admin,Player" 
#define VERSION "1.0" 
#define AUTHOR "4iTGAME & Dim4ik" 

new const joining[] = "myproject/mysound.wav" 

public plugin_init(){ 
    
register_plugin(PLUGINVERSIONAUTHOR


public 
plugin_precache()
{
    
precache_soundjoining )  
}

public 
client_putinserver(id)set_task(5.0,"flappybuird",id
public 
flappybuird(id

    new 
szName[32
    
get_user_name(idszNamecharsmax(szName)) 
      
    if(
get_user_flags(id) & ADMIN_LEVEL_B
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see the Administrator %s! Enjoy the game."szName
        
client_cmdid"spk ^"sound/%s^""joining // copy and paste this line where you want the sound to play
    

    else if(
get_user_flags(id) & ADMIN_LEVEL_H
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see you VIP %s! Enjoy the game."szName
    } 
    else 
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see you %s ! Enjoy the game."szName
    } 

      
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE 
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par } 
*/ 


LithuanianJack 05-18-2016 00:18

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by wickedd (Post 2419749)
PHP Code:

#include <amxmodx>  

#define PLUGIN "HUD MSG for VIP,Admin,Player" 
#define VERSION "1.0" 
#define AUTHOR "4iTGAME & Dim4ik" 

new const joining[] = "myproject/mysound.wav" 

public plugin_init(){ 
    
register_plugin(PLUGINVERSIONAUTHOR


public 
plugin_precache()
{
    
precache_soundjoining )  
}

public 
client_putinserver(id)set_task(5.0,"flappybuird",id
public 
flappybuird(id

    new 
szName[32
    
get_user_name(idszNamecharsmax(szName)) 
      
    if(
get_user_flags(id) & ADMIN_LEVEL_B
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see the Administrator %s! Enjoy the game."szName
        
client_cmdid"spk ^"sound/%s^""joining // copy and paste this line where you want the sound to play
    

    else if(
get_user_flags(id) & ADMIN_LEVEL_H
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see you VIP %s! Enjoy the game."szName
    } 
    else 
    { 
        
set_dhudmessage(025500.280.1606.012.0
        
show_dhudmessage(id"Glad to see you %s ! Enjoy the game."szName
    } 

      
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE 
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par } 
*/ 


Why the "\n" didn't work?

PHP Code:

Glad to see the Administrator %s! [B]\n[/B]Enjoy the game


tousif 05-18-2016 01:19

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by wickedd (Post 2419718)
It compiles fine without any errors for me.

Edit: What version of AMXX are you using to compile the plugin with?

Edit 2: If you're using AMXX 1.8.3 remove
PHP Code:

#include <dhudmessage> 

then the plugin should compile

1.8.3 has dhudmessage by default?

wickedd 05-18-2016 06:31

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by LithuanianJack (Post 2419842)
Why the "\n" didn't work?

PHP Code:

Glad to see the Administrator %s! [B]\n[/B]Enjoy the game


PHP Code:

Glad to see the Administrator %s!^nEnjoy the game

If you're want to start a new line use ^n

Quote:

Originally Posted by tousif (Post 2419847)
1.8.3 has dhudmessage by default?

Yes

LithuanianJack 05-18-2016 07:29

Re: Plugin compile error (old plugin)
 
Quote:

Originally Posted by wickedd (Post 2419894)
PHP Code:

Glad to see the Administrator %s!^nEnjoy the game

If you're want to start a new line use ^n


Yes

Yeah, but i didn't hear the sound


All times are GMT -4. The time now is 18:32.

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