deaddiesel | Дата: Воскресенье, 2018-07-01, 19:57 | Сообщение # 1 |
Сообщений: 4
| Такая проблема, DHUD в игре мигает и мешает остальным плагинам отображаться, они все мерцают:
Cсылка на исходник: https://yadi.sk/d/_0CWuZWM3YeVHi
/*Credits To HAMMER Studios for Model (Gamebanana) because i am also member @ that Thanks To Reydifox for Adjusting My DJ MOD idea.*/
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <fakemeta> #include <cstrike> #include <engine> #include <fun>
#define PLAYWLC "mp3 play sound/djmod/wlc.mp3" #define STOP "mp3 stop"
#define Freeze(%1) (frozen |= (1<<(%1&31))) #define X "DJ Mod" //(frozen += (1<<(%1&31))) #define UnFreeze(%1) (frozen &= ~(1<<(%1&31))) #define Y "1.1.3" //(frozen != (1<<(%1&31))) #define IsFrozen(%1) (frozen & (1<<(%1&31))) #define Z "VeDuBot" //(frozen == (1<<(%1&31))) #define MAX_PLAYERS 32 #define TASK_SHOW_TIME 10113
new gDJ, serverDJ, cvar_info, ctime[64], frozen, dj_freeze, song_time, g_Mix_menu, g_Song_menu, g_ConfDir[128], Title[128], playing ;
new const INFO[] = "^1[^4DJ Mod^1]"
stock chat(id, const input[], any:...) { new count = 1, players[32], msgid static msg[191] msgid = get_user_msgid("SayText") vformat(msg, 190, input, 3) replace_all(msg, 190, "!g", "^4") // Green Color replace_all(msg, 190, "!y", "^1") // Default Color replace_all(msg, 190, "!team", "^3") // Team Color if (id) players[0] = id; else get_players(players, count, "c") { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, msgid,_, players[i]) write_byte(players[i]); write_string(msg); message_end(); } } } }
public plugin_init() { register_plugin(X, Y, Z) register_clcmd("say /dj", "make_dj") register_clcmd("say_team /dj", "make_dj") register_clcmd("say /djmenu", "dj_menu") register_clcmd("say_team /djmenu", "dj_menu")
set_task(1.0, "show_dj",0,"",0,"b") set_task(1.0, "show_dj_time",0,"",0,"b") register_dictionary("timeleft.txt") register_dictionary("djmod.txt"); RegisterHam(Ham_Killed, "player", "player_killed") ///////////////////////////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////HERE YOU CAN CHANGE////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// cvar_info = register_cvar("Info_Bar","1") //Information bar (Time, DJ, etc...) 1 = ON | 0 = OFF dj_freeze = register_cvar("DJ_Freezee","0") //DJ can't move just make song 1 = ON | 0 = OFF ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////UNDER THIS NO///////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// song_time = CreateHudSyncObj() }
public plugin_precache() { get_configsdir(g_ConfDir,128) load_config_mix() load_config_song() } public load_config_mix(){ new loadfile[128] format(loadfile,127,"%s/djmod_mix.cfg",g_ConfDir) new file = fopen(loadfile,"r") g_Mix_menu = menu_create("\w[\rМеню Ди-джея\w]","mix_handle") if ( !file_exists(loadfile) ){ log_amx("DJ MOD: can't find setting djmod_mix.cfg") menu_additem(g_Mix_menu, "none", "-3") return } new data[128] while(!feof(file)){ fgets(file,data,127) new f[128],key[64] trim(data) if(equal(data,"")) continue strbreak(data,key,63,f,127); replace_all ( f, 127, "^"", "" ) replace_all ( key, 63, "^"", "" ) set_vaultdata(key,f); log_amx("DJ MOD: Loaded %s as %s",f,key) engfunc(EngFunc_PrecacheGeneric,f) menu_additem(g_Mix_menu, key, key) } } public load_config_song(){ new loadfile[128] format(loadfile,127,"%s/djmod_song.cfg",g_ConfDir) new file = fopen(loadfile,"r") g_Song_menu = menu_create("\w[\rМеню Ди-джея\w]","song_handle") if ( !file_exists(loadfile) ){ log_amx("DJ MOD: can't find setting djmod_song.cfg") menu_additem(g_Song_menu, "none", "-3") return } new data[128] while(!feof(file)){ fgets(file,data,127) new f[128],key[64] trim(data) if(equal(data,"")) continue strbreak(data,key,63,f,127); replace_all ( f, 127, "^"", "" ) replace_all ( key, 63, "^"", "" ) set_vaultdata(key,f); log_amx("DJ MOD: Loaded %s as %s",f,key) engfunc(EngFunc_PrecacheGeneric,f) menu_additem(g_Song_menu, key, key) } } public player_killed(id) { if(id == gDJ) { gDJ = 0 serverDJ = 0 if(IsFrozen(id)) { UnFreeze(id); set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN); } remove_pult remove_task( TASK_SHOW_TIME + id ); client_cmd(0, STOP) new rand = random_num(0,1) switch(rand) { case 0: { cs_set_user_team(id, CS_TEAM_CT) } case 1: { cs_set_user_team(id, CS_TEAM_T) } } Title = "" } } public make_dj(id) { if(serverDJ == 0) { if(is_user_connected(id)) { gDJ = id serverDJ = 1 if(get_pcvar_num(dj_freeze)) { if(!frozen) Freeze(id); set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN); } strip_user_weapons(id) give_item(id, "weapon_knife") dj_menu(id) client_cmd(0, PLAYWLC) cs_set_user_team(id, CS_TEAM_SPECTATOR) new origin[3] new Float:ang[3]; pev( id, pev_origin, origin ) pev(id, pev_v_angle, ang) new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) ) entity_set_string(ent, EV_SZ_classname, "djpult") set_pev( ent, pev_origin, origin) set_pev( ent, pev_v_angle, ang) set_pev( ent, pev_framerate, 1.0) set_task(0.1, "show_dj_time", TASK_SHOW_TIME + id) set_hudmessage(255, 0, 0, 0.45, 0.55, 2, 0.1, 4.0, 0.1, 0.1, -1) ShowSyncHudMsg(id, song_time, "%L", LANG_PLAYER, "TITLE", Title) return FMRES_SUPERCEDE; } } else { if(id != gDJ) { chat(id, "%L", LANG_PLAYER, "SERVER_DJ_IS", INFO) } else { chat(id, "%L", LANG_PLAYER, "DJ_IS", INFO) } }
return PLUGIN_HANDLED }
public remove_pult() { new nextitem = find_ent_by_class(-1,"djpult") while(nextitem) { remove_entity(nextitem) nextitem = find_ent_by_class(-1,"djpult") } return PLUGIN_CONTINUE }
public client_putinserver(id) { gDJ = 0 serverDJ = 0 playing = 0 }
public client_connect(id) { gDJ = 0 serverDJ = 0 playing = 0 }
public client_disconnect(id) { gDJ = 0 serverDJ = 0 playing = 0 }
public dj_menu(id) { if(serverDJ == 1) if(id == gDJ) { new name[32] get_user_name(gDJ, name, 31) chat(0, "%L", LANG_PLAYER, "MENU",INFO,name) new menu = menu_create("\w[\rМеню Ди-джея\w]", "djmenu_handler");
menu_additem(menu, "\r[\yПроигрывать\r]", "1", 0); menu_additem(menu, "\r[\yПлей-лист\r]", "2", 0); menu_additem(menu, "\r[\yПрервать вечеринку\r]", "3", 0); menu_setprop(menu, MPROP_NEXTNAME, "Вперед") menu_setprop(menu, MPROP_BACKNAME, "Назад") menu_setprop(menu, MPROP_EXITNAME, "Выход") menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); menu_display(id, menu, 0); } else { chat(id, "%L", LANG_PLAYER, "DJ_NOT", INFO) } else chat(id, "%L", LANG_PLAYER, "SERVER_DJ_NOT", INFO) } public djmenu_handler(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); return PLUGIN_HANDLED; } new data[6], iName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); new key = str_to_num(data);
switch(key) { case 1: { menu_display(id,g_Song_menu,0) } case 2: { menu_display(id,g_Mix_menu,0) } case 3: { client_cmd(0, STOP) Title = "" } } menu_destroy(menu); return PLUGIN_HANDLED; } public mix_handle(id , menu, item){ if(id == gDJ) { if( item < 0 ) return PLUGIN_CONTINUE new cmd[64] new access, callback menu_item_getinfo(menu, item, access, cmd,63,_,_, callback) start_mix(cmd) menu_display(id,g_Mix_menu,0) playing = 1 } return PLUGIN_HANDLED } public song_handle(id , menu, item){ if(id == gDJ) { if( item < 0 ) return PLUGIN_CONTINUE new cmd[64] new access, callback menu_item_getinfo(menu, item, access, cmd,63,_,_, callback) start_song(cmd) menu_display(id,g_Song_menu,0) playing = 1 } return PLUGIN_HANDLED } public start_mix(const str[]){ client_cmd(0, STOP) new param[ 1 ] param[ 0 ] = EncodeText( str ) set_task(0.1,"start_mix_play",0+2048,param,1); } public start_song(const str[]){ client_cmd(0, STOP) new param[ 1 ] param[ 0 ] = EncodeText( str ) set_task(0.1,"start_song_play",0+2048,param,1); } public start_mix_play(str[]){ new text[128] DecodeText( str[0], text, 127 ) new file[128] get_vaultdata(text,file,127) parse(text, charsmax(text)) Title = text client_cmd(0,"mp3 play %s",file) } public start_song_play(str[]){ new text[128] DecodeText( str[0], text, 127 ) new file[128] get_vaultdata(text,file,127) new name[32] get_user_name(gDJ, name, 31) chat(0, "%L", LANG_PLAYER, "DJ_PLAY", INFO, name, text) parse(text, charsmax(text)) Title = text client_cmd(0,"mp3 play %s",file) } public show_dj(id) { if(get_pcvar_num(cvar_info)) { new name[32] get_user_name(gDJ, name, 31) new nextmap[32] new timeleft = get_timeleft() get_cvar_string("amx_nextmap",nextmap,31) if(serverDJ == 1) { set_hudmessage(255, 125, 0, 0.3, 0.0, 0, 0.0, 999.0, 0.0, 0.0, 4) show_hudmessage(0,"%L", LANG_PLAYER, "INFO",timeleft / 60, timeleft % 60, ctime, name) if (get_cvar_num("amx_time_voice")) { new mhours[6], mmins[6], whours[32], wmins[32], wpm[6] get_time("%H", mhours, 5) get_time("%M", mmins, 5) new mins = str_to_num(mmins) new hrs = str_to_num(mhours) if (mins) num_to_word(mins, wmins, 31) else wmins[0] = 0 if (hrs < 12) wpm = "am " else { if (hrs > 12) hrs -= 12 wpm = "pm " } if (hrs) num_to_word(hrs, whours, 31) else whours = "twelve " } get_time("%m/%d/%Y - %H:%M:%S", ctime, 63) } else { set_hudmessage(255, 125, 0, 0.3, 0.0, 0, 0.0, 999.0, 0.0, 0.0, 4) show_hudmessage(0,"%L", LANG_PLAYER, "INFO_DJ_NOfoxReydifoxT",timeleft / 60, timeleft % 60, ctime) if (get_cvar_num("amx_time_voice")) { new mhours[6], mmins[6], whours[32], wmins[32], wpm[6] get_time("%H", mhours, 5) get_time("%M", mmins, 5) new mins = str_to_num(mmins) new hrs = str_to_num(mhours) if (mins) num_to_word(mins, wmins, 31) else wmins[0] = 0 if (hrs < 12) wpm = "am " else { if (hrs > 12) hrs -= 12 wpm = "pm " } if (hrs) num_to_word(hrs, whours, 31) else whours = "twelve " } get_time("%m/%d/%Y - %H:%M:%S", ctime, 63) } } return PLUGIN_CONTINUE; } public show_dj_time(task) { new id = task - TASK_SHOW_TIME if(id == gDJ) { if(!equal(Title, "") || playing == 1) { set_hudmessage(255, 0, 0, 0.45, 0.55, 2, 0.1, 999.0, 0.1, 0.1, -1) ShowSyncHudMsg(id, song_time, "%L", LANG_PLAYER, "TITLE", Title) } else { set_hudmessage(255, 0, 0, 0.45, 0.55, 2, 0.1, 999.0, 0.1, 0.1, -1) ShowSyncHudMsg(id, song_time, "") } } set_task(1.0, "show_dj_time", TASK_SHOW_TIME + id) } EncodeText( const text[] ) { return engfunc( EngFunc_AllocString, text ) } DecodeText( const text, string[], const length ) { global_get( glb_pStringBase, text, string, length ) } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1051\\ f0\\ fs16 \n\\ par } */
|
|
| |