ID:166533
 
How to select player in world which has highest level? Using some simple code...
You can search by looping through all the players in the world, and keep checking who has the highest level.

proc/highest_leveled_player()
var/mob/player/highest
for(var/mob/player/P in world)
if(!highest || P.level > highest.level)
highest = P
return highest


mob/verb
see_highest_leveled_player()
var/mob/player/highest = highest_leveled_player()
src << "The highest leveled player is [highest]"


~~> Unknown Person
In response to Unknown Person
Thanks!

Will it work if I need to check highest level in list?
In response to Ripiz
'Course, instead of world check the list.