Originally Posted by SickAttack
It seems like a good gamemode to start off with, but if you're willing to improve it, you could: - Change loops that use MAX_PLAYERS for loops that use GetPlayerPoolSize.
- Save the player's name in a variable, and use it instead of retrieving the player's name with the native function over and over again.
pawn Код:
if(sscanf(params, "s[250]", string))
Input is restricted to 128 characters. 250?
pawn Код:
new string2[250]; format(string2, sizeof(string2), "{D526D9}[WHISPER] {FFFFFF}%s(%i): %s", name, playerid, string);
Output is restricted to 144. 250?
- Use booleans instead of just using 0 and 1 on integers.
pawn Код:
format(string, sizeof(string), "{F5F111}Level 1 Donor [$5.00 USD]\n\n", string); format(string, sizeof(string), "%s{FFFFFF}- Receive 500,000 in-game cash.\n", string); format(string, sizeof(string), "%s{FFFFFF}- Get a custom VIP tag.\n", string);
That is a very slow method, it appends the string previously appended and formats the "new" string. Use format + strcat, it's much faster (tests have been made).
pawn Код:
if(playerid == id) return SendClientMessage(playerid, COLOR_WHITE, "{FC3003}[ERROR]{FFFFFF} You can't send a PM to yourself!"); { GetPlayerName(playerid, Name1, sizeof(Name1)); GetPlayerName(id, Name2, sizeof(Name2)); format(str, sizeof(str), "{FC9D03}[PM]{FFFFFF} to {FC9D03}%s(%d){FFFFFF}: %s", Name2, id, str2); SendClientMessage(playerid, COLOR_WHITE, str); format(str, sizeof(str), "{FC9D03}[PM]{FFFFFF} from {FC9D03}%s(%d){FFFFFF}: %s", Name1, playerid, str2); SendClientMessage(id, COLOR_WHITE, str); }
What's up with those curly braces?
-
You're using variables with a lot of cells for outputs restricted to 144 characters, consider reducing the amount of cells used to 144. Note that to format "Hello %s!" and store it in a 144 cell variable isn't the same as storing it into a 400 cell variable. It takes longer on the 400 cell variable (tests have been made).
- It isn't necessary to add a bunch of returns everywhere on OnDialogResponse.
I could probably go on and on, but I guess that's enough for the moment.
Good job, and if you would like to improve this gamemode a bit, but not in obligation, you can take in note my observations and possible improvements.
Good job, though! +6 rep
|