I\'ve reviewed your script and have some suggestions.
1.)
DisplayConfig()
This is a pretty ugly way to set this up recently I\'ve found that using the conditional operator "?" is actually really useful in these circumstances try modifying your code in this manner.
Code:
new Enable[7] = "Enable";
new Disable[8] = "Disable";
printf("AutoLogin: [ %s ] - ConnectMsgs: [ %s ]
ReadPMs: [ %s ] - ReadCmds: [ %s ]
AntiAd: [ %s ] - SpamTime: [ %i ]",
sInfo[AutoLogin] ? Enable : Disable,
sInfo[ConnectMsgs] ? Enable : Disable,
sInfo[ReadPMs] ? Enable : Disable,
sInfo[AntiAd] ? Enable : Disable,
sInfo[SaveCash] ? Enable : Disable,
sInfo[SpamTime]);
That looks a lot cleaner and easier to update don\'t you think ?
2.) Get rid of DINI it\'s old and slow and really has no place anymore.
3.) Avoid using un-need returns this creates convoluted code which is difficult to read as a simple example look at this.
Code:
CMD:resetwarn(playerid, params[])
{
new id, str[150];
CL(playerid);
if(pInfo[playerid][Admin] >= 5 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "u", id))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /resetwarn [playerid]");
SendClientMessage(playerid, COLOR_ORANGE, "Function: Resets specified player\'s warning!");
}
else
{
if(id == INVALID_PLAYER_ID) Error(playerid, 0);
else
{
pInfo[id][Warn] = 0;
format(str, sizeof(str), "You\'ve reset %s(ID:%d) warning", GetName(id), id);
SendClientMessage(playerid, COLOR_YELLOW, str);
format(str, sizeof(str), "Administrator %s(ID:%d) has reset your warning", GetName(playerid), playerid);
SendClientMessage(id, COLOR_YELLOW, str);
}
}
}
else Error(playerid, 7);
return 1;
}
That looks a lot better I think it has a nice clean easy to follow flow.
4.) If you look at this command
Code:
CMD:spam(playerid, params[])
You\'ll notice a series of elseif\'s this is kind of minor but if you have more than 5 elseif\'s your should use a switch if possible.
5.) Replace all your loops like this
Code:
for(new i = 0; i < MAX_PLAYERS; i++)
with foreach()
6.) OnDialogReponse() should use a switch(dialogid) then call seperate functions outside of the callback it\'s bad practice to let a function go on and on for thousands of lines ( Starts at 1582 goes to line 6568 ) not good.
7.) Condense your code if you do the step above it would eliminate the need for having a register dialog and register command that do the exact same thing with the exact same code when you update these in the current state you need to update both sections of code calling a common function will save a lot of time and maintain consistency.
Anyways those are the main things I\'m seeing it\'s no where near as ugly as J.L Admin but if you take the time to do some the optimizations I\'ve listed it will reduce your lines and make your script a lot easier to update.
5/10 not horrible but also not that great.