Reclama in server

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
lantimilan
Извън линия
Foreigner
Foreigner
Мнения: 424
Регистриран на: 29 Ное 2017, 22:49
Се отблагодари: 31 пъти
Получена благодарност: 3 пъти

Reclama in server

Мнение от lantimilan » 15 Мар 2018, 11:11

Hi i have one plugin but i see he make one error :

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

L 03/15/2018 - 07:57:43: Start of error session.
L 03/15/2018 - 07:57:43: Info (map "35hp_lava2") (file "addons/amxmodx/logs/error_20180315.log")
L 03/15/2018 - 07:57:43: replace() buffer not big enough (128>=127)
L 03/15/2018 - 07:57:43: [AMXX] Displaying debug trace (plugin "reklama-hyrjes.amxx", version "1.2")
L 03/15/2018 - 07:57:43: [AMXX] Run time error 10: native error (native "replace")
L 03/15/2018 - 07:57:43: [AMXX]    [0] 63l01ifc.sma.p::DisplayMsg (line 122)
L 03/15/2018 - 07:57:44: replace() buffer not big enough (128>=127)
L 03/15/2018 - 07:57:44: [AMXX] Displaying debug trace (plugin "reklama-hyrjes.amxx", version "1.2")
L 03/15/2018 - 07:57:44: [AMXX] Run time error 10: native error (native "replace")
L 03/15/2018 - 07:57:44: [AMXX]    [0] 63l01ifc.sma.p::DisplayMsg (line 122)
L 03/15/2018 - 07:57:44: replace() buffer not big enough (128>=127)
Plugin:

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

#include <amxmodx>
#include <amxmisc>

#define UPDATEINTERVAL		0.5
#define LOOPTIME		25
// LOOPTIME / UPDATEINTERVAL = Сколько секунд будет показываться сообщение

new g_CvarAdvertTime, g_CvarAdvertLocation, g_CvarAdvertColor, g_CvarAdvertString,
g_CvarEnterMsgLocation, g_CvarEnterMsgColor, g_CvarEnterMsgString, R_Color, G_Color, B_Color,
Float:X_Location, Float:Y_Location

new HostName[64], TimeLeft[64], NextMap[64], TimeLimit[64], Name[64], Ip[64], MapName[64], CurrentTime[9], looptime[33]
new bool:JustConnected[33]

public plugin_init () 
{
	register_plugin ( "Reklama Server", "1.2", "ExTreM" )
	
	g_CvarAdvertTime		= register_cvar ( "amx_msg_time", "180" )
	g_CvarAdvertLocation		= register_cvar ( "amx_msg_location", "1" )
	g_CvarAdvertColor		= register_cvar ( "amx_msg_color", "6" )
	g_CvarAdvertString		= register_cvar ( "amx_msg_advert", "~> Ju deshirojme loje te kendshme <~" )
	
	g_CvarEnterMsgLocation		= register_cvar ( "amx_emsg_location", "1" )
	g_CvarEnterMsgColor		= register_cvar ( "amx_emsg_color", "6" )
	g_CvarEnterMsgString		= register_cvar ( "amx_emsg_advert", "Miresevini, %name% tek %hname%^nOra: %thetime%^nMapa: %mapname%^nMapa ardhshme: %nextmap%" )
	
	set_task ( get_pcvar_float ( g_CvarAdvertTime ), "CreatAdvert", 123094, _, _, "b" )
}

public client_authorized ( id ) // Игрок вошёл на сервер
{
	looptime[id] = 0
	set_task ( UPDATEINTERVAL, "DisplayMsg", id+1000, _, _, "a", LOOPTIME )
	JustConnected[id] = true
}

public client_disconnect(id) // Игрок вышел
	remove_task(id+1000)

public CreatAdvert ( id )
	set_task ( UPDATEINTERVAL, "DisplayMsg", id, _, _, "a", LOOPTIME )
	
