Kod: Tümünü seç
#define VERSION "1.0"
#include <amxmodx>
#include <amxmisc>
//Say'den geçen reklamlar için - GHW_Chronic eklentisini düzenledim, GHW'nin eklentisi daha iyi çalışıyordu. Bu eklentiyi değiştirerek,
//Hud mesajlarını kaldırdım ve reklamları admin/oyuncu olarak böldüm, aynı zamanda saatten çıkartıp sadece öldüklerinde çıkacak şekilde düzenledim.
#if defined _dhudmessage_included
#endinput
#endif
#define _dhudmessage_included
stock __dhud_color;
stock __dhud_x;
stock __dhud_y;
stock __dhud_effect;
stock __dhud_fxtime;
stock __dhud_holdtime;
stock __dhud_fadeintime;
stock __dhud_fadeouttime;
stock __dhud_reliable;
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
{
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
__dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
__dhud_x = _:x;
__dhud_y = _:y;
__dhud_effect = effects;
__dhud_fxtime = _:fxtime;
__dhud_holdtime = _:holdtime;
__dhud_fadeintime = _:fadeintime;
__dhud_fadeouttime = _:fadeouttime;
__dhud_reliable = _:reliable;
return 1;
}
stock show_dhudmessage( index, const message[], any:... )
{
new buffer[ 128 ];
new numArguments = numargs();
if( numArguments == 2 )
{
send_dhudMessage( index, message );
}
else if( index || numArguments == 3 )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
new playersList[ 32 ], numPlayers;
get_players( playersList, numPlayers, "ch" );
if( !numPlayers )
{
return 0;
}
new Array:handleArrayML = ArrayCreate();
for( new i = 2, j; i < numArguments; i++ )
{
if( getarg( i ) == LANG_PLAYER )
{
while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
j = 0;
if( GetLangTransKey( buffer ) != TransKey_Bad )
{
ArrayPushCell( handleArrayML, i++ );
}
}
}
new size = ArraySize( handleArrayML );
if( !size )
{
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
else
{
for( new i = 0, j; i < numPlayers; i++ )
{
index = playersList[ i ];
for( j = 0; j < size; j++ )
{
setarg( ArrayGetCell( handleArrayML, j ), 0, index );
}
vformat( buffer, charsmax( buffer ), message, 3 );
send_dhudMessage( index, buffer );
}
}
ArrayDestroy( handleArrayML );
}
return 1;
}
stock send_dhudMessage( const index, const message[] )
{
message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
{
write_byte( strlen( message ) + 31 );
write_byte( DRC_CMD_MESSAGE );
write_byte( __dhud_effect );
write_long( __dhud_color );
write_long( __dhud_x );
write_long( __dhud_y );
write_long( __dhud_fadeintime );
write_long( __dhud_fadeouttime );
write_long( __dhud_holdtime );
write_long( __dhud_fxtime );
write_string( message );
}
message_end();
}
//dhudmbitis
#define NUM_MESSAGES 20
#define STRING_LEN 256
static const configfile[] = "addons/amxmodx/configs/csm_reklam.ini"
new text_messagesoyuncu[NUM_MESSAGES][STRING_LEN]
new text_messagesadmin[NUM_MESSAGES][STRING_LEN]
new saytext_msgid
new num_textmessagesoyuncu, cur_textmessageoyuncu, num_textmessagesadmin, cur_textmessageadmin
new IPCVAR;
new IP[32];
new TSIPCVAR;
new TSIP[32];
new bool:yaziaktif = false;
public plugin_init()
{
register_plugin("CSMILEFACE REKLAM EKLENTISI",VERSION,"CSmiLeFaCe")
yaziaktif = false;
set_task(60.0, "aktifet")
register_event("DeathMsg","yazdir","a");
IPCVAR = register_cvar("csm_reklamip","cs.csplugin.com")
get_pcvar_string(IPCVAR,IP,31)
TSIPCVAR = register_cvar("csm_reklamtsip","ts3.challengearea.net")
get_pcvar_string(TSIPCVAR,TSIP,31)
saytext_msgid = get_user_msgid("SayText")
read_configfile()
}
public aktifet(){
yaziaktif = true
}
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)
if(containi(read,"Oyuncu")==0)
{
read_file(configfile,i+1,read,STRING_LEN - 1,trash)
replace_all(read,STRING_LEN - 1,"[mavi]","^x03")
replace_all(read,STRING_LEN - 1,"[/mavi]","^x01")
replace_all(read,STRING_LEN - 1,"[kirmizi]","^x03")
replace_all(read,STRING_LEN - 1,"[/kirmizi]","^x01")
replace_all(read,STRING_LEN - 1,"[yesil]","^x04")
replace_all(read,STRING_LEN - 1,"[/yesil]","^x01")
replace_all(read,STRING_LEN - 1,"[Mavi]","^x03")
replace_all(read,STRING_LEN - 1,"[/Mavi]","^x01")
replace_all(read,STRING_LEN - 1,"[Kirmizi]","^x03")
replace_all(read,STRING_LEN - 1,"[/Kirmizi]","^x01")
replace_all(read,STRING_LEN - 1,"[Yesil]","^x04")
replace_all(read,STRING_LEN - 1,"[/Yesil]","^x01")
format(text_messagesoyuncu[num_textmessagesoyuncu],STRING_LEN - 1,"^x04^x01%s",read)
num_textmessagesoyuncu++
}
else if(containi(read,"Admin")==0)
{
read_file(configfile,i+1,read,STRING_LEN - 1,trash)
replace_all(read,STRING_LEN - 1,"[mavi]","^x03")
replace_all(read,STRING_LEN - 1,"[/mavi]","^x01")
replace_all(read,STRING_LEN - 1,"[kirmizi]","^x03")
replace_all(read,STRING_LEN - 1,"[/kirmizi]","^x01")
replace_all(read,STRING_LEN - 1,"[yesil]","^x04")
replace_all(read,STRING_LEN - 1,"[/yesil]","^x01")
replace_all(read,STRING_LEN - 1,"[Mavi]","^x03")
replace_all(read,STRING_LEN - 1,"[/Mavi]","^x01")
replace_all(read,STRING_LEN - 1,"[Kirmizi]","^x03")
replace_all(read,STRING_LEN - 1,"[/Kirmizi]","^x01")
replace_all(read,STRING_LEN - 1,"[Yesil]","^x04")
replace_all(read,STRING_LEN - 1,"[/Yesil]","^x01")
format(text_messagesadmin[num_textmessagesadmin],STRING_LEN - 1,"^x04^x01%s",read)
num_textmessagesadmin++
}
}
}
public yazdir(){
if(yaziaktif == true) {
new olen = read_data(2);
if(get_user_flags(olen) & ADMIN_BAN)
{
display_textmessageadmin(olen);
}
else {
display_textmessageoyuncu(olen);
set_dhudmessage( 0, 160, 0, -1.0, 0.25, 2, 6.0, 200.0, 0.1, 1.5 );
show_dhudmessage(olen, "Suanda oynadiginiz IP^n %s",IP);
}
set_dhudmessage( 255, 255, 255, -1.0, 1.0, 2, 6.0, 200.0, 0.1, 1.5 );
show_dhudmessage(olen, "%s",TSIP)
}
}
public display_textmessageoyuncu(olen)
{
message_begin(MSG_ONE,saytext_msgid,{0,0,0},olen);
write_byte(olen);
write_string(text_messagesoyuncu[cur_textmessageoyuncu]);
message_end();
cur_textmessageoyuncu = (cur_textmessageoyuncu + 1 ) % num_textmessagesoyuncu;
}
public display_textmessageadmin(olen)
{
message_begin(MSG_ONE,saytext_msgid,{0,0,0},olen);
write_byte(olen);
write_string(text_messagesoyuncu[cur_textmessageadmin]);
message_end();
cur_textmessageadmin = (cur_textmessageadmin + 1 ) % num_textmessagesadmin;
}
//Bu eklenti www.csplugin.com da paylaşılmıştır. Eklenti yazarı CSmiLeFaCe "https://www.facebook.com/profile.php?id=100005119756469" Tarih 25.03.2015 [BvS]
@CSmiLeFaCe