Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock checktop5(playerid)
- {
- new pkill = Data[playerid][kills];
- new plnejm[MAX_PLAYER_NAME];
- GetPlayerNameEx(playerid, plnejm, MAX_PLAYER_NAME);
- if(pkill > topKills[1][tfKills]) // his kills are higher than kills on nr. 1
- {
- if(!strcmp(plnejm, topKills[1][tfName])) // if he's nr. 1 just update kills
- {
- topKills[1][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[2][tfName])) // if he's nr. 2
- {
- // assign temp variables
- new temp1name[MAX_PLAYER_NAME], temp1kills;
- strmid(temp1name, topKills[1][tfName], 0, strlen(topKills[1][tfName]), 255);
- temp1kills = topKills[1][tfKills];
- // put his info in nr. 1
- strmid(topKills[1][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[1][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[2][tfName], temp1name, 0, strlen(temp1name), 255);
- topKills[2][tfKills] = temp1kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[3][tfName])) // if he's nr. 3
- {
- //asign temp variables for nr. 1 and nr. 2 because he jumped from 3rd to 1st place
- new temp1name[MAX_PLAYER_NAME], temp1kills;
- strmid(temp1name, topKills[1][tfName], 0, strlen(topKills[1][tfName]), 255);
- temp1kills = topKills[1][tfKills];
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- // put players info in nr. 1
- strmid(topKills[1][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[1][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[2][tfName], temp1name, 0, strlen(temp1name), 255); // put guy that was 1st to 2nd place
- topKills[2][tfKills] = temp1kills;
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[4][tfName])) // if he's nr. 4
- {
- //asign temp variables for nr. 1 and nr. 2 and nr. 3 because he jumped from 4th to 1st place
- new temp1name[MAX_PLAYER_NAME], temp1kills;
- strmid(temp1name, topKills[1][tfName], 0, strlen(topKills[1][tfName]), 255);
- temp1kills = topKills[1][tfKills];
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- // put players info in nr. 1
- strmid(topKills[1][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[1][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[2][tfName], temp1name, 0, strlen(temp1name), 255); // put guy that was 1st to 2nd place
- topKills[2][tfKills] = temp1kills;
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[5][tfName])) // if he's nr. 5
- {
- //asign temp variables for nr. 1 and nr. 2 and nr. 3 and nr. 4 because he jumped from 5th to 1st place
- new temp1name[MAX_PLAYER_NAME], temp1kills;
- strmid(temp1name, topKills[1][tfName], 0, strlen(topKills[1][tfName]), 255);
- temp1kills = topKills[1][tfKills];
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 1
- strmid(topKills[1][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[1][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[2][tfName], temp1name, 0, strlen(temp1name), 255); // put guy that was 1st to 2nd place
- topKills[2][tfKills] = temp1kills;
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- else // he wasn't on top 5 highscore list so place him 1st and move everyone else a spot below (ultimately guy that was 5th will fall of the list)
- {
- //asign temp variables for nr. 1 and nr. 2 and nr. 3 and nr. 4 because he jumped to 1st place out of nowhere (probably set kills)
- new temp1name[MAX_PLAYER_NAME], temp1kills;
- strmid(temp1name, topKills[1][tfName], 0, strlen(topKills[1][tfName]), 255);
- temp1kills = topKills[1][tfKills];
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 1
- strmid(topKills[1][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[1][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[2][tfName], temp1name, 0, strlen(temp1name), 255); // put guy that was 1st to 2nd place
- topKills[2][tfKills] = temp1kills;
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- }
- // kills aren't higher than 1st place so check others
- else if(pkill > topKills[2][tfKills]) // his kills are higher than kills on nr. 2
- {
- if(!strcmp(plnejm, topKills[1][tfName])) return 1; // if he's nr. 1 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[2][tfName])) // if he's nr. 2 just update kills
- {
- topKills[2][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[3][tfName])) // if he's nr. 3
- {
- //asign temp variables for nr. 2
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- // put players info in nr. 2
- strmid(topKills[2][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[2][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[4][tfName])) // if he's nr. 4
- {
- //asign temp variables for nr. 2 and nr. 3 because he jumped from 4th to 2nd place
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- // put players info in nr. 2
- strmid(topKills[2][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[2][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[5][tfName])) // if he's nr. 5
- {
- //asign temp variables for nr. 2 and nr. 3 and nr. 4 because he jumped from 5th to 2nd place
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 2
- strmid(topKills[2][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[2][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- else // he wasn't on top 5 highscore list so place him 2nd and move everyone else a spot below (ultimately guy that was 5th will fall of the list)
- {
- //asign temp variables for nr. 2 and nr. 3 and nr. 4 because he jumped to 2nd place out of nowhere (probably set kills)
- new temp2name[MAX_PLAYER_NAME], temp2kills;
- strmid(temp2name, topKills[2][tfName], 0, strlen(topKills[2][tfName]), 255);
- temp2kills = topKills[2][tfKills];
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 2
- strmid(topKills[2][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[2][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[3][tfName], temp2name, 0, strlen(temp2name), 255); // put guy that was 2nd to 3rd place
- topKills[3][tfKills] = temp2kills;
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- }
- // kills aren't higher than 2nd place either so check others
- else if(pkill > topKills[3][tfKills]) // his kills are higher than kills on nr. 3
- {
- if(!strcmp(plnejm, topKills[1][tfName])) return 1; // if he's nr. 1 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[2][tfName])) return 1; // if he's nr. 2 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[3][tfName])) // if he's nr. 3 just update kills
- {
- topKills[3][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[4][tfName])) // if he's nr. 4
- {
- //asign temp variables for nr. 3 because he jumped from 4th to 3rd place
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- // put players info in nr. 3
- strmid(topKills[3][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[3][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[5][tfName])) // if he's nr. 5
- {
- //asign temp variables for nr. 3 and nr. 4 because he jumped from 5th to 3rd place
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 3
- strmid(topKills[3][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[3][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- else // he wasn't on top 5 highscore list so place him 3rd and move everyone else a spot below (ultimately guy that was 5th will fall of the list)
- {
- //asign temp variables for nr. 3 and nr. 4 because he jumped to 3rd place out of nowhere (probably set kills)
- new temp3name[MAX_PLAYER_NAME], temp3kills;
- strmid(temp3name, topKills[3][tfName], 0, strlen(topKills[3][tfName]), 255);
- temp3kills = topKills[3][tfKills];
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 3
- strmid(topKills[3][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[3][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[4][tfName], temp3name, 0, strlen(temp3name), 255); // put guy that was 3rd to 4th place
- topKills[4][tfKills] = temp3kills;
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- }
- // kills aren't higher than 3rd place either so check others
- else if(pkill > topKills[4][tfKills]) // his kills are higher than kills on nr. 4
- {
- if(!strcmp(plnejm, topKills[1][tfName])) return 1; // if he's nr. 1 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[2][tfName])) return 1; // if he's nr. 2 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[3][tfName])) return 1; // if he's nr. 3 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[4][tfName])) // if he's nr. 4 just update kills
- {
- topKills[4][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- if(!strcmp(plnejm, topKills[5][tfName])) // if he's nr. 5
- {
- //asign temp variables for nr. 4 because he jumped from 5th to 4th place
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 4
- strmid(topKills[4][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[4][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- else // he wasn't on top 5 highscore list so place him 4th and move everyone else a spot below (ultimately guy that was 5th will fall of the list)
- {
- //asign temp variables for nr. 4 because he jumped to 4th place out of nowhere (probably set kills)
- new temp4name[MAX_PLAYER_NAME], temp4kills;
- strmid(temp4name, topKills[4][tfName], 0, strlen(topKills[4][tfName]), 255);
- temp4kills = topKills[4][tfKills];
- // put players info in nr. 4
- strmid(topKills[4][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[4][tfKills] = pkill;
- // now swap their positions
- strmid(topKills[5][tfName], temp4name, 0, strlen(temp4name), 255); // put guy that was 4th to 5th place
- topKills[5][tfKills] = temp4kills;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- }
- // kills aren't higher than 4th place either so check 5th
- else if(pkill > topKills[5][tfKills]) // his kills are higher than kills on nr. 5
- {
- if(!strcmp(plnejm, topKills[1][tfName])) return 1; // if he's nr. 1 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[2][tfName])) return 1; // if he's nr. 2 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[3][tfName])) return 1; // if he's nr. 3 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[4][tfName])) return 1; // if he's nr. 4 dont proceed (shouldn't happen but hey)
- if(!strcmp(plnejm, topKills[5][tfName])) // if he's nr. 5 just update kills
- {
- topKills[5][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- else // he wasn't on top 5 highscore list so place him 5th and just delete guy that was 5th
- {
- // put players info in nr. 5
- strmid(topKills[5][tfName], plnejm, 0, strlen(plnejm), 255);
- topKills[5][tfKills] = pkill;
- SaveTopFive(); // save changes
- UpdateTopFiveLabel();
- return 1; // stop further checks
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement