public OnPlayerSpawn(playerid) // you can also do onplayerconnect... { new first, second, third, fourth, fifth; //make a loop for(new i=0;i<MAX_PLAYERS;i++) // This loop will check for the player that has the most kills { if(kills[i] > kills[first]) { first = i; TextDrawSetString(Textdraw19, kills[first]); } } for(new d=0;d<MAX_PLAYERS;d++) // This loop will check for the player that has the second most kills { if(first == d) continue; if(kills[d] > kills[second]) { second = d; TextDrawSetString(Textdraw20, kills[second]); } } for(new s=0;s<MAX_PLAYERS;s++) // This loop will check for the player that has the third most kills { if(first == s || second == s) continue; if(kills[s] > kills[third]) { third = s; TextDrawSetString(Textdraw21, kills[third]); } } for(new a=0;a<MAX_PLAYERS;a++) // This loop will check for the player that has the fourth most kills { if(first == a || second == a || third == a) continue; if(kills[a] > kills[fourth]) { fourth = a; TextDrawSetString(Textdraw22, kills[fourth]); } } for(new c=0;c<MAX_PLAYERS;c++) // This loop will check for the player that has the fifth most kills { if(first == c || second == c || third == c || fourth == c) continue; if(kills[c] > kills[fifth]) { fifth = c; TextDrawSetString(Textdraw23, kills[fifth]); } }
new Name[5][MAX_PLAYER_NAME], string[5][64]; GetPlayerName(first, Name[0], MAX_PLAYER_NAME); GetPlayerName(second, Name[1], MAX_PLAYER_NAME); GetPlayerName(third, Name[2], MAX_PLAYER_NAME); GetPlayerName(fourth, Name[3], MAX_PLAYER_NAME); GetPlayerName(fifth, Name[4], MAX_PLAYER_NAME); format(string[0], sizeof(string[0]), "~R~#1 - ~W~%s", Name[0],); format(string[1], sizeof(string[1]), "~R~#2 - ~W~%s", Name[1],); format(string[2], sizeof(string[2]), "~R~#3 - ~W~%s", Name[2],); format(string[3], sizeof(string[3]), "~R~#4 - ~W~%s", Name[3],); format(string[4], sizeof(string[4]), "~R~#5 - ~W~%s", Name[4],); TextDrawSetString(Textdraw19, string[0]); TextDrawSetString(Textdraw20, string[1]); TextDrawSetString(Textdraw21, string[2]); TextDrawSetString(Textdraw22, string[3]); TextDrawSetString(Textdraw23, string[4]); TextDrawShowForPlayer(playerid, Textdraw19); TextDrawShowForPlayer(playerid, Textdraw20); TextDrawShowForPlayer(playerid, Textdraw21); TextDrawShowForPlayer(playerid, Textdraw22); TextDrawShowForPlayer(playerid, Textdraw23); SetTimerEx("TextdrawHide", 5000, false, "uiiiii", playerid, Textdraw19, Textdraw20, Textdraw21, Textdraw22, Textdraw23); //A timer which will hide the textdraw, it\'s set to 5 seconds and you can change that if you want to... //Now put this under the new kills... forward TextdrawHide(playerid, textdraw1, textdraw2, textdraw3, textdraw4, textdraw5); //And put this down where other public functions are... public TextdrawHide(playerid, textdraw1, textdraw2, textdraw3, textdraw4, textdraw5) { TextDrawHideForPlayer(playerid, textdraw1); TextDrawHideForPlayer(playerid, textdraw2); TextDrawHideForPlayer(playerid, textdraw3); TextDrawHideForPlayer(playerid, textdraw4); TextDrawHideForPlayer(playerid, textdraw5); return 1; }
new Name[5][MAX_PLAYER_NAME], string[5][64]; GetPlayerName(first, Name[0], MAX_PLAYER_NAME); GetPlayerName(second, Name[1], MAX_PLAYER_NAME); GetPlayerName(third, Name[2], MAX_PLAYER_NAME); GetPlayerName(fourth, Name[3], MAX_PLAYER_NAME); GetPlayerName(fifth, Name[4], MAX_PLAYER_NAME); format(string[0], sizeof(string[0]), "~R~#1 - ~W~%s", Name[0],); format(string[1], sizeof(string[1]), "~R~#2 - ~W~%s", Name[1],); format(string[2], sizeof(string[2]), "~R~#3 - ~W~%s", Name[2],); format(string[3], sizeof(string[3]), "~R~#4 - ~W~%s", Name[3],); format(string[4], sizeof(string[4]), "~R~#5 - ~W~%s", Name[4],); TextDrawSetString(Textdraw19, string[0]); TextDrawSetString(Textdraw20, string[1]); TextDrawSetString(Textdraw21, string[2]); TextDrawSetString(Textdraw22, string[3]); TextDrawSetString(Textdraw23, string[4]); TextDrawShowForPlayer(playerid, Textdraw19); TextDrawShowForPlayer(playerid, Textdraw20); TextDrawShowForPlayer(playerid, Textdraw21); TextDrawShowForPlayer(playerid, Textdraw22); TextDrawShowForPlayer(playerid, Textdraw23);
if(kills[i] > kills[first]) { GetPlayerName(first, Name[0], MAX_PLAYER_NAME); format(string[0], sizeof(string[0]), "~R~#1 - ~W~%s", Name[0],); TextDrawSetString(Textdraw19, string[0]); TextDrawShowForPlayer(playerid, Textdraw19); first = i; } }
C:\Users\---\Desktop\MoG\gamemodes\Warehouse.pwn(585) : error 001: expected token: "]", but found "-integer value-" C:\Users\---\Desktop\MoG\gamemodes\Warehouse.pwn(585) : warning 215: expression has no effect C:\Users\---\Desktop\MoG\gamemodes\Warehouse.pwn(585) : error 001: expected token: ";", but found "]" C:\Users\---\Desktop\MoG\gamemodes\Warehouse.pwn(585) : error 029: invalid expression, assumed zero C:\Users\---\Desktop\MoG\gamemodes\Warehouse.pwn(585) : fatal error 107: too many error messages on one line
Store the players\' score in an array, use a sorting algorithm (http://forum.sa-mp.com/showpost.php?...postcount=1737) then take the last 5 values.
An example is provided beyond the provided link. If you have any questions or need help, then I can\'t help you. Bye. |
I\'m just going to quote this here since you ignored me, it\'s the most viable way.
|
Dude.. you have to follow the code.. and i dont know how to learn about quickSort..
|