AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [REQ] For fixing plugin (https://forums.alliedmods.net/showthread.php?t=270911)

black_heart 09-01-2015 08:16

[REQ] For fixing plugin
 
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], saveamountplayeranswer[33][32], flags[33]
 
new 
bool:InQuestion
 
new cvar_questionduration
new Float:questionduration
 
new g_iMaxPlayers
 
new g_bitConnectedPlayersg_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 
1<= g_iMaxPlayersi++)
        {
                
flags[i] = get_user_flags(i)
        }
}
 
public 
set_question(id)
{
        if(!(
flags[id] & ADMIN_FLAG))
        {
                
client_print(idprint_chat"[ZP] Sorry, you do not have the minimum required access")
                return
        }
       
        if(
IsUserConnected(id))
        {
                if(
InQuestion)
                {
                        
client_print(idprint_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(idprint_chat"[ZP] Sorry, you do not have the minimum required access")
                return
        }
       
        if(
InQuestion)
        {
                
client_print(idprint_chat"[ZP] There is already and on-going question!")
                return
        }
       
        
read_argv(1questioncharsmax(question))
        
remove_quotes(question)
       
        if(
equal(question"") || equal(question" "))
        {
                
client_print(idprint_chat"[ZP] You've entered a blank or a spacebar only. Please try again.")
                return
        }
       
        
client_print(idprint_chat"Question: %s"question)
        
client_cmd(id"messagemode SetAnswer")
}
 
public 
SetAnswer(id)
{
        if(!(
flags[id] & ADMIN_FLAG))
        {
                
client_print(idprint_chat"[ZP] Sorry, you do not have the minimum required access")
                return
        }
       
        if(
InQuestion)
        {
                
client_print(idprint_chat"[ZP] There is already and on-going question!")
                return
        }
       
        
read_argv(1answercharsmax(answer))
        
remove_quotes(answer)
       
       
        if(
equal(answer"") || equal(answer" "))
        {
                
client_print(idprint_chat"[ZP] You've entered a blank or a spacebar only. Please try again.")
                return
        }
        
set_dhudmessage(025500.30.1026.06.0)
        
show_dhudmessage(id"Answer: %s"answer)
         
client_cmd(id"messagemode SetAmmopacks")
}
 
public 
SetAmmopacks(id)
{
        if(!(
flags[id] & ADMIN_FLAG))
        {
                
client_print(idprint_chat"[ZP] Sorry, you do not have the minimum required access")
                return
        }
       
        if(
InQuestion)
        {
                
client_print(idprint_chat"[ZP] There is already and on-going question!")
                return
        }
       
        
read_argv(1amountcharsmax(amount))
       
        if(
equal(amount"") || equal(amount" ") || !is_str_num(amount))
        {
                
client_print(idprint_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(025500.30.1026.06.0)
        
show_dhudmessage(id"Question: %s | Ammopacks: %i"questionsaveamount)
         
client_print(0print_chat"[ZP] Type /qna to attempt the question")
       
        
InQuestion true
}
 
public 
set_messagemode(id)
{
        if(
IsUserConnected(id))
        {
                if(!
InQuestion)
                {
                        
client_print(idprint_chat"[ZP] Sorry, there is currently no on-going question. Please try again later")
                        return
                }
               
                if(
IsUserAnswered(id))
                {
                      
set_dhudmessage(025500.30.1026.06.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(idprint_chat"[ZP] Sorry, there is currently no on-going question. Please try again later")
                        return
                }
               
                if(
IsUserAnswered(id))
                {
                        
client_print(idprint_chat"[ZP] Sorry, you've already answered the question")
                        return
                }
               
                
read_argv(1playeranswer[id], 31)
                
remove_quotes(playeranswer[id])
               
                
client_print(idprint_chat"%s"playeranswer[id])
               
                if(
equal(playeranswer[id], "") || equal(playeranswer[id], " "))
                {
                        
client_print(idprint_chat"[ZP] You've entered a blank or a spacebar only. Please try again.")
                        return
                }
       
                
MarkUserAnswered(id)
        }
}
 
public 
end_question()
{
        for(new 
1<= g_iMaxPlayersi++)
        {
                if(
IsUserAnswered(i))
                {
                        if(
equali(answerplayeranswer[i]))
                        {
                            
set_dhudmessage(025500.30.1026.06.0)
                        
show_dhudmessage(i"[ZP] Congratulations, you've won %i by giving the correct answer!"saveamount)
                                
zp_set_user_ammo_packs(izp_get_user_ammo_packs(i) + saveamount)
                        }
                        else
                        {
                        
set_dhudmessage(025500.30.1026.06.0)
                        
show_dhudmessage(i"[ZP] You've given the wrong answer, better luck next time!")
                        
set_dhudmessage(025500.30.1026.06.0)
                        
show_dhudmessage(i"[ZP] The answer is: %s"answer)
                        }
                        
ClearUserAnswered(i)
                }
                else
                {
                        
set_dhudmessage(025500.30.1026.06.0)
                        
show_dhudmessage(i"[ZP] Sorry, you did not answer the question.")
                }
        }
        
InQuestion false



iPro 09-01-2015 09:56

Re: [REQ] For fixing plugin
 
The loose indentation means the code isn't aligned correctly, otherwise cant say anything... It doesn't prevent the plugin from working.


All times are GMT -4. The time now is 22:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.