Indentation - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Indentation (
/showthread.php?tid=629460)
Indentation -
ChromeMenu - 27.02.2017
Can someone please fix this for me, for some odd reason it will not work, its a loose indentation.
PHP код:
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;
}
Re: Indentation -
Unte99 - 27.02.2017
Why don't you search for some indentation tutorials, learn to indent and fix it yourself instead?
Re: Indentation -
Toroi - 27.02.2017
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 i = 0; i < MAX_PLAYERS; i++)
{
TogglePlayerControllable(i, false);
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?