Raised This Month: $51 Target: $400
 12% 

Solved Expression has no effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 12-05-2022 , 05:48   Expression has no effect
Reply With Quote #1

hello, i request some help to fix this... last 2 lines gives me the warning

scripting\zm.sma(933 -- 934) : warning 215: expression has no effect
Code:
public NewAppNum()
{
	// New Appear Need Num
	new AliveZombieCount
	for(new i=0;i<MAXPLAYERS+1;i++)
		if(g_isZombie[i] && g_isAlive[i]) AliveZombieCount ++
	g_iBossAppearNeedKill = AliveZombieCount + 1	
	if(AliveZombieCount > 4) g_iBossAppearNeedKill
	print_color(0, "This round the boss will appear after %d zombies die", g_iBossAppearNeedKill);
}

Last edited by eNNkds; 12-11-2022 at 05:37.
eNNkds is offline
Send a message via Skype™ to eNNkds
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-09-2022 , 14:03   Re: Expression has no effect
Reply With Quote #2

It looks like variable, g_iBossAppearNeedKill, was pasted in by mistake.
Code:
public NewAppNum() {     // New Appear Need Num     new AliveZombieCount     for(new i=0;i<MAXPLAYERS+1;i++)     if(g_isZombie[i] && g_isAlive[i])         AliveZombieCount ++     g_iBossAppearNeedKill = AliveZombieCount + 1     if(AliveZombieCount > 4)/*g_iBossAppearNeedKill*/         print_color(0, "This round the boss will appear after %d zombies die", g_iBossAppearNeedKill); }
Quote:
Originally Posted by eNNkds View Post
hello, i request some help to fix this... last 2 lines gives me the warning

scripting\zm.sma(933 -- 934) : warning 215: expression has no effect
Code:
public NewAppNum()
{
	// New Appear Need Num
	new AliveZombieCount
	for(new i=0;i<MAXPLAYERS+1;i++)
		if(g_isZombie[i] && g_isAlive[i]) AliveZombieCount ++
	g_iBossAppearNeedKill = AliveZombieCount + 1	
	if(AliveZombieCount > 4) g_iBossAppearNeedKill
	print_color(0, "This round the boss will appear after %d zombies die", g_iBossAppearNeedKill);
}
__________________

Last edited by DJEarthQuake; 12-09-2022 at 14:22. Reason: redo post
DJEarthQuake is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-09-2022 , 19:32   Re: Expression has no effect
Reply With Quote #3

It is highly recommended that people use braces for code blocks for things like for, while, if, else, etc structures. Doing this can actually help you find issues in your code and makes it more obvious what code is being executed when.

Also, adding vertical whitespace can also help.

PHP Code:
public NewAppNum()
{
    
// New Appear Need Num
    
new AliveZombieCount

    
for(new i=0;i<MAXPLAYERS+1;i++)
    {
        if(
g_isZombie[i] && g_isAlive[i])
        {
            
AliveZombieCount ++
        }
    }

    
g_iBossAppearNeedKill AliveZombieCount 1

    
if(AliveZombieCount 4)
    
g_iBossAppearNeedKill // <-- Out of place!
    
{
        
print_color(0"This round the boss will appear after %d zombies die"g_iBossAppearNeedKill);
    }

__________________

Last edited by fysiks; 12-09-2022 at 19:36.
fysiks is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 12-11-2022 , 05:36   Re: Expression has no effect
Reply With Quote #4

Thank you for helping it's compile withouth warnings now!
eNNkds is offline
Send a message via Skype™ to eNNkds
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:25.


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