AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Round Start Plugin (https://forums.alliedmods.net/showthread.php?t=104495)

DarkGod 09-24-2009 12:08

Re: Round Start Plugin
 
Quote:

Originally Posted by DoviuX (Post 942296)
Fixed Bugs read 1 post !

Code:
public logevent_round_start(id) {     client_cmd(id, "spk %s", ROUND_SOUND)

DoviuX 09-24-2009 12:11

Re: Round Start Plugin
 
And whats wrong with that ?

public logevent_round_start(id) {
client_cmd(id, "spk %s", ROUND_SOUND)

Jon 09-24-2009 12:21

Re: Round Start Plugin
 
Test your plugins before releasing/editing them.

Quote:

PHP Code:

public logevent_round_start(id

There is no index passed in this event. Use 0 as index.
You didn't fix that.

PHP Code:

precache_sound("ROUND_SOUND"

Remove "" and precache all sounds.

PHP Code:

new const ROUND_SOUND[] =
{
     
"RoundStart/Start1.wav",
     
"RoundStart/Start2.wav",
     
"RoundStart/Start3.wav"
}

client_cmd(id"spk %s"ROUND_SOUND

Won't work as intended.

DoviuX 09-24-2009 12:30

Re: Round Start Plugin
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Round Start"
#define AUTHOR "DoviuX"
#define VERSION "1.1"
new const ROUND_SOUND[][]=
{  
  
"RoundStart/Start1.wav",
  
"RoundStart/Start2.wav",
  
"RoundStart/Start3.wav"
}
/*================================================================================
 [Plugin Start]
=================================================================================*/
public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
        
register_logevent("logevent_round_start"2"1=Round_Start")
}
public 
logevent_round_start(id) {
    
client_cmd(id"spk %s"ROUND_SOUND)
    
set_hudmessage(225225225, -1.00.2926.012.0 );
    
show_hudmessage(0"The Ultimate Battle Has Begun !"); 
}
public 
plugin_precache() 
{
  
precache_sound(ROUND_SOUND)


Error:

Code:


//AMXXPC compile.exe
// by the AMX Mod X Dev Team
 
//// RoundStart.sma
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\RoundStart.sma(32) : error 048: array dimensions do not match
//
// 1 Error.
// Could not locate output file D:\Dovydo\Counter - strike Failai\Addonai\L4DPla
gue\L4DPlague\addons\amxmodx\scripting\compiled\RoundStart.amx (compile failed).
//
// Compilation Time: 0,09 sec
// ----------------------------------------
Press enter to exit ...


Exolent[jNr] 09-24-2009 12:32

Re: Round Start Plugin
 
You obviously cannot support this.
Please learn more about writing plugins before submitting another.

Unapproved.

@Jon
You should NOT use #define for strings.

Jon 09-24-2009 12:33

Re: Round Start Plugin
 
Quote:

Originally Posted by Exolent[jNr] (Post 942317)
@Jon
You should NOT use #define for strings.

I heard this was alright as long as you only use the string once.

Exolent[jNr] 09-24-2009 12:42

Re: Round Start Plugin
 
Quote:

Originally Posted by Jon (Post 942319)
I heard this was alright as long as you only use the string once.

1. Precache Sound
2. Play Sound

Alucard^ 09-24-2009 12:43

Re: Round Start Plugin
 
The round start is a global event so you cant use (id)... you have to do a loop of maxplayers for that. Or if i am not wrong... you can play the sound to all players with the emit_sound (that i never used it so i am not sure).

Jon 09-24-2009 12:48

Re: Round Start Plugin
 
Quote:

Originally Posted by Exolent[jNr] (Post 942327)
1. Precache Sound
2. Play Sound

Okay. What if you have a function that is called pretty often which checks a string, but this is the only place that string is checked?

Exolent[jNr] 09-24-2009 13:10

Re: Round Start Plugin
 
Quote:

Originally Posted by Jon (Post 942334)
Okay. What if you have a function that is called pretty often which checks a string, but this is the only place that string is checked?

In plugins by VEN, I have seen him make a static const variable of a string that is used in a situation like that.
I don't know the reasoning behind it, but I'm sure if he did it, it had to be for a good reason.


All times are GMT -4. The time now is 06:07.

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