• Need help with a SourceMod thing (C++)
    4 replies, posted
Well I'm trying to create a ranking system for my css server where whoever has the largest amount of time on the server has the highest rank of 1. So far I have made it so it combines your hours and minutes on the server to pop out a rank. This works fine, if you want the highest number to be the best (which I don't) [CODE] public Action:Command_getRank(client, args) { Rank[client] = Hours[client] + Minutes[client]; PrintToChat(client, "\x05You are rank \x03%d\x05!", Rank[client]); return Plugin_Handled; } [/CODE] So anyway I don't know if somewhere theres a magical function, or more likely an equation, to make is so when the combination of Minutes and Hours goes up, Rank goes down until it reaches 1.
this isn't c++
Do you want ranks to be unique (i.e only one player can be rank #1), or do you just want them to reach #1 the longer they play regardless of other players?
[QUOTE=dajoh;40046094]this isn't c++[/QUOTE] Its SourcePawn I didn't look into it and sorta just said C++ because it had similar operators [SUP][SUB]Don't judge me[/SUB][/SUP] [QUOTE=Chris220;40046095]Do you want ranks to be unique (i.e only one player can be rank #1), or do you just want them to reach #1 the longer they play regardless of other players? [/QUOTE] Unique, so its like a battle for number 1
In that case, you're probably going to want to make a list of all players in the system and sort them based on times. There are plenty of sorting algorithms you can use for this purpose, google around a bit to find them.
Sorry, you need to Log In to post a reply to this thread.