05.04.2013, 04:09
Quote:
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]); 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; } 4.) If you look at this command Code:
CMD:spam(playerid, params[]) 5.) Replace all your loops like this Code:
for(new i = 0; i < MAX_PLAYERS; i++) 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. |
I\'ve used YINI in the previous version of JakAdmin which is RomAdmin v1.0.
After some problems occuring of all of the users who has it. I decided to convert it back for a while.
About the dialogresponse. It will take alot of time to make them OnDialogResponse. Tune System has alot of dialogids. For the looping. Yes i will try to make it foreach. For the 1.) and 2.) i\'m thinking about it..