main()
{
new
AlqMembers = 2,
IslanMembers = 5,
FaMembers = 4,
margem = 1,
bool:Allowed[3] = {true, true, true}
;
new
bool:verificacao
;
if(Allowed[0] && Allowed[1])
{
print("Allowed[0] && Allowed[1]");
verificacao = ((AlqMembers <= 2) && (IslanMembers <= 2));
}
if(Allowed[1] && Allowed[2])
{
print("Allowed[1] && Allowed[2]");
verificacao = ((AlqMembers <= 2) && (FaMembers <= 2));
}
if(Allowed[0] && Allowed[2])
{
print("Allowed[0] && Allowed[2]");
verificacao = ((IslanMembers <= 2) && (FaMembers <= 2));
}
if(Allowed[0] && Allowed[1] && Allowed[2])
{
print("Allowed[0] && Allowed[1] && Allowed[2]");
verificacao = ((IslanMembers <= 2) && (FaMembers <= 2) && (AlqMembers <= 2));
}
if(verificacao)
print("[1]verificacao == 1");
verificacao = false;
if(Allowed[0] && Allowed[1])
{
print("Allowed[0] && Allowed[1]");
if((AlqMembers >= 7) && (IslanMembers >= 7))
margem = 3;
else if((AlqMembers >= 5) && (IslanMembers >= 5))
margem = 2;
}
if(Allowed[0] && Allowed[2])
{
print("Allowed[0] && Allowed[2]");
if((FaMembers >= 7) && (IslanMembers >= 7))
margem = 3;
if((FaMembers >= 5) && (IslanMembers >= 5))
margem = 2;
}
if(Allowed[1] && Allowed[2])
{
print("Allowed[1] && Allowed[2]");
if((FaMembers >= 7) && (AlqMembers >= 7))
margem = 3;
if((FaMembers >= 5) && (AlqMembers >= 5))
margem = 2;
}
if(Allowed[0] && Allowed[1])
{
print("Allowed[0] && Allowed[1]");
verificacao = (((AlqMembers >= (IslanMembers - margem)) && (AlqMembers <= (IslanMembers + margem))));
}
if(Allowed[0] && Allowed[2])
{
print("Allowed[0] && Allowed[2]");
verificacao = (((IslanMembers >= (FaMembers - margem)) && (IslanMembers <= (FaMembers + margem))));
}
if(Allowed[1] && Allowed[2])
{
print("Allowed[1] && Allowed[2]");
verificacao = (((AlqMembers >= (FaMembers - margem)) && (AlqMembers <= (FaMembers + margem))));
}
if(Allowed[0] && Allowed[1] && Allowed[2])
{
print("Allowed[0] && Allowed[1] && Allowed[2]");
verificacao = (
((AlqMembers >= (IslanMembers - margem)) && (AlqMembers <= (IslanMembers + margem))) &&
((AlqMembers >= (FaMembers - margem)) && (AlqMembers <= (FaMembers + margem))) &&
((IslanMembers >= (FaMembers - margem)) && (IslanMembers <= (FaMembers + margem)))
);
}
if(verificacao)
print("[2]verificacao == 1");
else
print("[2]verificacao == 0");
printf("AlqMembers = %d", AlqMembers);
printf("IslanMembers = %d", IslanMembers);
printf("FaMembers = %d", FaMembers);
printf("margem = %d", margem);
printf("bool:Allowed[3] = {%s, %s, %s}", (Allowed[0] ? ("true") : ("false")), (Allowed[1] ? ("true") : ("false")), (Allowed[2] ? ("true") : ("false")));
}
new
AlqMembers = 2,
IslanMembers = 5,
FaMembers = 4,
margem = 1,
bool:Allowed[3] = {true, true, true}
;
new _a;
new b = 2*_a;
// b vai multiplicando por 1 a cada "_a' online.
Sу usar o algoritmo de pegar players prуximos, verificar se й da mesma "org" e contar +1 variбvel. Usar um timer parecido com o OnPlayerUpdate, mas com verificaзгo em 1seg, e ir atualizando a quantidade de players dessa "org" dentro do local.
|
if(verificacao)
print("[2]verificacao == 1");
AlqMembers = 2, IslanMembers = 5, FaMembers = 5,
#include <a_samp>
enum tTimes {
LosSantos,
LosSantosMembros,
LasVegas,
LasVegasMembros,
SanFierro,
SanFierroMembros
}
new PlayerTime[MAX_PLAYERS][tTimes], Time[tTimes];
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
SetTimer("AtualizarGuerra", 5000, true);
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
if(PlayerTime[playerid][LosSantos] == 1) Time[LosSantosMembros]++;
if(PlayerTime[playerid][LasVegas] == 1) Time[LasVegasMembros]++;
if(PlayerTime[playerid][SanFierro] == 1) Time[SanFierroMembros]++;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerTime[playerid][LosSantos] == 1) Time[LosSantosMembros]--;
if(PlayerTime[playerid][LasVegas] == 1) Time[LasVegasMembros]--;
if(PlayerTime[playerid][SanFierro] == 1) Time[SanFierroMembros]--;
return 1;
}
stock AtualizarGuerra()
{
if(Time[LosSantosMembros] >= 2 && Time[LasVegasMembros] >= 2 || Time[LasVegasMembros] >= 2 && Time[SanFierroMembros] >= 2 || Time[LosSantosMembros] >= 2 && Time[SanFierroMembros] >= 2)
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerTime[playerid][LosSantos] == 1 || IsPlayerConnected(i) && PlayerTime[playerid][SanFierro] == 1 || IsPlayerConnected(i) && PlayerTime[playerid][LasVegas] == 1)
{
SendClientMessage(playerid, -1, Time[LosSantosMembros] >= 2 && Time[LasVegasMembros] >= 2 ? ("[>] Os times Los Santos e Las Vegas estгo com membros suficiente para iniciar uma guerra!") : Time[LasVegasMembros] >= 2 && Time[SanFierroMembros] >= 2 ? ("[>] Os times Las Vegas e San Fierro estгo com membros suficiente para iniciar uma guerra!") : Time[LosSantosMembros] >= 2 && Time[SanFierroMembros] >= 2 ? ("[>] Os times Los Santos e San Fierro estгo com membros suficiente para iniciar uma guerra!") : ("Erro na Contagem da Guerra!"));
}
}
}