05.07.2018, 14:05
Funзгo:
Uso:
Saнda:
Код:
stock FixAdminList(adm_name[], adm_level, bool:adm_online, fixed_string[]) { // formato: // nome do admin (24 char) nнvel x/x on/offline // aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbb ccccccc new len_adm_name = strlen(adm_name); new calc_spaces = MAX_PLAYER_NAME - len_adm_name; fixed_string[0] = '\0'; strcat(fixed_string, adm_name, 43); for(new x = 0; x < calc_spaces; ++ x) strcat(fixed_string, " ", 43); format(fixed_string, 43, "%s Nivel %d/5 %s", fixed_string, adm_level, (adm_online ? ("Online") : ("Offline"))); return 1; }
Код:
new str[43]; // String que receberб a linha fixada FixAdminList("Fulano", 1, true, str); print(str); // Output de teste FixAdminList("Fulano2", 3, false, str); print(str); // Output de teste
Код:
Fulano Nivel 1/5 Online Fulano2 Nivel 3/5 Offline