Hey guys, I'am new here.
I installed some plugins ony my cs:source-server (Jetpack, noblock, effects).
I looked at the source codes, and so I wanted to make some easy plugin's for my server( a restart plugin^^)
I'am so interesstet in this, cause the source-codes looks like C <-iam learning @ school^^
Maybe someonecan make a finished plugin, but what I really want is, how to do it myself...
So long:
Quote:
It should start when I type "sm_restart" in the console.
PrintToChatAll("Server will restart in 5 seconds.");
PrintCenterTextAll("Server will restart in 5 seconds.");
EmitSoundToAll("hl1/fvox/five.wav");
PrintToChatAll("Server will restart in 4 seconds.");
PrintCenterTextAll("Server will restart in 4seconds.");
EmitSoundToAll("fvox/four.wav");
....
after "Server will restart in 1 seconds" it should send to the console "quit"
|
[
OPEN] 1. So how do I send "quit" to the console?
[
DONE] 2. what do i have to do, that the plugin is executed by typing "sm_restart" ?
[
OPEN] 3. What do I have to mind by doing this plugin?(some tricks or smth. like that)
What I've done already:
- plugin start by typing sm_restart
- plugin displays the message "Server will restart in x seconds" and plays the sound to x.(x=4 so sound= 4 seconds^^)
- problem is. it dont waits 1 second before display the next step(x-1) and all sounds are played at the same time

- Dunno how to send the "quit" to the server
Hope someone can help me, I will post tomorrow my Code , right now iam on another pc.
Greetings
Daeth
Sog god morning, here's what i've done already
Quote:
/********************************************* ***********************************
*
* Simple Server restart tool with 5 second countdown
* Plugin licensed under the GPLv3
*
* Coded by Daeth111/Sounds from V0gelz Nukem!
*
********************************************* *****************************/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "0.1"
#define FADE_IN 0x0001
#define FADE_OUT 0x0002
public Plugin:myinfo =
{
name = "Restart script",
author = "Daeth",
description = "Restart the server with 5 second countdown",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
RegAdminCmd( "sm_restart", Command_restart, ADMFLAG_SLAY, "countdown to restart server" );
CreateConVar("sm_restart_version", PLUGIN_VERSION, "", FCVAR_PLUGIN | FCVAR_REPLICATED | FCVAR_NOTIFY);
}
public OnMapStart()
{
PrecacheSound( "hl1/fvox/five.wav", true);
PrecacheSound( "fvox/four.wav", true);
PrecacheSound( "fvox/three.wav", true);
PrecacheSound( "fvox/two.wav", true);
PrecacheSound( "fvox/one.wav", true);
AddFileToDownloadsTable("sound/fvox/four.wav");
AddFileToDownloadsTable("sound/fvox/three.wav");
AddFileToDownloadsTable("sound/fvox/two.wav");
AddFileToDownloadsTable("sound/fvox/one.wav");
}
public Action:Command_restart( client, args )
{
PrintToChatAll("Server will restart in 5 seconds.");
PrintCenterTextAll("Server will restart in 5 seconds.");
EmitSoundToAll("hl1/fvox/five.wav");
//Wait one second...
// sleep(1);
// -Don't work
PrintToChatAll("Server will restart in 4 seconds.");
PrintCenterTextAll("Server will restart in 4 seconds.");
EmitSoundToAll("fvox/four.wav");
//Wait one second...
// sleep(1);
// -Don't work
PrintToChatAll("Server will restart in 3 seconds.");
PrintCenterTextAll("Server will restart in 3 seconds.");
EmitSoundToAll("fvox/three.wav");
//Wait one second...
// sleep(1);
// -Don't work
PrintToChatAll("Server will restart in 2 seconds.");
PrintCenterTextAll("Server will restart in 2 seconds.");
EmitSoundToAll("fvox/two.wav");
//Wait one second...
// sleep(1);
// -Don't work
PrintToChatAll("Server will restart in 1 seconds.");
PrintCenterTextAll("Server will restart in 1 seconds.");
EmitSoundToAll("fvox/one.wav");
//Wait one second...
// sleep(1);
//Send "quit" to the server.
// quit -Don't work
return Plugin_Handled;
}
public EmitSoundFromOrigin(const String:sound[],const Float rig[3])
{
EmitSoundToAll(sound,SOUND_FROM_WORLD,SNDCHAN _AUTO,SNDLEVEL_NORMAL,SND_NOFLAGS,SNDVOL_NORM AL,SNDPITCH_NORMAL,-1,orig,NULL_VECTOR,true,0.0);
}
|