Checking the highest
#1

How to detect which variable has the highest value?

pawn Код:
new england, russia, iraq, mexico;
I need to check, which team has the highest value.
Reply
#2

Mexico has the highest value ^.^
Reply
#3

Here's a way to do it, surely it's a better and easyier way but i can't come out with anything else at this moment:

pawn Код:
new england, russia, iraq, mexico;

if(england > russia && iraq && mexico){
SendClientMessageToAll(COLOR_WHITE, "England have taken the lead");//do you thing here
}
else if(russia > england && iraq && mexico){
SendClientMessageToAll(COLOR_WHITE, "Russia have taken the lead");//do you thing here
}
else if(iraq > russia && england && mexico){
SendClientMessageToAll(COLOR_WHITE, "Iraq have taken the lead");//do you thing here
}
else{//this means that mexico is in the lead
SendClientMessageToAll(COLOR_WHITE, "Mexico have taken the lead");//do you thing here
}
Hope it helped
Reply
#4

Yeah.. I could have done that also, just wanted to know if there is a shorter way, but I'll use that then. Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)