19.10.2018, 18:47
I am making a Gang system where after the Gang Turf Attack ends, the Defender's and Attacker's both of them kills are shown in a dialog. but they are unsorted.
p1 11
p2 15
p3 9
p4 20
However i want it to look something like this
p4 20
p2 15
p1 11
p3 9
So here is what i made
Now question is, isnt it laggy if it has to loop through above than 200 players? Any Remedy would be appreciated.
Please correct me if i am wrong in this script.
p1 11
p2 15
p3 9
p4 20
However i want it to look something like this
p4 20
p2 15
p1 11
p3 9
So here is what i made
PHP код:
new count = 0;
foreach(new i : Player)
{
if(Player[i][pGroup] == gattacker || Player[i][pGroup] == gattacked)
count++;
}
new killerids[count];
for(new x = 0; x < count; x++)
{
foreach(new i : Player)
{
if(Player[i][pGroup] == gattacker || Player[i][pGroup] == gattacked)
{
new kill_ = -1;
if(Player[i][Kills] > kill_)
{
for(new y = 0; y < count; y++)
{
if(killerids[y] != i)
{
killerids[x] = i;
format(str, sizeof (str), "%s\n%d\t%s\t%d", str, Player[i][pID], Player[i][Name], Player[i][Kills]);
}
}
}
}
}
}
Please correct me if i am wrong in this script.