11.07.2014, 11:01
Why This Command Only Show Gangs That Have Been Recently Created Not The Top Gangs (It Is From DGang System Can Be Found Here):
Codes:
Please Help Me.
Codes:
pawn Код:
COMMAND:topgangs(playerid,params[])
{
new string[1000], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1,Slot5 = -1;
new Kills = -9999;
for(new x=0; x<2000; x++)
if(GangDat[x][FileExists] == true)
if(GangDat[x][GangKills] >= Kills)
{
Kills = dini_Int(gFileId(x),"Kills");
Slot1 = x;
}
Kills = -9999;
for(new x=0; x<2000; x++)
if(GangDat[x][FileExists] == true && x != Slot1)
if(GangDat[x][GangKills] >= Kills)
{
Kills = dini_Int(gFileId(x),"Kills");
Slot2 = x;
}
Kills = -9999;
for(new x=0; x<2000; x++)
if(GangDat[x][FileExists] == true && x != Slot1 && x != Slot2)
if(GangDat[x][GangKills] >= Kills)
{
Kills = dini_Int(gFileId(x),"Kills");
Slot3 = x;
}
Kills = -9999;
for(new x=0; x<2000; x++)
if(GangDat[x][FileExists] == true && x != Slot1 && x != Slot2 && x != Slot3)
if(GangDat[x][GangKills] >= Kills)
{
Kills = dini_Int(gFileId(x),"Kills");
Slot4 = x;
}
Kills = -9999;
for(new x=0; x<2000; x++)
if(GangDat[x][FileExists] == true && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4)
if(GangDat[x][GangKills] >= Kills)
{
Kills = dini_Int(gFileId(x),"Kills");
Slot5 = x;
}
if(Slot1 != -1)
{
format(string, sizeof(string), "{FFFFFF}\t|_%s Top 5 Gangs_|\n{FF0000}1st. Gang %s[GangID %d] Kills: %d , Deaths: %d",SERVER_NAME,dini_Get(gFileId(Slot1),"GangName"),Slot1,dini_Int(gFileId(Slot1),"Kills"),dini_Int(gFileId(Slot1),"Deaths"));
}
if(Slot2 != -1)
{
format(string, sizeof(string), "%s\n{EE0000}2nd. Gang %s[GangID %d] Kills: %d , Deaths: %d",string,dini_Get(gFileId(Slot2),"GangName"),Slot2,dini_Int(gFileId(Slot2),"Kills"),dini_Int(gFileId(Slot2),"Deaths"));
}
if(Slot3 != -1)
{
format(string, sizeof(string), "%s\n{FF4848}3rd. Gang %s[GangID %d] Kills: %d , Deaths: %d",string,dini_Get(gFileId(Slot3),"GangName"),Slot3,dini_Int(gFileId(Slot3),"Kills"),dini_Int(gFileId(Slot3),"Deaths"));
}
if(Slot4 != -1)
{
format(string, sizeof(string), "%s\n{8080FF}4th. Gang %s[GangID %d] Kills: %d , Deaths: %d",string,dini_Get(gFileId(Slot4),"GangName"),Slot4,dini_Int(gFileId(Slot4),"Kills"),dini_Int(gFileId(Slot4),"Deaths"));
}
if(Slot5 != -1)
{
format(string, sizeof(string), "%s\n{F0EEBB}5th. Gang %s[GangID %d] Kills: %d , Deaths: %d",string,dini_Get(gFileId(Slot5),"GangName"),Slot5,dini_Int(gFileId(Slot5),"Kills"),dini_Int(gFileId(Slot5),"Deaths"));
}
ShowPlayerDialog(playerid,DIALOG,DIALOG_STYLE_MSGBOX,"Top 10 Gangs",string,"Ok","");
if(Slot1 == -1) ShowPlayerDialog(playerid,DIALOG+1,DIALOG_STYLE_MSGBOX,"Top 10 Gangs","\n{FFFFFF}Server\n{FF0000}No Top Gangs Yet!\n\n","Ok","");
return 1;
}