CMD:stats(playerid, params[]) { if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /stats [player name]"); new path[35]; format(path, sizeof (path), "users/%s.ini", params); // Change path to whatever your user path is if (!fexist(path)) return SendClientMessage(playerid, -1, "Player is not registered."); new File: file = fopen(path, io_read); if (!file) return SendClientMessage(playerid, -1, "An error occured. Try again."); new string[128], dialogstr[512]; while (fread(file, string)) { string[strlen(string) - 1 EOS]; if (!strcmp(string, "Password = ", true, 11)) continue; /* To skip stuff (I skipped Password) if (!strcmp(string, "STAT_NAME = ", true, LENGTH OF "STAT_NAME = ")) continue; */ strcat(dialogstr, string); strcat(dialogstr, "\n"); } dialogstr[strlen(dialogstr) - 1] = EOS; fclose(file); format(string, sizeof (string), "%s's stats", params); ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, string, dialogstr, "Close", ""); return 1; }
entry = something entry=string
users/userName.ini
users/test.ini
new playerInfo[MAX_PLAYERS + 1];
(26156) : error 001: expected token: "]", but found "-identifier-" (26156) : warning 215: expression has no effect (26156) : error 001: expected token: ";", but found "]" (26156) : error 029: invalid expression, assumed zero (26156) : fatal error 107: too many error messages on one line
string[strlen(string) - 1 EOS]; if (!strcmp(string, "Password = ", true, 11)) continue; |
string[strlen(string) - 1] = EOS;
CMD:getadminlevel(playerid, params[]) { if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /getadminlevel [player name]"); new path[35]; format(path, sizeof (path), "users/%s.ini", params); // Change path to whatever your user path is if (!fexist(path)) return SendClientMessage(playerid, -1, "Player is not registered."); new File: file = fopen(path, io_read); if (!file) return SendClientMessage(playerid, -1, "An error occured. Try again."); new string[64]; while (fread(file, string)) { string[strlen(string) - 1 EOS]; if (!strcmp(string, "Admin = ", true, 8)) { format(string, sizeof (string), "%s's admin level: %i", params, string[8]); SendClientMessage(playerid, -1, string) break; } } fclose(file); return 1; }
Код:
CMD:getadminlevel(playerid, params[]) { if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /getadminlevel [player name]"); new path[35]; format(path, sizeof (path), "users/%s.ini", params); // Change path to whatever your user path is if (!fexist(path)) return SendClientMessage(playerid, -1, "Player is not registered."); new File: file = fopen(path, io_read); if (!file) return SendClientMessage(playerid, -1, "An error occured. Try again."); new string[64]; while (fread(file, string)) { string[strlen(string) - 1 EOS]; if (!strcmp(string, "Admin = ", true, 8)) { format(string, sizeof (string), "%s's admin level: %i", params, string[8]); SendClientMessage(playerid, -1, string) break; } } fclose(file); return 1; } |
format(string, sizeof (string), "%s's admin level: %s", params, string[8]);
Sorry about that. Change the format line to this:
Код:
format(string, sizeof (string), "%s's admin level: %s", params, string[8]); |