Indentation
#1

Can someone please fix this for me, for some odd reason it will not work, its a loose indentation.
PHP код:
public SaveGeneralData()
{
    {
        for(new 
0MAX_PLAYERSi++)
        {
            
TogglePlayerControllable(ifalse);
            
ClearAnimations(i);
            
QuickSave(i);
        }
        
                {
                    
SendClientMessageToAll(LIGHTRED"[Server] Server is now saving your data, please wait for it to complete.");
                    
SaveGroups();
                    
UpdateAnalysis();
                    
SaveJobs();
                    
SaveHouses();
                    
SaveBusinesses();
                }
    }
    if(
CurGMX == 1)
    {
        
SendClientMessageToAll(WHITE"Any changes made now will not be saved until the server has fully rebooted.");
        for(new 
0MAX_PLAYERSi++)
        {
            
TogglePlayerControllable(ifalse);
            
ClearAnimations(i);
            
QuickSave(i);
        }
        
CurGMX 2;
    }
    else
    {
        for(new 
0MAX_PLAYERSi++)
        {
            
SavePlayerData(i);
        }
    }
    return 
1;

Reply
#2

Why don't you search for some indentation tutorials, learn to indent and fix it yourself instead?
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=256961

Код:
public SaveGeneralData() 
{ 
	for(new i = 0; i < MAX_PLAYERS; i++) 
	{ 
		TogglePlayerControllable(i, false); 
		ClearAnimations(i); 
		QuickSave(i); 
	}  
	SendClientMessageToAll(LIGHTRED, "[Server] Server is now saving your data, please wait for it to complete."); 
	SaveGroups(); 
	UpdateAnalysis(); 
	SaveJobs(); 
	SaveHouses(); 
	SaveBusinesses(); 
	if(CurGMX == 1) 
	{ 
		SendClientMessageToAll(WHITE, "Any changes made now will not be saved until the server has fully rebooted."); 
		for(new i = 0; i < MAX_PLAYERS; i++) 
		{ 
			TogglePlayerControllable(i, false); 
			ClearAnimations(i); 
			QuickSave(i); 
		} 
		CurGMX = 2; 
	} 
	else 
	{ 
		for(new i = 0; i < MAX_PLAYERS; i++) 
		{ 
			SavePlayerData(i); 
		} 
	} 
	return 1; 
}
Copy and paste that if you want to be lazy, if you want to learn, read the link I posted.

Quick highlighting:

PHP код:
public SaveGeneralData() 

    {  
// what is this doing?
        
for(new 0MAX_PLAYERSi++) 
        { 
            
TogglePlayerControllable(ifalse); 
            
ClearAnimations(i); 
            
QuickSave(i); 
        } 
         
                {  
// what is this doing?
                    
SendClientMessageToAll(LIGHTRED"[Server] Server is now saving your data, please wait for it to complete."); 
                    
SaveGroups(); 
                    
UpdateAnalysis(); 
                    
SaveJobs(); 
                    
SaveHouses(); 
                    
SaveBusinesses(); 
                }  
// what is this doing?
    
// what is this doing? 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)