Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Server_Shutdown

, Нехватка HUD'а
Статус пользователя yalsrof
сообщение 26.9.2014, 12:41
Сообщение #1
Стаж: 12 лет

Сообщений: 43
Благодарностей: 5
Полезность: 85

Всем привет ребята. В скриптинге не силён, поэтому обращаюсь к вас. Помогите отредактировать код таким образом, что бы вместо чат сообщений (можно оставить как альтернативу, не обзяательно убирать), выводилось HUD красное сообщение по центру экрана с обратным отсчётом времени.
Заранее спасибо.

server_restart.sma
#include <amxmodx>
#include <amxmisc>

/*

Copyleft 2006
Plugin thread: http://amxmodx.org/forums/viewtopic.php?p=211244

SERVER RESTART
==============

Description
This plugin is basically an extension of mysticssjgoku4's server shutdown,
which is very limited and hardcoded (although it does work).
It also logs when admins use it, and displays messages according to
your amx_show_activity cvar.

Commands
amx_restart (seconds 1-20) - will restart the server in (seconds),
counting down along the way. Serverdoc or any autorestarting tool
is not needed for this, it will restart on it's own.
Clients will also reconnect.

amx_shutdown (seconds 1-20) - will shut down the server in (seconds),
counting down along the way. This will shut the server down entirely
unless you have serverdoc or another autorestarting tool. Clients
will not reconnect.

Credits
mysticssjgoku4 for the original idea.

Changelog:

Feb 1, 2006 - v2.0 - Release
Feb 2, 2006 - v2.0 RC1 - Some fixes for Restart not working
Feb 2, 2006 - v2.1 - Cut code down slightly, changed voice to fvox
Jun 8, 2006 - v2.2 - Changed restart command to "reload", conformed to newer coding standards

*/

enum
{
SHUTDOWN = 0,
RESTART
}

new g_bShuttingDown
new g_iMode

public plugin_init()
{
register_plugin("Server Shutdown","2.2","Hawk552")

register_concmd("amx_shutdown","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - shuts down the server in seconds")
register_concmd("amx_restart","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - restarts the server in seconds")
}

public fnShutDown(id,level,cid)
{
if(!cmd_access(id,level,cid,2) || g_bShuttingDown)
return PLUGIN_HANDLED

new szArg[6]
read_argv(0,szArg,5)

// Because SHUTDOWN = 0, we can assume that if it's not
// amx_restart, then it must be SHUTDOWN.
if(equali(szArg,"amx_r"))
g_iMode = RESTART

read_argv(1,szArg,5)
new iTime = str_to_num(szArg)

if(!iTime || iTime > 20)
{
console_print(id,"You did not supply a valid time (between 1-20 seconds)")

return PLUGIN_HANDLED
}

new szName[32]
get_user_name(id,szName,31)

new szAuthid[32]
get_user_authid(id,szAuthid,31)

log_amx("Cmd: ^"%s<%i><%s>^" initiate %s",szName,id,szAuthid,g_iMode ? "restart" : "shutdown")

switch(get_cvar_num("amx_show_activity"))
{
case 1 : client_print(0,print_chat,"ADMIN: %s server in %i seconds",g_iMode ? "Restart" : "Shutdown",iTime)
case 2 : client_print(0,print_chat,"ADMIN %s: %s server in %i seconds",szName,g_iMode ? "Restart" : "Shutdown",iTime)
}

fnInitiate(iTime)

return PLUGIN_HANDLED
}

public fnInitiate(iTime)
{
g_bShuttingDown = true

new iCount
for(iCount = iTime;iCount != 0;iCount--)
set_task(float(abs(iCount-iTime)),"fnCallTime",iCount)

set_task(float(iTime),"fnCallTime",0)
}

