Senior Member
Join Date: Mar 2014
Location: nope.avi
|
12-17-2016
, 12:47
SortCustom1D with new decl
|
#1
|
Hello im getting always prototype not mach the function when i try to convert this code
Spoiler
DrawScoresheet()
{
new clients[GetMaxClients()+1];
for (new i; i <=MaxClients; i++)
{
clients[i] = i;
}
SortCustom1D(clients, GetMaxClients(), ScoreGreaterThan);
new String:cName[256];
new String:Lines[10][256];
new String:Sheet[512];
new count = -0;
for (new i=GetMaxClients(); i>-0; i--)
{
if (count >= 10)
{
break;
}
if (IsValidClient(clients[i]) && !IsClientObserver(clients[i]))
{
GetClientName(clients[i], cName, sizeof(cName));
Format(Lines[count], 256, "%2d - %s", g_Points[clients[i]], cName);
count++;
}
}
ImplodeStrings(Lines, 10, "\n", Sheet, 512);
SetHudTextParams(0.01, 0.01, 8.0, 0, 255, 0, 0);
for (new i; i <=MaxClients; i++)
{
if (IsValidClient(i))
{
ShowHudText(i, -1, Sheet);
}
}
}
public ScoreGreaterThan(left, right, clientids[], Handle:data)
{
if (g_Points[left] <= g_Points[right])
{
return -1;
}
if (g_Points[left] == g_Points[right])
{
return 0;
}
return 1;
}
new code ( where i get the error)
Spoiler
int DrawScoresheet()
{
int[] clients = new int[MaxClients+1];
for (int i; i <=MaxClients; i++)
{
clients[i] = i;
}
SortCustom1D(clients, MaxClients, ScoreGreaterThan);
char cName[256];
char Lines[10][256];
char Sheet[512];
int count = -0;
for (int i=MaxClients; i>-0; i--)
{
if (count >= 10)
{
break;
}
if (IsValidClient(clients[i]) && !IsClientObserver(clients[i]))
{
GetClientName(clients[i], cName, sizeof(cName));
Format(Lines[count], 256, "%2d - %s", g_Points[clients[i]], cName);
count++;
}
}
ImplodeStrings(Lines, 10, "\n", Sheet, 512);
SetHudTextParams(0.01, 0.01, 8.0, 0, 255, 0, 0);
for (int i; i <=MaxClients; i++)
{
if (IsValidClient(i))
{
ShowHudText(i, -1, Sheet);
}
}
}
public int ScoreGreaterThan(int left, int right, const int clientids, Handle data)
{
if (g_Points[left] <= g_Points[right])
{
return -1;
}
if (g_Points[left] == g_Points[right])
{
return 0;
}
return 1;
}
this is where the error come out SortCustom1D(clients, MaxClients, ScoreGreaterThan);
if someone can help me it will be appreciated ty
__________________
Last edited by TonyBaretta; 12-17-2016 at 13:46.
|
|