public DisplayMsg ( taskid )
{
	new id
	if(taskid == 123094) // 123094 - это ид рекламы
		id = 0 // поэтому выставляем ид игрока на 0, чтобы реклама показывалась всем
	else
		id = taskid - 1000
	
	if ( is_user_bot ( id ) || is_user_hltv ( id ) ) // Если игрок бот или ХЛТВ, то посылаем их
		return PLUGIN_HANDLED
	
	looptime[id]++
	switch ( JustConnected[id] ? get_pcvar_num ( g_CvarEnterMsgColor ) : get_pcvar_num ( g_CvarAdvertColor ) )
	{
		case 1: // Зелёный
		{
			R_Color = 0
			G_Color = 255
			B_Color = 0
		}
		case 2: // Красный
		{
			R_Color = 255
			G_Color = 0
			B_Color = 0
		}
		case 3: // Синий
		{
			R_Color = 0
			G_Color = 0
			B_Color = 255
		}
		case 4: // Оранжевый
		{
			R_Color = 255
			G_Color = 50
			B_Color = 0
		}
		case 5: // Белый
		{
			R_Color = 255
			G_Color = 255
			B_Color = 255
		}
		case 6: // Рандомно для всего текста
		{
			R_Color = random(255)
			G_Color = random(255)
			B_Color = random(255)
		}
	}
	switch ( JustConnected[id] ? get_pcvar_num ( g_CvarEnterMsgLocation ) : get_pcvar_num ( g_CvarAdvertLocation ) )
	{
		case 1: // Под радаром
		{
			X_Location = 0.01
			Y_Location = 0.23
		}
		case 2: // Сверху
		{
			X_Location = -1.0
			Y_Location = 0.05
		}
	}
	
	get_cvar_string("amx_timeleft",TimeLeft,63)
	get_cvar_string("amx_nextmap",NextMap,63)
	get_time("%H:%M:%S",CurrentTime,8)
	get_cvar_string("hostname",HostName,63)
	get_user_ip( id, Ip, 63 )
	get_user_name( id, Name, 63 )
	get_cvar_string("mp_timelimit",TimeLimit,63)
	get_mapname( MapName, 63 )
	
	static g_displayMsg[512]
	get_pcvar_string ( JustConnected[id] ? g_CvarEnterMsgString : g_CvarAdvertString, g_displayMsg, sizeof g_displayMsg -1 )
	
	replace(g_displayMsg, 127, "%thetime%", CurrentTime)
	replace(g_displayMsg, 127, "%hname%", HostName)
	replace(g_displayMsg, 127, "%ip%", Ip)
	replace(g_displayMsg, 127, "%mapname%", MapName)
	replace(g_displayMsg, 127, "%name%", Name)
	replace(g_displayMsg, 127, "%timelimit%", TimeLimit)
	replace(g_displayMsg, 127, "%timeleft%", TimeLeft)
	replace(g_displayMsg, 127, "%nextmap%", NextMap)
	
	set_hudmessage ( R_Color, G_Color, B_Color, X_Location, Y_Location, 0, 0.0, UPDATEINTERVAL + 0.08, 0.0, 0.0, -1 )
	show_hudmessage ( id, "%s", g_displayMsg )
	
	if(looptime[id] == LOOPTIME)
		JustConnected[id] = false
	
	return PLUGIN_CONTINUE
}

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Reclama in server

Мнение от OciXCrom » 15 Мар 2018, 15:57

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

#include <amxmodx>
#include <amxmisc>

#define UPDATEINTERVAL		0.5
#define LOOPTIME		25
// LOOPTIME / UPDATEINTERVAL = Сколько секунд будет показываться сообщение

new g_CvarAdvertTime, g_CvarAdvertLocation, g_CvarAdvertColor, g_CvarAdvertString,
g_CvarEnterMsgLocation, g_CvarEnterMsgColor, g_CvarEnterMsgString, R_Color, G_Color, B_Color,
Float:X_Location, Float:Y_Location

new HostName[64], TimeLeft[64], NextMap[64], TimeLimit[64], Name[64], Ip[64], MapName[64], CurrentTime[9], looptime[33]
new bool:JustConnected[33]

public plugin_init () 
{
	register_plugin ( "Reklama Server", "1.2", "ExTreM" )
	
	g_CvarAdvertTime		= register_cvar ( "amx_msg_time", "180" )
	g_CvarAdvertLocation		= register_cvar ( "amx_msg_location", "1" )
	g_CvarAdvertColor		= register_cvar ( "amx_msg_color", "6" )
	g_CvarAdvertString		= register_cvar ( "amx_msg_advert", "~> Ju deshirojme loje te kendshme <~" )
	
	g_CvarEnterMsgLocation		= register_cvar ( "amx_emsg_location", "1" )
	g_CvarEnterMsgColor		= register_cvar ( "amx_emsg_color", "6" )
	g_CvarEnterMsgString		= register_cvar ( "amx_emsg_advert", "Miresevini, %name% tek %hname%^nOra: %thetime%^nMapa: %mapname%^nMapa ardhshme: %nextmap%" )
	
	set_task ( get_pcvar_float ( g_CvarAdvertTime ), "CreatAdvert", 123094, _, _, "b" )
}