public fnCallTime(iCount)
{
if(!iCount)
{
switch(g_iMode)
{
case SHUTDOWN :
server_cmd("quit")

case RESTART :
server_cmd("reload")
}
}

new szWord[32]
num_to_word(iCount,szWord,31)

client_cmd(0,"spk ^"fvox/%s^"",szWord)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Stimul1
сообщение 26.9.2014, 13:55
Сообщение #2


Стаж: 13 лет

Сообщений: 227
Благодарностей: 262
Полезность: 977

yalsrof, код в тег pawn вставь.
Кури это.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя yalsrof
сообщение 28.9.2014, 14:44
Сообщение #3
Стаж: 12 лет

Сообщений: 43
Благодарностей: 5
Полезность: 85

Цитата(Stimul1 @ 26.9.2014, 17:55) *
yalsrof, код в тег pawn вставь.
Кури это.


Код:
#include <amxmodx>
#include <amxmisc>

/*

Copyleft 2006
Plugin thread: http://amxmodx.org/forums/viewtopic.php?p=211244

SERVER RESTART
==============

Description
This plugin is basically an extension of mysticssjgoku4's server shutdown,
which is very limited and hardcoded (although it does work).
It also logs when admins use it, and displays messages according to
your amx_show_activity cvar.

Commands
amx_restart (seconds 1-20) - will restart the server in (seconds),
counting down along the way. Serverdoc or any autorestarting tool
is not needed for this, it will restart on it's own.
Clients will also reconnect.

amx_shutdown (seconds 1-20) - will shut down the server in (seconds),
counting down along the way. This will shut the server down entirely
unless you have serverdoc or another autorestarting tool. Clients
will not reconnect.

Credits
mysticssjgoku4 for the original idea.

Changelog:

Feb 1, 2006 - v2.0 - Release
Feb 2, 2006 - v2.0 RC1 - Some fixes for Restart not working
Feb 2, 2006 - v2.1 - Cut code down slightly, changed voice to fvox
Jun 8, 2006 - v2.2 - Changed restart command to "reload", conformed to newer coding standards

*/

enum
{
SHUTDOWN = 0,
RESTART
}

new g_bShuttingDown
new g_iMode

public plugin_init()
{
register_plugin("Server Shutdown","2.2","Hawk552")

register_concmd("amx_shutdown","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - shuts down the server in seconds")
register_concmd("amx_restart","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - restarts the server in seconds")
}

public fnShutDown(id,level,cid)
{
if(!cmd_access(id,level,cid,2) || g_bShuttingDown)
return PLUGIN_HANDLED

new szArg[6]
read_argv(0,szArg,5)

// Because SHUTDOWN = 0, we can assume that if it's not
// amx_restart, then it must be SHUTDOWN.
if(equali(szArg,"amx_r"))
g_iMode = RESTART

read_argv(1,szArg,5)
new iTime = str_to_num(szArg)

if(!iTime || iTime > 20)
{
console_print(id,"You did not supply a valid time (between 1-20 seconds)")

return PLUGIN_HANDLED
}

new szName[32]
get_user_name(id,szName,31)

new szAuthid[32]
get_user_authid(id,szAuthid,31)

log_amx("Cmd: ^"%s<%i><%s>^" initiate %s",szName,id,szAuthid,g_iMode ? "restart" : "shutdown")

switch(get_cvar_num("amx_show_activity"))
{
case 1 :{
set_hudmessage(255, 0, 0, -1.0, 0.4, 0, 6.0, 1.0);
show_hudmessage(0, "ADMIN: %s server in %i seconds",g_iMode ? "Restart" : "Shutdown",iTime):}
case 2 :{
set_hudmessage(255, 0, 0, -1.0, 0.4, 0, 6.0, 1.0);
show_hudmessage(0, "ROOT %s: %s server in %i seconds",szName,g_iMode ? "Restart" : "Shutdown",iTime);}
}

fnInitiate(iTime)

return PLUGIN_HANDLED
}

public fnInitiate(iTime)
{
g_bShuttingDown = true

new iCount
for(iCount = iTime;iCount != 0;iCount--)
set_task(float(abs(iCount-iTime)),"fnCallTime",iCount)

set_task(float(iTime),"fnCallTime",0)
}

public fnCallTime(iCount)
{
if(!iCount)
{
switch(g_iMode)
{
case SHUTDOWN :
server_cmd("quit")

case RESTART :
server_cmd("reload")
}
}

new szWord[32]
num_to_word(iCount,szWord,31)

client_cmd(0,"spk ^"fvox/%s^"",szWord)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/


Ошибка компиляции, что не так в коде?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Bloo
сообщение 28.9.2014, 16:03
Сообщение #4


Стаж: 12 лет

Сообщений: 15547
Благодарностей: 6971
Полезность: 1206

yalsrof, ну в ошибке же все пишется, поправил:
Код:
#include <amxmodx>
#include <amxmisc>

/*

Copyleft 2006
Plugin thread: <noindex><a rel="nofollow" href="https://c-s.net.ua/url?u=http%3A%2F%2Famxmodx.org%2Fforums%2Fviewtopic.php%3Fp%3D211244" target="_blank">http://amxmodx.org/forums/viewtopic.php?p=211244</a></noindex>

SERVER RESTART
==============

Description
This plugin is basically an extension of mysticssjgoku4's server shutdown,
which is very limited and hardcoded (although it does work).
It also logs when admins use it, and displays messages according to
your amx_show_activity cvar.

Commands
amx_restart (seconds 1-20) - will restart the server in (seconds),
counting down along the way. Serverdoc or any autorestarting tool
is not needed for this, it will restart on it's own.
Clients will also reconnect.

amx_shutdown (seconds 1-20) - will shut down the server in (seconds),
counting down along the way. This will shut the server down entirely
unless you have serverdoc or another autorestarting tool. Clients
will not reconnect.

Credits
mysticssjgoku4 for the original idea.

Changelog:

Feb 1, 2006 - v2.0 - Release
Feb 2, 2006 - v2.0 RC1 - Some fixes for Restart not working
Feb 2, 2006 - v2.1 - Cut code down slightly, changed voice to fvox
Jun 8, 2006 - v2.2 - Changed restart command to "reload", conformed to newer coding standards

*/

enum
{
SHUTDOWN = 0,
RESTART
}

new g_bShuttingDown
new g_iMode

public plugin_init()
{
register_plugin("Server Shutdown","2.2","Hawk552")

register_concmd("amx_shutdown","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - shuts down the server in seconds")
register_concmd("amx_restart","fnShutDown",ADMIN_RCON,"<seconds (1-20)> - restarts the server in seconds")
}

public fnShutDown(id,level,cid)
{
if(!cmd_access(id,level,cid,2) || g_bShuttingDown)
return PLUGIN_HANDLED

new szArg[6]
read_argv(0,szArg,5)

// Because SHUTDOWN = 0, we can assume that if it's not
// amx_restart, then it must be SHUTDOWN.
if(equali(szArg,"amx_r"))
g_iMode = RESTART

read_argv(1,szArg,5)
new iTime = str_to_num(szArg)

if(!iTime || iTime > 20)
{
console_print(id,"You did not supply a valid time (between 1-20 seconds)")

return PLUGIN_HANDLED
}

new szName[32]
get_user_name(id,szName,31)

new szAuthid[32]
get_user_authid(id,szAuthid,31)

log_amx("Cmd: ^"%s<%i><%s>^" initiate %s",szName,id,szAuthid,g_iMode ? "restart" : "shutdown")

switch(get_cvar_num("amx_show_activity"))
{
case 1 :{
set_hudmessage(255, 0, 0, -1.0, 0.4, 0, 6.0, 1.0);
show_hudmessage(0, "ADMIN: %s server in %i seconds",g_iMode ? "Restart" : "Shutdown",iTime);}
case 2 :{
set_hudmessage(255, 0, 0, -1.0, 0.4, 0, 6.0, 1.0);
show_hudmessage(0, "ROOT %s: %s server in %i seconds",szName,g_iMode ? "Restart" : "Shutdown",iTime);}
}

fnInitiate(iTime)

return PLUGIN_HANDLED
}

public fnInitiate(iTime)
{
g_bShuttingDown = true

new iCount
for(iCount = iTime;iCount != 0;iCount--)
set_task(float(abs(iCount-iTime)),"fnCallTime",iCount)

set_task(float(iTime),"fnCallTime",0)
}

public fnCallTime(iCount)
{
if(!iCount)
{
switch(g_iMode)
{
case SHUTDOWN :
server_cmd("quit")

case RESTART :
server_cmd("reload")
}
}

new szWord[32]
num_to_word(iCount,szWord,31)

client_cmd(0,"spk ^"fvox/%s^"",szWord)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя yalsrof
сообщение 28.9.2014, 19:47
Сообщение #5
Стаж: 12 лет

Сообщений: 43
Благодарностей: 5
Полезность: 85

Bloo, благодарю.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: