.sma
#include <amxmodx> #include <amxmisc> #include <color> #define PLUGIN "Nozowka" #define VERSION "1.0" #define AUTHOR "R3X" #define TIMER 33 #define MUSIC1 "rzeznia/come_back.mp3" #define MUSIC2 "rzeznia/hitmenn1.mp3" new gcvarTime; new g_cvarTimerColor,g_cvarTimerX,g_cvarTimerY; new bool:gbActive=false, bool:gbToStart=false; new giTime=0; new iColor[3]; new Float:fPosition[2]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_dictionary("restart.txt"); colors_init(); register_event("TextMsg", "Game_Restart", "a", "2Game_C"); register_logevent("onNewRound", 2,"1=Round_Start"); register_event("CurWeapon","event_CurWeapon","be"); gcvarTime=register_cvar("sv_restarttime","45"); g_cvarTimerColor=register_cvar("restart_timer_color","green"); g_cvarTimerX=register_cvar("restart_timer_pozx","0.34",0,0.34); g_cvarTimerY=register_cvar("restart_timer_pozy","0.02",0,0.02); } public Game_Restart(){ gbToStart=true; } public onNewRound(){ if(!gbToStart) return PLUGIN_CONTINUE; gbActive=true; gbToStart=false; giTime=get_systime(); play(0,MUSIC1); set_task(1.0,"restartRoundHandler",TIMER,_,_,"b"); new szColor[COLORS_NAME_LEN+1]; get_pcvar_string(g_cvarTimerColor,szColor,COLORS_NAME_LEN); iColor[0]=get_color(szColor,R); iColor[1]=get_color(szColor,G); iColor[2]=get_color(szColor,<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='B)' />; fPosition[0]=get_pcvar_float(g_cvarTimerX); fPosition[1]=get_pcvar_float(g_cvarTimerY); return PLUGIN_CONTINUE; } public restartRoundHandler(){ new iToRes=get_pcvar_num(gcvarTime)-(get_systime()-giTime); if(iToRes==0){ play(0); server_cmd("sv_restartround 1"); play(0,MUSIC2); gbActive=false; remove_task(TIMER); } new fx=0; if(iToRes<=5){ fx=1; } set_hudmessage(iColor[0], iColor[1], iColor[2], fPosition[0], fPosition[1], fx, 6.0, 1.0) show_hudmessage(0, "%L^n%2d:%02d",LANG_PLAYER,"WARMUP",iToRes/60,iToRes%60); } public event_CurWeapon(id){ if(gbActive){ client_print(id,print_center,"Tylko noz"); engclient_cmd(id,"weapon_knife"); } return PLUGIN_CONTINUE; } stock play(id, sound[]=""){ if(sound[0]=='^0') client_cmd(0,"stopsound;mp3 stop"); else{ new end=strlen(sound)-4; if(containi(sound,".mp3") == end && end>0) client_cmd(id,"mp3 play sound/%s",sound); else if(containi(sound,".wav") == end && end>0) client_cmd(id, "spk sound/%s",sound); else client_cmd(id, "speak %s",sound); } } public plugin_precache(){ precache_sound(MUSIC1); precache_sound(MUSIC2); }
Dzięki