PDA

View Full Version : wrong score


StR_MaRy
09/02/2017, 06:31 PM
hey guys i have a war sistem it works fine but in panel or DB it's showing at the end of war score: 43244235 - 5245245 not the right score

picture with DB structure: http://imgur.com/a/VRuXp
picture with panel: http://imgur.com/a/3v7Cx

timer StopWar1[WarSec*WarTime[0]](zone)
{
GangZoneStopFlashForAll(Zone[zone]);
new WarWinners;
if(ScoreAtt > ScoreDef)
{
format(gString, sizeof(gString), "{a092dd}(War) %s a castigat teritoriul cu numarul %d, Scor: %s %.1f - %.1f %s",FactionName[Attackers],zone,FactionName[Attackers],ScoreAtt, ScoreDef ,FactionName[Defenders]);
SendClientMessageToAll(COLOR_WHITE, gString);

ZoneInfo[zone][zTeam] = Attackers;
zUpdate(zone,zTeamx);

ZoneInfo[zone][zHours] = 12;
zUpdate(zone, zHoursx);

GangZoneHideForAll(Zone[zone]);
GangZoneShowForAllEx(Zone[zone],GetZoneColor(ZoneInfo[zone][zTeam]));

SafeInfo[Attackers][sMoney] += 25000;
sUpdate(Attackers, sMoneyx);
SafeInfo[Attackers][sMaterials] += 5000;
sUpdate(Attackers, sMaterialsx);
SafeInfo[Attackers][sDrugs] +=2000;
sUpdate(Attackers, sDrugsx);

WarWinners = Attackers;
}
else
{
format(gString, sizeof(gString), "{a092dd}(War) %s a castigat teritoriul cu numarul %d, Scor: %s %.1f - %.1f %s",FactionName[Defenders],zone,FactionName[Defenders], ScoreDef, ScoreAtt, FactionName[Attackers]);
SendClientMessageToAll(COLOR_WHITE, gString);

ZoneInfo[zone][zTeam] = Defenders;
zUpdate(zone,zTeamx);

ZoneInfo[zone][zHours] = 12;
zUpdate(zone, zHoursx);

GangZoneHideForAll(Zone[zone]);
GangZoneShowForAllEx(Zone[zone],GetZoneColor(ZoneInfo[zone][zTeam]));

SafeInfo[Defenders][sMoney] += 25000;
sUpdate(Defenders, sMoneyx);
SafeInfo[Defenders][sMaterials] += 5000;
sUpdate(Defenders, sMaterialsx);
SafeInfo[Defenders][sDrugs] += 2000;
sUpdate(Defenders, sDrugsx);
WarWinners = Defenders;
}

new Best = 0;
new Worst = 0;

new BestMember[24] = "-";
new WorstMember[24] = "-";

foreach(new i : Player)
{
if(IsInWar1(i))
{
if(PlayerInfo[i][pPersonalKills] - PlayerInfo[i][pPersonalDeaths] > Best)
{
GetPlayerName(i, BestMember, sizeof(BestMember));
Best = PlayerInfo[i][pPersonalKills] - PlayerInfo[i][pPersonalDeaths];

new faction = PlayerInfo[i][pMember] + PlayerInfo[i][pLeader];
format(gString, sizeof(gString), "Cel mai sangeros gangster (%d ucideri / %d decese), scor: %d", PlayerInfo[i][pPersonalKills], PlayerInfo[i][pPersonalDeaths], Best);
GiveFactionPoint(i, faction, gString);
}
else if(PlayerInfo[i][pPersonalKills] - PlayerInfo[i][pPersonalDeaths] < Worst)
{
GetPlayerName(i, WorstMember, sizeof(WorstMember));
Worst = PlayerInfo[i][pPersonalKills] - PlayerInfo[i][pPersonalDeaths];
}
}
}

format(gString, sizeof(gString), "{a092dd}(War) The bloodiest gangster: %s (Scor: %d), Most peaceful gangster: %s (Scor: %d)",BestMember,Best,WorstMember,Worst);
SendClientMessageToAll(COLOR_WHITE, gString);

gQuery[0] = (EOS);
mysql_format(handle, gQuery, sizeof(gQuery), "UPDATE `players` SET `PersonalKills` = '0', `PersonalDeaths` = '0' WHERE `Member` + `Leader` = %d", Attackers);
mysql_tquery(handle, gQuery, "", "");

gQuery[0] = (EOS);
mysql_format(handle, gQuery, sizeof(gQuery), "UPDATE `players` SET `PersonalKills` = '0', `PersonalDeaths` = '0' WHERE `Member` + `Leader` = %d", Defenders);
mysql_tquery(handle, gQuery, "", "");

foreach(new i : Player)
{
if(IsInWar1(i))
{
format(gString, sizeof(gString), "Statisticile tale pentru acest war: Ucideri: %d / Decese: %d",PlayerInfo[i][pPersonalKills],PlayerInfo[i][pPersonalDeaths]);
SendClientMessage(i, COLOR_WAR, gString);
PlayerInfo[i][pPersonalKills] = 0;
Update(i, pPersonalKillsx);
PlayerInfo[i][pPersonalDeaths] = 0;
Update(i, pPersonalDeathsx);
SetPlayerVirtualWorld(i, 0);
for(new m = 0; m < 5; m++) SendDeathMessageToPlayer(i, 1001, 1001, 200);

new faction = PlayerInfo[i][pMember] + PlayerInfo[i][pLeader];
format(gString, sizeof(gString), "Punct din oficiu pentru participarea la batalie");
GiveFactionPoint(i, faction, gString);
}
}
gQuery[0] = (EOS);
mysql_format(handle, gQuery, sizeof(gQuery), "INSERT INTO `wars` (`Attackers`,`Defenders`,`BestMember`,`WorstMember `, `Winners`, `ScoreAttackers`, `ScoreDefenders`, `Zone`, `Date`) VALUES ('%e', '%e', '%e', '%e', '%e', '%d', '%d', '%d', '%e')",FactionName[Attackers], FactionName[Defenders], BestMember, WorstMember, FactionName[WarWinners], ScoreAtt, ScoreDef, zone, GetDate() );
mysql_tquery(handle, gQuery, "", "");

InWar[Attackers] = 0;
InWar[Defenders] = 0;
WarPause[Attackers] = gettime() + 600;

Attackers = 99;
Defenders = 99;

ScoreAtt = 0.0;
ScoreDef = 0.0;

War = 0;
TakeON[zone] = 0;
WarTime[0] = 0;
for(new i = grove[0]; i <= vla[8]; i++) if(GetVehicleVirtualWorld(i) == 10) SetVehicleToRespawn(i);
DestroyWarPickups(1);
return 1;
}

but if the war ends like 0 - 0 no one killed someone else it's showing corectly ... what can be the problem ?

Misiur
09/02/2017, 06:53 PM
You are putting a float as an integer. In your "INSERT INTO `wars`" query, change %d to %f for ScoreAtt and ScoreDef OR leave it as %d and do floatround

StR_MaRy
09/02/2017, 06:56 PM
what do you mean do a floatround with %d some info pls .. ?

EDIT: worked with %f , thx