[Преработка] на Auto restart round

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
<GOSH>
Извън линия
Потребител
Потребител
Мнения: 66
Регистриран на: 11 Окт 2016, 00:19
Се отблагодари: 1 път
Получена благодарност: 2 пъти
Обратна връзка:

[Преработка] на Auto restart round

Мнение от <GOSH> » 16 Окт 2016, 11:47

Здравейте, искам да ми добавите проверка на този AutoRestart, която не позволява повече от 1 рестарт.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <colorchat>

new g_Seconds
new g_SecondsCvar
new prefix
new pref[32]

public plugin_init() {
	register_plugin("Auto Game Restart with Countdown Timer", "1.0", "AbeX")
	register_event("TextMsg", "game_commencing", "a", "2=#Game_Commencing")
	g_SecondsCvar = register_cvar("autorr_time","40.0")
	prefix = register_cvar("amx_prefix", "Dust2Respawn"); //prefix
}

public game_commencing() {
	if (task_exists(41170))
		remove_task(41170)
	g_Seconds = floatround(get_pcvar_float(g_SecondsCvar))
	new param[32]
	set_task(1.0,"count_rr",41170,param,31,"b",0)	
}

public count_rr() {	
	get_pcvar_string(prefix, pref, 31)
	g_Seconds--;
	set_hudmessage(0, 255, 0, -1.0, 0.1, 0, 6.0, 1.0)
	show_hudmessage(0, "Auto restart round after %d seconds",g_Seconds)	
	if (g_Seconds == 0) {
		server_cmd("sv_restartround 1")	
		remove_task(41170)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
	}
}
Special thanks to OciXCrom & NiTriX

Аватар
zolfeca
Извън линия
Администратор
Администратор
Мнения: 417
Регистриран на: 10 Окт 2016, 23:48
Се отблагодари: 24 пъти
Получена благодарност: 92 пъти

Re: [Преработка] на Auto restart round

Мнение от zolfeca » 16 Окт 2016, 12:17

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <colorchat>

new g_Seconds
new g_SecondsCvar
new prefix
new pref[32]
new bool:g_used = true

public plugin_init() {
   register_plugin("Auto Game Restart with Countdown Timer", "1.0", "AbeX")
   register_event("TextMsg", "game_commencing", "a", "2=#Game_Commencing")
   g_SecondsCvar = register_cvar("autorr_time","40.0")
   prefix = register_cvar("amx_prefix", "Dust2Respawn"); //prefix
}

public game_commencing() {
   if (task_exists(41170))
      remove_task(41170)
   g_Seconds = floatround(get_pcvar_float(g_SecondsCvar))
   new param[32]
   if(g_used )
	{
   set_task(1.0,"count_rr",41170,param,31,"b",0)  
	}
}

public count_rr() {   
   get_pcvar_string(prefix, pref, 31)
   g_Seconds--;
   set_hudmessage(0, 255, 0, -1.0, 0.1, 0, 6.0, 1.0)
   show_hudmessage(0, "Auto restart round after %d seconds",g_Seconds)   
   if (g_Seconds == 0) {
      server_cmd("sv_restartround 1") 
	  g_used = false
      remove_task(41170)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
   }
}

Аватар
<GOSH>
Извън линия
Потребител
Потребител
Мнения: 66
Регистриран на: 11 Окт 2016, 00:19
Се отблагодари: 1 път
Получена благодарност: 2 пъти
Обратна връзка:

Re: [Преработка] на Auto restart round

Мнение от <GOSH> » 16 Окт 2016, 13:04

Има проблем при компилирането
http://imgur.com/a/BV12a
Special thanks to OciXCrom & NiTriX

Аватар
NiTriX
Извън линия
Потребител
Потребител
Мнения: 144
Регистриран на: 07 Окт 2016, 16:23
Местоположение: София
Се отблагодари: 3 пъти
Получена благодарност: 4 пъти

