14.08.2013, 17:41
Heya all,
ive created this little command for show me the server records but thats bugged with id 0 i guess and sometimes nobody got that value so its 0 and then is name not showing. I hope you have some adive how to short this code and fix that bugs
Thanks
ive created this little command for show me the server records but thats bugged with id 0 i guess and sometimes nobody got that value so its 0 and then is name not showing. I hope you have some adive how to short this code and fix that bugs
Thanks
Код:
CMD:records(playerid,params[]) { new maxkills = 0,id[7],maxrobs = 0,math = 0,ccash = 0,duel = 0,r_string[750],topweed = 0,rep = 0; for(new i;i<MAX_PLAYERS;i++) { if(pInfo[i][Kills] > maxkills) { maxkills = pInfo[i][Kills]; id[0] = i; } } for(new b;b<MAX_PLAYERS;b++) { if(pInfo[b][Robbed] > maxrobs) { maxrobs = pInfo[b][Robbed]; id[1] = b; } } for(new a;a<MAX_PLAYERS;a++) { if(ZjistitHraciPenize(a) > ccash) { ccash = ZjistitHraciPenize(a); id[2] = a; } } for(new c;c<MAX_PLAYERS;c++) { if(pInfo[c][mWons] > math) { math = pInfo[c][mWons]; id[3] = c; } } for(new u;u<MAX_PLAYERS;u++) { if(pInfo[u][DuelWons] > duel) { duel = pInfo[u][DuelWons]; id[4] = u; } } for(new n;n<MAX_PLAYERS;n++) { if(wInfo[n][Weed] > topweed) { topweed = wInfo[n][Weed]; id[5] = n; } } for(new p;p<MAX_PLAYERS;p++) { if(pInfo[p][Reputation] > rep) { rep = pInfo[p][Reputation]; id[6] = p; } } strcat(r_string, "{00A7FF}Top killer: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top robberies: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top math wons: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top money: "W"%s {00A7FF}- "W"%d$\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top duels wons: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top weed: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); strcat(r_string, "{00A7FF}Top reputation: "W"%s {00A7FF}- "W"%d\n", sizeof(r_string)); format(r_string, sizeof(r_string), r_string, PlayerName(id[0]),pInfo[id[0]][Kills], PlayerName(id[1]),pInfo[id[1]][Robbed], PlayerName(id[3]),pInfo[id[3]][mWons], PlayerName(id[2]),ZjistitHraciPenize(id[2]), PlayerName(id[4]),pInfo[id[4]][DuelWons], PlayerName(id[5]),wInfo[id[5]][Weed], PlayerName(id[6]),pInfo[id[6]][Reputation]); SPD(playerid,D_REC,0,"Server records",r_string,"Close",""); return 1; }