i get this error when i compile .. MSG_ONE or MSG_ONE_UNRELIABLE (loose indentation warnings)
PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <dhudmessage>
#define ADMIN_FLAG ADMIN_BAN
new const VERSION[] = "1.0"
new question[64], answer[32], amount[5], saveamount, playeranswer[33][32], flags[33]
new bool:InQuestion
new cvar_questionduration
new Float:questionduration
new g_iMaxPlayers
new g_bitConnectedPlayers, g_bitAnsweredPlayers
#define MarkUserConnected(%0) g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0) g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0) g_bitConnectedPlayers & (1 << (%0 & 31))
#define MarkUserAnswered(%0) g_bitAnsweredPlayers |= (1 << (%0 & 31))
#define ClearUserAnswered(%0) g_bitAnsweredPlayers &= ~(1 << (%0 & 31))
#define IsUserAnswered(%0) g_bitAnsweredPlayers & (1 << (%0 & 31))
public plugin_init()
{
register_plugin("[ZP] Addon: Q & A", VERSION, "eXcalibur.007")
register_clcmd("say /setquestion", "set_question", ADMIN_FLAG, "- Sets a question for players to answer")
register_clcmd("say_team /setquestion", "set_question", ADMIN_FLAG, "- Sets a question for players to answer")
register_clcmd("say /qna", "set_messagemode", 0, "- Attempt to answer the question")
register_clcmd("say_team /qna", "set_messagemode", 0, "- Attempt to answer the question")
register_clcmd("SetQuestion", "SetQuestion")
register_clcmd("SetAnswer", "SetAnswer")
register_clcmd("SetAmmopacks", "SetAmmopacks")
register_clcmd("AttemptAnswer", "AttemptAnswer")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
cvar_questionduration = register_cvar("zp_qna_duration", "30.0")
g_iMaxPlayers = get_maxplayers()
}
public client_putinserver(id)
{
MarkUserConnected(id)
}
public client_disconnect(id)
{
ClearUserConnected(id)
ClearUserAnswered(id)
}
public event_new_round()
{
questionduration = get_pcvar_float(cvar_questionduration)
for(new i = 1; i <= g_iMaxPlayers; i++)
{
flags[i] = get_user_flags(i)
}
}
public set_question(id)
{
if(!(flags[id] & ADMIN_FLAG))
{
client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
return
}
if(IsUserConnected(id))
{
if(InQuestion)
{
client_print(id, print_chat, "[ZP] There is already and on-going question!")
return
}
client_cmd(id, "messagemode SetQuestion")
}
}
public SetQuestion(id)
{
if(!(flags[id] & ADMIN_FLAG))
{
client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
return
}
if(InQuestion)
{
client_print(id, print_chat, "[ZP] There is already and on-going question!")
return
}
read_argv(1, question, charsmax(question))
remove_quotes(question)
if(equal(question, "") || equal(question, " "))
{
client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
return
}
client_print(id, print_chat, "Question: %s", question)
client_cmd(id, "messagemode SetAnswer")
}
public SetAnswer(id)
{
if(!(flags[id] & ADMIN_FLAG))
{
client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
return
}
if(InQuestion)
{
client_print(id, print_chat, "[ZP] There is already and on-going question!")
return
}
read_argv(1, answer, charsmax(answer))
remove_quotes(answer)
if(equal(answer, "") || equal(answer, " "))
{
client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
return
}
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(id, "Answer: %s", answer)
client_cmd(id, "messagemode SetAmmopacks")
}
public SetAmmopacks(id)
{
if(!(flags[id] & ADMIN_FLAG))
{
client_print(id, print_chat, "[ZP] Sorry, you do not have the minimum required access")
return
}
if(InQuestion)
{
client_print(id, print_chat, "[ZP] There is already and on-going question!")
return
}
read_argv(1, amount, charsmax(amount))
if(equal(amount, "") || equal(amount, " ") || !is_str_num(amount))
{
client_print(id, print_chat, "[ZP] You've entered a blank, a spacebar only or an invalid number. Please try again.")
return
}
saveamount = str_to_num(amount)
set_task(questionduration, "end_question")
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(id, "Question: %s | Ammopacks: %i", question, saveamount)
client_print(0, print_chat, "[ZP] Type /qna to attempt the question")
InQuestion = true
}
public set_messagemode(id)
{
if(IsUserConnected(id))
{
if(!InQuestion)
{
client_print(id, print_chat, "[ZP] Sorry, there is currently no on-going question. Please try again later")
return
}
if(IsUserAnswered(id))
{
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(id, "[ZP] Sorry, you've already answered the question")
return
}
client_cmd(id, "messagemode AttemptAnswer")
}
}
public AttemptAnswer(id)
{
if(IsUserConnected(id))
{
if(!InQuestion)
{
client_print(id, print_chat, "[ZP] Sorry, there is currently no on-going question. Please try again later")
return
}
if(IsUserAnswered(id))
{
client_print(id, print_chat, "[ZP] Sorry, you've already answered the question")
return
}
read_argv(1, playeranswer[id], 31)
remove_quotes(playeranswer[id])
client_print(id, print_chat, "%s", playeranswer[id])
if(equal(playeranswer[id], "") || equal(playeranswer[id], " "))
{
client_print(id, print_chat, "[ZP] You've entered a blank or a spacebar only. Please try again.")
return
}
MarkUserAnswered(id)
}
}
public end_question()
{
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(IsUserAnswered(i))
{
if(equali(answer, playeranswer[i]))
{
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(i, "[ZP] Congratulations, you've won %i by giving the correct answer!", saveamount)
zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + saveamount)
}
else
{
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(i, "[ZP] You've given the wrong answer, better luck next time!")
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(i, "[ZP] The answer is: %s", answer)
}
ClearUserAnswered(i)
}
else
{
set_dhudmessage(0, 255, 0, 0.3, 0.10, 2, 6.0, 6.0)
show_dhudmessage(i, "[ZP] Sorry, you did not answer the question.")
}
}
InQuestion = false
}