Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!strcmp(cmd, "/stats", true))
- {
- new tmp[0x100], plid;
- tmp = strtok(cmdtext, idx);
- if(!strcmp(tmp, "?", true) && strlen(tmp))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Ajuda sobre comando \"/stats\":");
- SendClientMessage(playerid, 0xFFFFFFAA, "Use \"/stats\" somente para ver seus stats.");
- SendClientMessage(playerid, 0xFFFFFFAA, "Use \"/stats [playerid]\" ou \"/stats [nome]\" \
- para ver os stats de algu�m conectado ou n�o.");
- return 1;
- }
- plid = strval(tmp);
- if(!strlen(tmp))plid = playerid;
- new pname[0x100];
- if(isnumeric(tmp) && strlen(tmp))
- {
- if(IsPlayerConnected(plid))
- {
- GetPlayerName(plid, pname, sizeof pname);
- format(pname, sizeof pname, "%s.brazilian.championship.cer", pname);
- goto comando_stats;
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "Jogador n�o conectado/nome inv�lido!");
- }
- } else {
- if(playerid == plid)GetPlayerName(playerid, tmp, sizeof tmp);
- format(pname, sizeof pname, "%s.brazilian.championship.cer", tmp);
- comando_stats:
- if(dini_Exists(pname))
- {
- new string[0x100], tempo, msegundos, nome[0x100];
- GetPlayerName(plid, nome, sizeof nome);
- format(string, sizeof string, "Stats de %s", nome);
- SendClientMessage(playerid, 0xFFF000AA, string);
- format(string, sizeof string, "Grana: %d Score: %d Vit�rias DM1: %d 1� lugar RACE1: %d \
- lugar RACE2: %d", dini_Int(pname, "grana"), dini_Int(pname, "score"),
- dini_Int(pname, "dm1wins"), dini_Int(pname, "race1wins"), dini_Int(pname, "race2wins"));
- SendClientMessage(playerid, 0xFFFFFFAA, string);
- tempo = dini_Int(pname, "race1bestscore");
- minutos = floatround(floatdiv(tempo, 60000), floatround_tozero);
- segundos = floatround(floatmul(floatdiv(tempo, 60000) - minutos, 60), floatround_tozero);
- msegundos = floatround(floatmul(floatmul(floatdiv(tempo,
- 60000) - minutos, 60) - segundos, 1000), floatround_tozero);
- gindex = 0;
- while (segundos > 9)
- {
- segundos -= 0xA;
- gindex++;
- }
- new msec[0xA];
- if(msegundos < 10)format(msec, sizeof msec, "000%d", msegundos);
- if(msegundos > 9 && msegundos < 100)format(msec, sizeof msec, "00%d", msegundos);
- if(msegundos > 99 && msegundos < 1000)format(msec, sizeof msec, "0%d", msegundos);
- if(msegundos == 1000)format(msec, sizeof msec, "%d", msegundos);
- format(string, sizeof string, "Melhor tempo na RACE1: %d:%d%d:%s",
- minutos, gindex, segundos, msec);
- SendClientMessage(playerid, 0xFFFFFFAA, string);
- tempo = dini_Int(pname, "race2bestscore");
- minutos = floatround(floatdiv(tempo, 60000), floatround_tozero);
- segundos = floatround(floatmul(floatdiv(tempo, 60000) - minutos, 60), floatround_tozero);
- msegundos = floatround(floatmul(floatmul(floatdiv(tempo,
- 60000) - minutos, 60) - segundos, 1000), floatround_tozero);
- gindex = 0;
- while (segundos > 9)
- {
- segundos -= 0xA;
- gindex++;
- }
- if(msegundos < 10)format(msec, sizeof msec, "000%d", msegundos);
- if(msegundos > 9 && msegundos < 100)format(msec, sizeof msec, "00%d", msegundos);
- if(msegundos > 99 && msegundos < 1000)format(msec, sizeof msec, "0%d", msegundos);
- if(msegundos == 1000)format(msec, sizeof msec, "%d", msegundos);
- format(string, sizeof string, "Melhor tempo na RACE2: %d:%d%d:%s",
- minutos, gindex, segundos, msec);
- SendClientMessage(playerid, 0xFFFFFFAA, string);
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "Nome inv�lido!");
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment