- 0
Bug sistem war
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
TheGodfather
Salut, la gamemode-ul bhood hpq123 am observat ca dupa ce dau restart, turfurile se pun aiurea in /turfs. Cu siguranta mai sunt si alte probleme la sistemul de war. Aveti idee cum pot rezolva? Las mai jos ce tine de sistemul de war.
YCMD:turfs(playerid, params[], help) {
if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Wait %d seconds.", aspam[playerid]);
if(TurfsDisp[playerid] == 0) {
TurfsDisp[playerid] = 1;
for(new i = 0; i < sizeof(Turfs); i++)
{
switch(TurfInfo[i][zOwned]) {
case 0: GangZoneShowForPlayerEx(playerid, Turfs[i], 0xFFFFFFAA); //None
case 4: GangZoneShowForPlayerEx(playerid, Turfs[i], 0x0CAB3C99); //Grove Street
case 5: GangZoneShowForPlayerEx(playerid, Turfs[i], 0x11F2F299); //Los Vagos
case 6: GangZoneShowForPlayerEx(playerid, Turfs[i], 0x8E541099); //Ballas
case 10: GangZoneShowForPlayerEx(playerid, Turfs[i], 0xAB00FA99); //Los Aztecas
}
}
SCM(playerid, -1, "You activated the turfs.");
} else {
TurfsDisp[playerid] = 0;
for(new i = 0; i < sizeof(Turfs); i++) GangZoneHideForPlayerEx(playerid, Turfs[i]);
SCM(playerid, -1, "You deactivated the turfs.");
}
return true;
}
function SQL_loadTurfs() {
printf("Turfs: %d", cache_num_rows());
if(cache_num_rows() == 0)
return true;
new ORM:ormid;
for(new i = 0; i < cache_num_rows(); i++) {
ormid = orm_create("turfs");
orm_addvar_int(ormid, TurfInfo[i][zID], "ID");
orm_addvar_int(ormid, TurfInfo[i][zOwned], "Owned");
orm_addvar_float(ormid, TurfInfo[i][zMinX], "MinX");
orm_addvar_float(ormid, TurfInfo[i][zMinY], "MinY");
orm_addvar_float(ormid, TurfInfo[i][zMaxX], "MaxX");
orm_addvar_float(ormid, TurfInfo[i][zMaxY], "MaxY");
orm_apply_cache(ormid, i);
}
for(new i = 0; i < sizeof(TurfInfo); i++) Turfs[i] = GangZoneCreateEx(TurfInfo[i][zMinX],TurfInfo[i][zMinY],TurfInfo[i][zMaxX],TurfInfo[i][zMaxY],TurfInfo[i][zID],1.0);
return true;
}
Functia SQL_loadTurfs este folosita la OnGamemodeInit astfel: mysql_tquery(SQL, "SELECT * FROM `turfs`", "SQL_loadTurfs", "");
function OtherTimer() {
new stringg[180], iswar;
for(new w = 0; w < 16; w++) if(InWar[w] == 1) iswar = 1;
if(iswar != 1)
return true;
for(new i = 0; i < sizeof(Turfs); i++) {
new attackers = WarInfo[i][wAttacker];
new defenders = WarInfo[i][wFaction];
if(WarInfo[i][wTime] >= 2) {
foreach(Player,j) {
if(PlayerInfo[j][pMember] == attackers || PlayerInfo[j][pMember] == defenders) {
if(WarInfo[i][wAttacker] == 4) GangZoneFlashForPlayer(j,Turfs[i], 0x0CAB3C99);
else if(WarInfo[i][wAttacker] == 5) GangZoneFlashForPlayer(j,Turfs[i], 0x11F2F299);
else if(WarInfo[i][wAttacker] == 6) GangZoneFlashForPlayer(j,Turfs[i], 0x8E541099);
else if(WarInfo[i][wAttacker] == 10) GangZoneFlashForPlayer(j,Turfs[i], 0xAB00FA99);
}
}
}
if(WarInfo[i][wTime] > 0) {
WarInfo[i][wTime] -= 1;
foreach(Player,j) {
if(IsPlayerInTurf(j,i) == 1) {
if(PlayerInfo[j][pMember] == attackers) WarScoreF[attackers][i] += 0.002;
if(PlayerInfo[j][pMember] == defenders) WarScoreF[defenders][i] += 0.002;
}
}
if(WarInfo[i][wTime] == 1) {
new Float: atscore = 0.0;
new Float: defscore = 0.0;
atscore = WarScoreF[attackers][i];
defscore = WarScoreF[defenders][i];
new winner;
SetVehicle(attackers, 0);
SetVehicle(defenders, 0);
foreach(Player,j) {
if(PlayerInfo[j][pMember] == attackers) {
SCM(j, COLOR_MONEY, "--------------------- WAR Statistics ---------------------");
RespawnVehicle(attackers);
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(stringg,sizeof(stringg),"War between %s and %s for turf %d is over.",FactionName(attackers),FactionName(defenders),i+1);
SCM(j, COLOR_MONEY,stringg);
//for(new m = 0; m < 5; m++) SendDeathMessageToPlayer(j, 1001, 1001, 200);
PlayerTextDrawHide(j, WarTime);
}
if(PlayerInfo[j][pMember] == defenders) {
SCM(j, COLOR_MONEY, "--------------------- WAR Statistics ---------------------");
RespawnVehicle(defenders);
GangZoneStopFlashForPlayer(j,Turfs[i]);
format(stringg,sizeof(stringg),"War between %s and %s for turf %d is over.",FactionName(attackers),FactionName(defenders),i);
SCM(j, COLOR_MONEY,stringg);
//for(new m = 0; m < 5; m++) SendDeathMessageToPlayer(j, 1001, 1001, 200);
PlayerTextDrawHide(j, WarTime);
}
}
DestroyPickups(i);
if(atscore > defscore) winner = 1;
else winner = 2;
new winbest, losebest;
new winbestj = -1, losebestj = -1;
new bestname1[25],bestname2[25],bestname[25],worstname[25];
FactionDeelay[attackers] = 300;
foreach(Player,j) {
if(winner == 1) {
if(PlayerInfo[j][pMember] == attackers) {
winbest = bestscoreat[i];
if(bestmemberat[i] != 999) {
if(PlayerInfo[bestmemberat[i]][pMember] == attackers) {
winbestj = bestmemberat[i];
GetPlayerName(winbestj,bestname1,sizeof(bestname1));
strmid(bestname, bestname1, 0, strlen(bestname1), 255);
}
}
else {
format(bestname,sizeof(bestname),"Null");
strmid(bestname, bestname, 0, strlen(bestname), 255);
}
}
if(PlayerInfo[j][pMember] == defenders) {
losebest = worstscoredf[i];
if(worstmemberdf[i] != 999) {
if(PlayerInfo[worstmemberdf[i]][pMember] == defenders) {
losebestj = worstmemberdf[i];
GetPlayerName(losebestj,bestname2,sizeof(bestname2));
strmid(worstname, bestname2, 0, strlen(bestname2), 255);
}
}
else {
format(worstname,sizeof(worstname),"Null");
strmid(worstname, worstname, 0, strlen(worstname), 255);
}
}
}
if(winner == 2) {
if(PlayerInfo[j][pMember] == defenders) {
winbest = bestscoredf[i];
if(bestmemberdf[i] != 999) {
if(PlayerInfo[bestmemberdf[i]][pMember] == defenders) {
winbestj = bestmemberdf[i];
GetPlayerName(winbestj,bestname1,sizeof(bestname1));
strmid(bestname, bestname1, 0, strlen(bestname1), 255);
}
}
else {
format(bestname,sizeof(bestname),"Null");
strmid(bestname, bestname, 0, strlen(bestname), 255);
}
}
if(PlayerInfo[j][pMember] == attackers) {
losebest = worstscoreat[i];
if(worstmemberat[i] != 999) {
if(PlayerInfo[worstmemberat[i]][pMember] == attackers) {
losebestj = worstmemberat[i];
GetPlayerName(losebestj,bestname2,sizeof(bestname2));
strmid(worstname, bestname2, 0, strlen(bestname2), 255);
}
}
else {
format(worstname,sizeof(worstname),"Null");
strmid(worstname, worstname, 0, strlen(worstname), 255);
}
}
}
}
foreach(Player,j) {
new uciderii = 0;
uciderii += ucideri[j][i];
new decesee = 0;
decesee += decese[j][i];
ucideri[j][i] = 0;
decese[j][i] = 0;
if((PlayerInfo[j][pMember] == attackers) || (PlayerInfo[j][pMember] == defenders)) {
SetPlayerVirtualWorld(j, 0);
if(WarSeconds[j] >= 300) {
//UpdateFactionRaport(j, 0);
//edisonraport
AddRaportPoint(j);
//edisonraport
}
WarSeconds[j] = 0;
if(winner == 1) {
format(stringg,sizeof(stringg),"%s (%.1f) vs %s (%.1f).",FactionName(WarInfo[i][wAttacker]),atscore,FactionName(WarInfo[i][wFaction]),defscore);
SCM(j, COLOR_MONEY,stringg);
format(stringg,sizeof(stringg),"The best: %s (%d). The worst: %s (-%d).", bestname, winbest, worstname, losebest);
SCM(j, COLOR_MONEY,stringg);
format(stringg,sizeof(stringg),"Your statistics: Score %d (%d kills and %d deaths).",uciderii-decesee, uciderii, decesee);
SCM(j, COLOR_MONEY,stringg);
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
Wartimeon[j] = 0;
}
if(winner == 2) {
format(stringg,sizeof(stringg),"%s (%.1f) vs %s (%.1f).",FactionName(WarInfo[i][wFaction]),defscore,FactionName(WarInfo[i][wAttacker]),atscore);
SCM(j, COLOR_MONEY,stringg);
format(stringg,sizeof(stringg),"The best: %s (%d). The worst: %s (-%d).", bestname, winbest, worstname, losebest);
SCM(j, COLOR_MONEY,stringg);
format(stringg,sizeof(stringg),"Your statistics: Score %d (%d kills and %d deaths).",uciderii-decesee,uciderii, decesee);
SCM(j, COLOR_MONEY,stringg);
Wartimeon[j] = 0;
}
SCM(j, COLOR_MONEY, "---------------------------------------------------------------");
WarScoreF[defenders][i] = 0.0;
WarScoreF[attackers][i] = 0.0;
InWar[attackers] = 0;
InWar[defenders] = 0;
}
if(winner == 1) {
GangZoneHideForPlayerEx(j,Turfs[i]);
if(attackers == 4) GangZoneShowForPlayerEx(j,Turfs[i],0x0CAB3C99);
if(attackers == 5) GangZoneShowForPlayerEx(j,Turfs[i],0x11F2F299);
if(attackers == 6) GangZoneShowForPlayerEx(j,Turfs[i],0x8E541099);
if(attackers == 10) GangZoneShowForPlayerEx(j,Turfs[i],0xAB00FA99);
}
}
if(winner == 1) {
new str[128];
mysql_format(SQL, str,128,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",TurfInfo[i][zOwned],i);
mysql_tquery(SQL,str, "", "");
}
WarInfo[i][wTime] = 0;
WarInfo[i][wFaction] = 0;
WarInfo[i][wAttacker] = 0;
worstscoreat[i] = 0;
worstmemberat[i] = 999;
bestscoreat[i] = 0;
bestmemberat[i] = 999;
worstscoredf[i] = 0;
worstmemberdf[i] = 999;
bestscoredf[i] = 0;
bestmemberdf[i] = 999;
mysql_tquery(SQL, "UPDATE `users` SET `WarTurf`='0', `WarKills`='0', `WarDeaths`='0'", "", "");
}
}
}
return true;
}
6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now