Raised This Month: $ Target: $400
 0% 

error 036: empty statement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ish12321
Veteran Member
Join Date: May 2016
Old 11-02-2016 , 22:27   error 036: empty statement
Reply With Quote #1

PHP Code:
    switch (get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE]))
    {
        case 
1// SteamID
        
{
            
get_user_authid(idsavebycharsmax(saveby));
            if(
get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE_SECONDARY]) && ((equali(saveby"STEAM_ID_LAN")) || (equali(saveby"VALVE_ID_LAN"))));
            {
                
get_user_name(idsavebycharsmax(saveby));
            }
        }
        case 
2// Name
        
{
            
get_user_name(idsavebycharsmax(saveby));
        }
    } 
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here

Last edited by ish12321; 11-02-2016 at 22:27.
ish12321 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-03-2016 , 03:26   Re: error 036: empty statement
Reply With Quote #2

You put a semicolon after the IF statement.
klippy is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 11-03-2016 , 09:18   Re: error 036: empty statement
Reply With Quote #3

Quote:
Originally Posted by ish12321 View Post
PHP Code:
    switch (get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE]))
    {
        case 
1// SteamID
        
{
            
get_user_authid(idsavebycharsmax(saveby));
            if(
get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE_SECONDARY]) && ((equali(saveby"STEAM_ID_LAN")) || (equali(saveby"VALVE_ID_LAN"))));
            {
                
get_user_name(idsavebycharsmax(saveby));
            }
        }
        case 
2// Name
        
{
            
get_user_name(idsavebycharsmax(saveby));
        }
    } 
Also you can optimize it and not use switch.

You can directly check for case 1 and add the rest of your condition.
Like this:


PHP Code:
if(get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE]) == && !get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE_SECONDARY]) && !equali(saveby"STEAM_ID_LAN") && !equali(saveby"VALVE_ID_LAN"));
{
    
get_user_authid(idsavebycharsmax(saveby));
}
else
{
    
get_user_name(idsavebycharsmax(saveby));


Last edited by siriusmd99; 11-03-2016 at 09:18.
siriusmd99 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-03-2016 , 10:03   Re: error 036: empty statement
Reply With Quote #4

I think readability is still more important than optimizing something like that...
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
ish12321
Veteran Member
Join Date: May 2016
Old 11-03-2016 , 11:34   Re: error 036: empty statement
Reply With Quote #5

Quote:
Originally Posted by siriusmd99 View Post
Also you can optimize it and not use switch.

You can directly check for case 1 and add the rest of your condition.
Like this:


PHP Code:
if(get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE]) == && !get_pcvar_num(g_Pcvar[CVAR_WC3_G_SAVE_MODE_SECONDARY]) && !equali(saveby"STEAM_ID_LAN") && !equali(saveby"VALVE_ID_LAN"));
{
    
get_user_authid(idsavebycharsmax(saveby));
}
else
{
    
get_user_name(idsavebycharsmax(saveby));

I'm soon gonna add another case to it
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
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 15:21.


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