Átírtam a plugin úgy, hogy ne kelljen a Text "előtag", és kivettem belőle a HUD íratást ( mivel azt máshogy is meg tudod valósítani. Pl.: imessages )
Használd így:
Kód:
[szin] szöveg [/szin] // Minden sorba egy üzenet.
Kód:
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 06-21-08
*
* ============
* Changelog:
* ============
*
* v2.1
* -Bug Fix
* -Changed String lengths from 128 - 256
*
* v2.0
* -Remake
*
* v1.0
* -Initial Release
*
*/
#define VERSION "2.1"
#include <amxmodx>
#include <amxmisc>
#define NUM_MESSAGES 20
#define STRING_LEN 256
static const configfile[] = "addons/amxmodx/configs/messages.ini"
new text_messages[NUM_MESSAGES][STRING_LEN]
new saytext_msgid
new num_textmessages, cur_textmessage
public plugin_init()
{
register_plugin("GHW Auto Message Displayer",VERSION,"GHW_Chronic")
register_cvar("advertise_text_len","200.0")
saytext_msgid = get_user_msgid("SayText")
read_configfile()
if(num_textmessages) set_task(get_cvar_float("advertise_text_len"),"display_textmessage",0,"",0,"b")
}
public read_configfile()
{
new Fsize = file_size(configfile,1)
new read[STRING_LEN], trash
for(new i=0;i<Fsize;i++)
{
read_file(configfile,i,read,STRING_LEN - 1,trash)
read_file(configfile,i+1,read,STRING_LEN - 1,trash)
replace_all(read,STRING_LEN - 1,"[blue]","^x03")
replace_all(read,STRING_LEN - 1,"[/blue]","^x01")
replace_all(read,STRING_LEN - 1,"[red]","^x03")
replace_all(read,STRING_LEN - 1,"[/red]","^x01")
replace_all(read,STRING_LEN - 1,"[green]","^x04")
replace_all(read,STRING_LEN - 1,"[/green]","^x01")
replace_all(read,STRING_LEN - 1,"[Blue]","^x03")
replace_all(read,STRING_LEN - 1,"[/Blue]","^x01")
replace_all(read,STRING_LEN - 1,"[Red]","^x03")
replace_all(read,STRING_LEN - 1,"[/Red]","^x01")
replace_all(read,STRING_LEN - 1,"[Green]","^x04")
replace_all(read,STRING_LEN - 1,"[/Green]","^x01")
format(text_messages[num_textmessages],STRING_LEN - 1,"^x04^x01%s",read)
num_textmessages++
}
}
public display_textmessage()
{
new num, players[32], player
get_players(players,num,"ch")
for(new i=0;i<num;i++)
{
player = players[i]
message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
write_byte(player)
write_string(text_messages[cur_textmessage])
message_end()
}
cur_textmessage = (cur_textmessage + 1 ) % num_textmessages
}