forked from UNLOZE/sm-plugins
updated the avghour message again to display percentage for rtv correctly
This commit is contained in:
@@ -177,6 +177,45 @@ public void OnPlayerChangedTeam(Handle event, const char[] name, bool dontBroadc
|
||||
UpdateRTV();
|
||||
}
|
||||
|
||||
public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max)
|
||||
{
|
||||
CreateNative("GetRtvPercentage", Native_GetRtvPercentageForClient);
|
||||
return APLRes_Success;
|
||||
}
|
||||
|
||||
public int Native_GetRtvPercentageForClient(Handle plugin, int numParams)
|
||||
{
|
||||
int client = GetNativeCell(1);
|
||||
|
||||
if(client > MaxClients || client <= 0)
|
||||
{
|
||||
ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!IsClientInGame(client))
|
||||
{
|
||||
ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
UpdateRTV();
|
||||
int clients_percentage = 0;
|
||||
if (g_VotesNeeded == 0)
|
||||
{
|
||||
clients_percentage = RoundToFloor((GetPlayerWorthRTV_(client) / float(100)) * 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
clients_percentage = RoundToFloor((GetPlayerWorthRTV_(client) / float(g_VotesNeeded)) * 100);
|
||||
}
|
||||
if (clients_percentage > 100)
|
||||
{
|
||||
clients_percentage = 100;
|
||||
}
|
||||
return clients_percentage;
|
||||
}
|
||||
|
||||
void UpdateRTV()
|
||||
{
|
||||
int iVotersSteam = 0;
|
||||
|
||||
Reference in New Issue
Block a user