AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   public turn off/on commands (https://forums.alliedmods.net/showthread.php?t=104933)

DoviuX 09-29-2009 10:34

public turn off/on commands
 
how can i put a cvar to this plugin for off/on with /turnon /turnoff commands. And how to add multiple sound becouse something is wrong only plays 1 sound.

PHP Code:

#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Round Start/End"
#define AUTHOR "DoviuX"
#define VERSION "1.3"
 
new const STARTSOUND[]=

 
"RoundStart/Start/Start1.wav",
 
"RoundStart/Start/Start2.wav",
 
"RoundStart/Start/Start3.wav"
}
new const 
ENDSOUND[]= 

 
"RoundStart/End/End1.wav",
 
"RoundStart/End/End2.wav",
 
"RoundStart/End/End3.wav"
}
/*================================================================================
 [Plugin Start]
=================================================================================*/
public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_logevent("logevent_round_start"2"1=Round_Start")
 
register_logevent("logevent_round_end"2"1=Round_End")
 
 
register_clcmd("say /turnoff","turnoff")
 
register_clcmd("say_team /turnoff","turnoff")
 
 
register_clcmd("say /turnon","turnon")
 
register_clcmd("say_team /turnon","turnon")
}
public 
plugin_precache() 
{
 
precache_sound(STARTSOUND)
 
precache_sound(ENDSOUND)
}
public 
logevent_round_start(id) {
    
set_task(10.0"1=Round_Start")
    
client_cmd(id"spk %s"STARTSOUND)
    
set_hudmessage(225225225, -1.00.2926.012.0 );
    
show_hudmessage(0"The Ultimate Battle Has Begun !"); 
}
public 
logevent_round_end(id) {
    
set_task(10.0"1=Round_End")
    
client_cmd(id"spk %s"ENDSOUND)
    
set_hudmessage(225225225, -1.00.2926.012.0 );
    
show_hudmessage(0"The Ultimate Battle Has ended !"); 



Arkshine 09-29-2009 10:50

Re: public turn off/on commands
 
Code:
    #include <amxmodx>     #include <amxmisc>           #define PLUGIN "Round Start/End"     #define AUTHOR "DoviuX"     #define VERSION "1.3"           new const gStartSounds[][] =     {         "RoundStart/Start/Start1.wav",         "RoundStart/Start/Start2.wav",         "RoundStart/Start/Start3.wav"     };         new const gEndSounds[][] =     {         "RoundStart/End/End1.wav",         "RoundStart/End/End2.wav",         "RoundStart/End/End3.wav"     };         new bool:gPluginStatus = true;         public plugin_precache()     {         new i;                 for ( i = 0; i < sizeof gStartSounds; i++ )         {               precache_sound( gStartSounds[ i ] );         }                 for ( i = 0; i < sizeof gEndSounds; i++ )         {               precache_sound( gEndSounds[ i ] );         }     }     public plugin_init()     {         register_plugin( PLUGIN, VERSION, AUTHOR );                   register_logevent( "Event_RoundStart", 2, "1=Round_Start" );         register_logevent( "Event_RoundEnd", 2, "1=Round_End" );                   register_clcmd( "say /togglesound", "ClientCommand_ToggleSound", ADMIN_CFG );         register_clcmd( "say_team /togglesound", "ClientCommand_ToggleSound", ADMIN_CFG );     }         public ClientCommand_ToggleSound ( const id, const level, const cid )     {         if ( cmd_access( id, level, cid, 1 ) )         {             gPluginStatus = !gPluginStatus;             return PLUGIN_HANDLED;         }                 return PLUGIN_CONTINUE;     }         public Event_RoundStart ()     {         if ( gPluginStatus )         {             client_cmd( 0, "spk %s", gStartSounds[ random( sizeof gStartSounds ) ] );                         set_hudmessage( 225, 225, 225, -1.0, 0.29, 2, 6.0, 12.0 );             show_hudmessage( 0, "The Ultimate Battle Has Begun !" );         }     }         public Event_RoundEnd ()     {         if ( gPluginStatus )         {             client_cmd( 0, "spk %s", gEndSounds[ random( sizeof gStartSounds ) ] );                         set_hudmessage( 225, 225, 225, -1.0, 0.29, 2, 6.0, 12.0 );             show_hudmessage( 0, "The Ultimate Battle Has ended !" );         }     }

DoviuX 09-29-2009 10:53

Re: public turn off/on commands
 
thanks and is it possible for this plugin to freeze everyone alive when 10 seconds left to round end ?
and then show the ultimate battle ended! and eweryone be freeze for 10 sec till round ends

DoviuX 09-29-2009 11:00

Re: public turn off/on commands
 
my bad compiled


All times are GMT -4. The time now is 22:37.

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