Re: [Преработка] на Auto restart round

Мнение от NiTriX » 16 Окт 2016, 13:14

Проблем вика. :D
Това не е проблем, а предупреждения за неподреден код на 2 ред:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <colorchat>

new g_Seconds
new g_SecondsCvar
new prefix
new pref[32]
new bool:g_used = true

public plugin_init() {
   register_plugin("Auto Game Restart with Countdown Timer", "1.0", "AbeX")
   register_event("TextMsg", "game_commencing", "a", "2=#Game_Commencing")
   g_SecondsCvar = register_cvar("autorr_time","40.0")
   prefix = register_cvar("amx_prefix", "Dust2Respawn"); //prefix
}

public game_commencing() {
   if (task_exists(41170))
      remove_task(41170)
   g_Seconds = floatround(get_pcvar_float(g_SecondsCvar))
   new param[32]
   if(g_used )
   {
   set_task(1.0,"count_rr",41170,param,31,"b",0)  
   }
}

public count_rr() {   
   get_pcvar_string(prefix, pref, 31)
   g_Seconds--;
   set_hudmessage(0, 255, 0, -1.0, 0.1, 0, 6.0, 1.0)
   show_hudmessage(0, "Auto restart round after %d seconds",g_Seconds)   
   if (g_Seconds == 0) {
      server_cmd("sv_restartround 1") 
      g_used = false
      remove_task(41170)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
      ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
   }
}
Пробвай така. Но дори и пак да изкара такива предупреждения, това по никакъв начин не е БЪГ или проблем и не пречи на плъгина и сървъра.
Изображение

Аватар
JustInCase
Извън линия
Потребител
Потребител
Мнения: 582
Регистриран на: 14 Окт 2016, 23:31
Се отблагодари: 4 пъти
Получена благодарност: 15 пъти

Re: [Преработка] на Auto restart round

Мнение от JustInCase » 16 Окт 2016, 13:14

<GOSH> написа:Има проблем при компилирането
http://imgur.com/a/BV12a

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <colorchat>

new g_Seconds
new g_SecondsCvar
new prefix
new pref[32]
new bool:g_used = true

public plugin_init() {
	register_plugin("Auto Game Restart with Countdown Timer", "1.0", "AbeX")
	register_event("TextMsg", "game_commencing", "a", "2=#Game_Commencing")
	g_SecondsCvar = register_cvar("autorr_time","40.0")
	prefix = register_cvar("amx_prefix", "Dust2Respawn"); //prefix
}

public game_commencing() {
	if (task_exists(41170))
		remove_task(41170)
	g_Seconds = floatround(get_pcvar_float(g_SecondsCvar))
	new param[32]
	if(g_used )
	{
		set_task(1.0,"count_rr",41170,param,31,"b",0)  
	}
}

public count_rr() {   
	get_pcvar_string(prefix, pref, 31)
	g_Seconds--;
	set_hudmessage(0, 255, 0, -1.0, 0.1, 0, 6.0, 1.0)
	show_hudmessage(0, "Auto restart round after %d seconds",g_Seconds)   
	if (g_Seconds == 0) {
		server_cmd("sv_restartround 1") 
		g_used = false
		remove_task(41170)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
		ColorChat(0, GREEN, "^x4[%s] S.T.A.Y A.L.I.V.E!!!", pref)
	}
}

Пробвай така.
MANSION - HNS : 45.144.155.99:27026
ONLINE

Аватар
<GOSH>
Извън линия
Потребител
Потребител
Мнения: 66
Регистриран на: 11 Окт 2016, 00:19
Се отблагодари: 1 път
Получена благодарност: 2 пъти
Обратна връзка:

Re: [Преработка] на Auto restart round

Мнение от <GOSH> » 16 Окт 2016, 13:21

Благодаря ви, ключаря да заключи.
Special thanks to OciXCrom & NiTriX

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Google [Bot] и 23 госта