I was able to fix the script even when the compile has no errors, but when I log in to the server and type timeleft (before that I type the command mp_maxrounds 15) it only shows me "[KGB] preostalo rundi 33" and that display every round.
Can anybody help?
Here is the script:
Code:
#include<amxmodx>
#include<amxmisc>
new MaxRounds
new RoundCount
public plugin_init() {
register_plugin("timeleft", "", "Muhammet Kaya")
register_logevent("round_end", 2, "1=Round_End")
register_event("TextMsg", "new_map_or_restart", "a", "2&#Game_C", "2&#Game_w")
register_clcmd("say timeleft","ShowRoundsLeft")
MaxRounds = get_cvar_pointer("mp_maxrounds")
}
public round_end()
{
RoundCount++
}
public new_map_or_restart()
{
RoundCount = 0
}
public ShowRoundsLeft(id)
{
if(get_pcvar_num(MaxRounds) == 0)
{
client_print_color(id,print_chat,"!g[KGB] !nNema ogranicenja rundi!")
}
if(get_pcvar_num(MaxRounds) >0)
{
client_print_color(id,print_chat,"!g[KGB] !nPreostalo rundi: !t%d", get_pcvar_num(MaxRounds) - RoundCount)
}
}
stock client_print_color(id, type, const text[], any:...)
{
if(type == print_chat)
{
new g_iMsgidSayText;
g_iMsgidSayText = get_user_msgid("SayText");
new szMsg[191], iPlayers[32], iCount = 1;
vformat(szMsg, charsmax(szMsg), text, 3);
replace_all(szMsg, charsmax(szMsg), "!g","^x04");
replace_all(szMsg, charsmax(szMsg), "!n","^x01");
replace_all(szMsg, charsmax(szMsg), "!t","^x03");
if(id)
iPlayers[0] = id;
else
get_players(iPlayers, iCount, "ch");
for(new i = 0 ; i < iCount ; i++)
{
if(!is_user_connected(iPlayers[i]))
continue;
message_begin(MSG_ONE_UNRELIABLE, g_iMsgidSayText, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}
}