public client_authorized ( id ) // Игрок вошёл на сервер
{
	looptime[id] = 0
	set_task ( UPDATEINTERVAL, "DisplayMsg", id+1000, _, _, "a", LOOPTIME )
	JustConnected[id] = true
}

public client_disconnect(id) // Игрок вышел
	remove_task(id+1000)

public CreatAdvert ( id )
	set_task ( UPDATEINTERVAL, "DisplayMsg", id, _, _, "a", LOOPTIME )
	
public DisplayMsg ( taskid )
{
	new id
	if(taskid == 123094) // 123094 - это ид рекламы
		id = 0 // поэтому выставляем ид игрока на 0, чтобы реклама показывалась всем
	else
		id = taskid - 1000
	
	if ( is_user_bot ( id ) || is_user_hltv ( id ) ) // Если игрок бот или ХЛТВ, то посылаем их
		return PLUGIN_HANDLED
	
	looptime[id]++
	switch ( JustConnected[id] ? get_pcvar_num ( g_CvarEnterMsgColor ) : get_pcvar_num ( g_CvarAdvertColor ) )
	{
		case 1: // Зелёный
		{
			R_Color = 0
			G_Color = 255
			B_Color = 0
		}
		case 2: // Красный
		{
			R_Color = 255
			G_Color = 0
			B_Color = 0
		}
		case 3: // Синий
		{
			R_Color = 0
			G_Color = 0
			B_Color = 255
		}
		case 4: // Оранжевый
		{
			R_Color = 255
			G_Color = 50
			B_Color = 0
		}
		case 5: // Белый
		{
			R_Color = 255
			G_Color = 255
			B_Color = 255
		}
		case 6: // Рандомно для всего текста
		{
			R_Color = random(255)
			G_Color = random(255)
			B_Color = random(255)
		}
	}
	switch ( JustConnected[id] ? get_pcvar_num ( g_CvarEnterMsgLocation ) : get_pcvar_num ( g_CvarAdvertLocation ) )
	{
		case 1: // Под радаром
		{
			X_Location = 0.01
			Y_Location = 0.23
		}
		case 2: // Сверху
		{
			X_Location = -1.0
			Y_Location = 0.05
		}
	}
	
	get_cvar_string("amx_timeleft",TimeLeft,63)
	get_cvar_string("amx_nextmap",NextMap,63)
	get_time("%H:%M:%S",CurrentTime,8)
	get_cvar_string("hostname",HostName,63)
	get_user_ip( id, Ip, 63 )
	get_user_name( id, Name, 63 )
	get_cvar_string("mp_timelimit",TimeLimit,63)
	get_mapname( MapName, 63 )
	
	static g_displayMsg[512]
	get_pcvar_string ( JustConnected[id] ? g_CvarEnterMsgString : g_CvarAdvertString, g_displayMsg, sizeof g_displayMsg -1 )
	
	replace(g_displayMsg, charsmax(g_displayMsg), "%thetime%", CurrentTime)
	replace(g_displayMsg, charsmax(g_displayMsg), "%hname%", HostName)
	replace(g_displayMsg, charsmax(g_displayMsg), "%ip%", Ip)
	replace(g_displayMsg, charsmax(g_displayMsg), "%mapname%", MapName)
	replace(g_displayMsg, charsmax(g_displayMsg), "%name%", Name)
	replace(g_displayMsg, charsmax(g_displayMsg), "%timelimit%", TimeLimit)
	replace(g_displayMsg, charsmax(g_displayMsg), "%timeleft%", TimeLeft)
	replace(g_displayMsg, charsmax(g_displayMsg), "%nextmap%", NextMap)
	
	set_hudmessage ( R_Color, G_Color, B_Color, X_Location, Y_Location, 0, 0.0, UPDATEINTERVAL + 0.08, 0.0, 0.0, -1 )
	show_hudmessage ( id, "%s", g_displayMsg )
	
	if(looptime[id] == LOOPTIME)
		JustConnected[id] = false
	
	return PLUGIN_CONTINUE
}

Аватар
lantimilan
Извън линия
Foreigner
Foreigner
Мнения: 424
Регистриран на: 29 Ное 2017, 22:49
Се отблагодари: 31 пъти
Получена благодарност: 3 пъти

Reclama in server

Мнение от lantimilan » 18 Мар 2018, 09:07

Fixed close topic ;)

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

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

Кой е на линия

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