Power.
08-02-2012, 10:37 PM
• Descriere: Pluginul face in asa fel sa-i arata jucatorului cand se conecteaza pe server un banner sub bara de Loading.
• Exemplu:
<b>You have to register to ba able to see this link</b>
• Autor: AMX_DEV_TEAM
• Download Plugin:
/*
Created by DJ_WEST
Web: <b>You have to register to ba able to see this link</b>
Русское сообщество по AMX Mod X и SourceMod
Присоединяйтесь к нам. Здесь рождаются новые идеи.
*/
#include <amxmodx>
#define PLUGIN "Loading Game Banner"
#define VERSION "1.3"
#define AUTHOR "DJ_WEST"
#define MAX_SIZE 1012
#define BANNER_FILE "resource/images/nume_poza.tga"
#define TASKID 6892
new const g_Files[][64] =
{
"resource/LoadingDialog.res",
"resource/LoadingDialogNoBanner.res",
"resource/LoadingDialogVAC.res"
}
new g_Text[MAX_SIZE], g_CvarEnabled, g_ChangeDelay[33], bool:g_PlayerConnected[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("change", "Change_LoadingGame")
g_CvarEnabled = register_cvar("amx_banner", "1")
if (get_pcvar_num(g_CvarEnabled))
set_task(0.1, "Read_LoadingGame")
}
public client_connect(id)
client_cmd(id, "cl_allowdownload 1")
public plugin_precache()
{
precache_generic(BANNER_FILE)
}
public Read_LoadingGame()
{
new i_File, s_File[128], s_Banner[32], i_Len
i_Len = strlen(BANNER_FILE)
get_configsdir(s_File, charsmax(s_File))
format(s_File, charsmax(s_File), "%s/loading_banner.ini", s_File)
formatex(s_Banner, i_Len - 4, "%s", BANNER_FILE)
i_File = fopen(s_File, "r")
fgets(i_File, g_Text, MAX_SIZE)
replace(g_Text, charsmax(g_Text), "banner_file", s_Banner)
fclose(i_File)
}
public client_putinserver(id)
{
if (get_pcvar_num(g_CvarEnabled))
{
if (is_user_hltv(id) || is_user_bot(id))
return PLUGIN_HANDLED
g_ChangeDelay[id] = 0
g_PlayerConnected[id] = true
set_task(3.0, "Change_LoadingGame", id)
}
return PLUGIN_HANDLED
}
public Change_LoadingGame(id)
{
set_task(1.0, "Change_LoadingGame_Delay", id + TASKID, "", 0, "a", 4)
}
public Change_LoadingGame_Delay(taskid)
{
new id, i
id = taskid - TASKID
if (!g_PlayerConnected[id])
return PLUGIN_HANDLED
i = g_ChangeDelay[id]
if (i == 3)
{
client_cmd(id, "motdfile motd.txt")
g_ChangeDelay[id] = 0
}
else
{
client_cmd(id, "motdfile %s", g_Files[i])
client_cmd(id, "motd_write %s", g_Text)
g_ChangeDelay[id]++
}
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
g_PlayerConnected[id] = false
remove_task(id + TASKID)
}
stock get_configsdir(s_Name[], i_Len)
return get_localinfo("amxx_configsdir", s_Name, i_Len)
"Resource/LoadingDialog.res"
{
"LoadingDialog"
{
"ControlName" "Frame"
"xpos" "322"
"ypos" "249"
"wide" "380"
"tall" "200"
}
"SysMenu"
{
"ControlName" "Menu"
"wide" "64"
"tall" "24"
}
"InfoLabel"
{
"ControlName" "Label"
"xpos" "20"
"ypos" "34"
"wide" "340"
"tall" "24"
"dulltext" "1"
"labelText" "#GameUI_ParseBaseline"
}
"progress"
{
"ControlName" "ProgressBar"
"xpos" "20"
"ypos" "64"
"wide" "260"
"tall" "24"
}
"CancelButton"
{
"ControlName" "Button"
"xpos" "288"
"ypos" "64"
"wide" "72"
"tall" "24"
"labelText" "#GameUI_Cancel"
"command" "Cancel"
}
"Divider1"
{
"ControlName" "Divider"
"xpos" "20"
"ypos" "104"
"wide" "340"
"tall" "2"
}
"BannerAd"
{
"ControlName""HTML"
"fieldName""BannerAd"
"xpos" "0"
"ypos" "0"
"wide" "0"
"tall" "0"
}
"TimeRemainingLabel"
{
"ControlName" "Label"
"xpos" "20"
"ypos" "108"
"wide" "260"
"tall" "24"
}
"VACImage"
{
"ControlName" "ImagePanel"
"xpos" "20"
"ypos" "124"
"wide" "340"
"tall" "56"
"image" "banner_file"
}
}
• Instalare si Configurare:
- LoadingBanner.ini il copiati in amxmodx/configs
- LoadingBanner.sma il copiati in amxmodx/scripting
- Dupa compilare adaugati in plugins.ini numele pluginului LoadingBanner.amxx
- Imaginea o puneti in cstrike/resource/images cu format .TGA
- Adaugati in amxx.cfg urmatoarele cvaruri
• amx_banner "1/0" Implicit 1 ca pluginul sa functioneze.
• Detalii Imagine:
Trebui sa creem o imagine cu dimensiunile de (340x56) apoi salvam in format .TGA (in momentul in care salvati trebui sa puneti un nume)
Default pluginul vine asa cu director spre imagine:
#define BANNER_FILE "resource/images/banner.tga"
Daca vreti sa schimbati numele pozei, schimbati doar banner.tga
#define BANNER_FILE "resource/images/nume.tga"
• Exemplu:
<b>You have to register to ba able to see this link</b>
• Autor: AMX_DEV_TEAM
• Download Plugin:
/*
Created by DJ_WEST
Web: <b>You have to register to ba able to see this link</b>
Русское сообщество по AMX Mod X и SourceMod
Присоединяйтесь к нам. Здесь рождаются новые идеи.
*/
#include <amxmodx>
#define PLUGIN "Loading Game Banner"
#define VERSION "1.3"
#define AUTHOR "DJ_WEST"
#define MAX_SIZE 1012
#define BANNER_FILE "resource/images/nume_poza.tga"
#define TASKID 6892
new const g_Files[][64] =
{
"resource/LoadingDialog.res",
"resource/LoadingDialogNoBanner.res",
"resource/LoadingDialogVAC.res"
}
new g_Text[MAX_SIZE], g_CvarEnabled, g_ChangeDelay[33], bool:g_PlayerConnected[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("change", "Change_LoadingGame")
g_CvarEnabled = register_cvar("amx_banner", "1")
if (get_pcvar_num(g_CvarEnabled))
set_task(0.1, "Read_LoadingGame")
}
public client_connect(id)
client_cmd(id, "cl_allowdownload 1")
public plugin_precache()
{
precache_generic(BANNER_FILE)
}
public Read_LoadingGame()
{
new i_File, s_File[128], s_Banner[32], i_Len
i_Len = strlen(BANNER_FILE)
get_configsdir(s_File, charsmax(s_File))
format(s_File, charsmax(s_File), "%s/loading_banner.ini", s_File)
formatex(s_Banner, i_Len - 4, "%s", BANNER_FILE)
i_File = fopen(s_File, "r")
fgets(i_File, g_Text, MAX_SIZE)
replace(g_Text, charsmax(g_Text), "banner_file", s_Banner)
fclose(i_File)
}
public client_putinserver(id)
{
if (get_pcvar_num(g_CvarEnabled))
{
if (is_user_hltv(id) || is_user_bot(id))
return PLUGIN_HANDLED
g_ChangeDelay[id] = 0
g_PlayerConnected[id] = true
set_task(3.0, "Change_LoadingGame", id)
}
return PLUGIN_HANDLED
}
public Change_LoadingGame(id)
{
set_task(1.0, "Change_LoadingGame_Delay", id + TASKID, "", 0, "a", 4)
}
public Change_LoadingGame_Delay(taskid)
{
new id, i
id = taskid - TASKID
if (!g_PlayerConnected[id])
return PLUGIN_HANDLED
i = g_ChangeDelay[id]
if (i == 3)
{
client_cmd(id, "motdfile motd.txt")
g_ChangeDelay[id] = 0
}
else
{
client_cmd(id, "motdfile %s", g_Files[i])
client_cmd(id, "motd_write %s", g_Text)
g_ChangeDelay[id]++
}
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
g_PlayerConnected[id] = false
remove_task(id + TASKID)
}
stock get_configsdir(s_Name[], i_Len)
return get_localinfo("amxx_configsdir", s_Name, i_Len)
"Resource/LoadingDialog.res"
{
"LoadingDialog"
{
"ControlName" "Frame"
"xpos" "322"
"ypos" "249"
"wide" "380"
"tall" "200"
}
"SysMenu"
{
"ControlName" "Menu"
"wide" "64"
"tall" "24"
}
"InfoLabel"
{
"ControlName" "Label"
"xpos" "20"
"ypos" "34"
"wide" "340"
"tall" "24"
"dulltext" "1"
"labelText" "#GameUI_ParseBaseline"
}
"progress"
{
"ControlName" "ProgressBar"
"xpos" "20"
"ypos" "64"
"wide" "260"
"tall" "24"
}
"CancelButton"
{
"ControlName" "Button"
"xpos" "288"
"ypos" "64"
"wide" "72"
"tall" "24"
"labelText" "#GameUI_Cancel"
"command" "Cancel"
}
"Divider1"
{
"ControlName" "Divider"
"xpos" "20"
"ypos" "104"
"wide" "340"
"tall" "2"
}
"BannerAd"
{
"ControlName""HTML"
"fieldName""BannerAd"
"xpos" "0"
"ypos" "0"
"wide" "0"
"tall" "0"
}
"TimeRemainingLabel"
{
"ControlName" "Label"
"xpos" "20"
"ypos" "108"
"wide" "260"
"tall" "24"
}
"VACImage"
{
"ControlName" "ImagePanel"
"xpos" "20"
"ypos" "124"
"wide" "340"
"tall" "56"
"image" "banner_file"
}
}
• Instalare si Configurare:
- LoadingBanner.ini il copiati in amxmodx/configs
- LoadingBanner.sma il copiati in amxmodx/scripting
- Dupa compilare adaugati in plugins.ini numele pluginului LoadingBanner.amxx
- Imaginea o puneti in cstrike/resource/images cu format .TGA
- Adaugati in amxx.cfg urmatoarele cvaruri
• amx_banner "1/0" Implicit 1 ca pluginul sa functioneze.
• Detalii Imagine:
Trebui sa creem o imagine cu dimensiunile de (340x56) apoi salvam in format .TGA (in momentul in care salvati trebui sa puneti un nume)
Default pluginul vine asa cu director spre imagine:
#define BANNER_FILE "resource/images/banner.tga"
Daca vreti sa schimbati numele pozei, schimbati doar banner.tga
#define BANNER_FILE "resource/images/nume.tga"