31.01.2018, 22:32
Alguem Pode me dizer como crio um sistema de gangzone so que com progress bar com a barrinha carregando na hora de dominar? deixe tutorial ai em baixo e digas obrigado
#include a_samp
#include progress
new Gang[MAX_PLAYERS] = 0;
new Bar:BarraGang[MAX_PLAYERS];
new TimerGang[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
BarraGang[playerid] = CreateProgressBar(524.00, 124.00, 55.50, 3.20, -16776961, 100.0);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
HideProgressBarForPlayer(playerid, BarraGang[playerid]);
DestroyProgressBar(BarraGang[playerid]);
KillTimer(TimerGang[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
ShowProgressBarForPlayer(playerid, BarraGang[playerid]);
TimerGang[playerid] = SetTimerEx("Dominando", 1000, true, "i", playerid);
return 1;
}
forward Dominando(playerid);
public Dominando(playerid)
{
Gang[playerid] ++;
SetProgressBarValue(BarraGang[playerid], Gang[playerid]);
UpdateProgressBar(BarraGang[playerid]);
if(Gang[playerid] == 100)
{
Gang[playerid] = 0;
UpdateProgressBar(BarraGang[playerid]);
return 1;
}
return 1;
}
Cara fiz essa progress bar para vocк, agora vou te explicar a gangzone, vocк tem que criar a gangzone e Verificar se o Player Estб encima, se ele tiver vocк chama o Timer Da progress. Use como base, algum bug ? Peзa denovo. Pq eu esqueзo de algum detalhe kkk
PHP код:
|
// -=-=-=-=-=-= GangZones =-=-=-=-=-=-
#define MAX_GZS 9
new ChecksDominio[MAX_GZS];
new GangZonas[MAX_GZS];
new GZDono[MAX_GZS][50] =
{
"CV", "CV", "CV",
"ADA", "ADA", "ADA",
"TCP", "TCP", "TCP",
"MLC","MLC","MLC",
"PMRJ", "BOPE", "CORE"
};
new ContagemDominio[MAX_GZS];
enum gz_info
{
GZName[50],
GZColor,
Float:GZCoords[4],
Float:CheckCoords[3]
};
new GangZone[MAX_GZS][gz_info] = {
// ========== [ CMD ] ========= //
{"Cidade Alta", COR_CV, {1179.465, -1027.653, 1576.513, -630.6053}, {1496.1458,-762.7763,86.5169}},
{"Antares", COR_CV, {-1296.244, 1964.3649, -950.5201, 2253.83}, {-1037.7660,2079.6924,98.1975}},
// ========== [ ADA ] ========= //
{"Pedreira", COR_ADA, {578.2740, -671.7010, 879.4274, -408.4413}, {645.6096,-485.1181,16.1875}},
{"Jorge Turco", COR_ADA, {-1833.426, 2172.085, -1588.191, 2744.301}, {-1729.0675,2528.9895,102.6688}},
// ========== [ TD3 ] ========== //
{"Acari", COR_TCP, {2151.2798, 547.3492, 2431.1909, 829.5746}, {2310.3484,700.3497,11.0710}},
{"Parada de Lucas", COR_TCP, {2132.6018, -1021.0089, 2347.0129, -750.3030}, {2288.1025,-855.4818,121.5134}},
// ========= [ MLC ] ========== //
{"Aзo", COR_MLC, {-945.9079, 2545.777, -525.5044, 2826.046}, {-681.4376,2702.9988,70.0219}},
// ========= [ UPP ] ========== //
{"PMRJ", COR_PMRJ, {5.5,5.5,5.5}, {5.5,5.5,5.5}},
{"BOPE", COR_CORE, {-5.5,5.5,5.5}, {5.5,5.5,5.5}}
};
public OnGameModeInit()
{
for(new i=0;i < MAX_GZS;i++)
{
GangZonas[i] = GangZoneCreate(GangZone[i][GZCoords][0], GangZone[i][GZCoords][1], GangZone[i][GZCoords][2], GangZone[i][GZCoords][3]);
ContagemDominio[i] = 0;
ChecksDominio[i] = CreateDynamicCP(GangZone[i][CheckCoords][0], GangZone[i][CheckCoords][1], GangZone[i][CheckCoords][2], 4, -1, 0, -1, 100.0);
}
public OnPlayerConnect(playerid)
{
// ==================================================== [ MOSTRA AS GZ'S ] ==================== //
for(new i = 0; i < MAX_GZS; i ++)
{
GangZoneShowForPlayer(playerid, GangZonas[i], GangZone[i][GZColor]);
}
public OnPlayerEnterCheckpoint(playerid)
{
for(new i = 0; i < MAX_GZS; i++)
{
if(GetPlayerVisibleDynamicCP(playerid) == ChecksDominio[i])
{
if(Player[playerid][Admin] >= 1 || Player[playerid][Cargo] >= 4 || Player[playerid][Dono] >= 1 || Player[playerid][Lider] >= 1 || Player[playerid][BOPE] >= 4 || Player[playerid][PMRJ] >= 4 || Player[playerid][CORE] >= 4)
{
if(ContagemDominio[i] != 0) return 1;
if((strcmp(GZDono[i], "CMD", true) == 0) && Player[playerid][Faccoes] == 1||
(strcmp(GZDono[i], "CMD", true) == 0) && Player[playerid][Faccoes] == 2 ||
(strcmp(GZDono[i], "CMD", true) == 0) && Player[playerid][Faccoes] == 3 ||
(strcmp(GZDono[i], "LLL", true) == 0) && Player[playerid][Faccoes] == 4 ||
(strcmp(GZDono[i], "LLL", true) == 0) && Player[playerid][Faccoes] == 5 ||
(strcmp(GZDono[i], "LLL", true) == 0) && Player[playerid][Faccoes] == 6 ||
(strcmp(GZDono[i], "TD3", true) == 0) && Player[playerid][Faccoes] == 7 ||
(strcmp(GZDono[i], "TD3", true) == 0) && Player[playerid][Faccoes] == 8 ||
(strcmp(GZDono[i], "TD3", true) == 0) && Player[playerid][Faccoes] == 9 ||
(strcmp(GZDono[i], "MLC", true) == 0) && Player[playerid][Faccoes] == 10 ||
(strcmp(GZDono[i], "MLC", true) == 0) && Player[playerid][Faccoes] == 11 ||
(strcmp(GZDono[i], "MLC", true) == 0) && Player[playerid][Faccoes] == 12 ||
(strcmp(GZDono[i], "BOPE", true) == 0) && Player[playerid][BOPE] >= 1 ||
(strcmp(GZDono[i], "PMRJ", true) == 0) && Player[playerid][PMRJ] >= 1)
return SCM(playerid, COR_ERRO, ""TAG_ERRO" Sua organizaзгo jб dominou essa favela.");
SetPVarInt(playerid,"GZAtacada",i);
ContagemDominio[i] = SetTimerEx("Contagem",1000,1,"i",playerid);
GangZoneFlashForAll(GangZonas[GetPVarInt(playerid,"GZAtacada")],GetPlayerColor(playerid));
SendFormattedMessageToAll(0xFFFFD2AA, ""TAG_INFO" O '%s' estб tomando a favela '%s' da '%s'.", Nome(playerid), GangZone[i][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
return 1;
}
else SCM(playerid, COR_ERRO, ""TAG_ERRO" Vocк nгo tem permissгo para dominar essa favela!");
}
}
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
for(new i=0;i<MAX_GZS; i++)
{
if(GetPVarInt(playerid,"GZAtacada") != -1)
{
SCM(playerid, COR_ERRO, ""TAG_ERRO" Vocк cancelou o dominio da favela.");
KillTimer(ContagemDominio[GetPVarInt(playerid,"GZAtacada")]);
ContagemDominio[GetPVarInt(playerid,"GZAtacada")] = 0;
GangZoneStopFlashForAll(GangZonas[GetPVarInt(playerid,"GZAtacada")]);
SetPVarInt(playerid,"GZAtacada",-1);
SetPVarInt(playerid,"Tempo",0);
return 1;
}
}
return 1;
}
forward Contagem(playerid);
public Contagem(playerid)
{
new string[128];
if(GetPVarInt(playerid,"Tempo") == 30)
{
if(Player[playerid][BOPE] >= 1)
{
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A 'BOPE' pacificou a favela '%s' da facзгo '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_BOPE;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "BOPE";
}
else if(Player[playerid][PMRJ] >= 1)
{
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A 'PMRJ' pacificou a favela '%s' da facзгo '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_PMRJ;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "PMRJ";
}
else if(Player[playerid][CORE] >= 1)
{
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A 'CORE' pacificou a favela '%s' da facзгo '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_CORE;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "CORE";
}
else if(Player[playerid][Faccoes] == 1 || Player[playerid][Faccoes] == 2 || Player[playerid][Faccoes] == 3)
{
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A facзгo 'CV' tomou a favela '%s' da '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_CV;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "CV";
}
else if(Player[playerid][Faccoes] == 4 || Player[playerid][Faccoes] == 5 || Player[playerid][Faccoes] == 6) {
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A facзгo 'ADA' tomou a favela '%s' da '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_ADA;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "ADA";
}
else if(Player[playerid][Faccoes] == 7 || Player[playerid][Faccoes] == 8 || Player[playerid][Faccoes] == 9) {
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A facзгo 'TCP' tomou a favela '%s' da '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_TCP;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "TCP";
}
else if(Player[playerid][Faccoes] == 10 || Player[playerid][Faccoes] == 11 || Player[playerid][Faccoes] == 12) {
SendFormattedMessageToAll(0xFFFFD2AA, "-GFInfo-: A facзгo 'MLC' tomou a favela '%s' da '%s'.", GangZone[GetPVarInt(playerid,"GZAtacada")][GZName], GZDono[GetPVarInt(playerid,"GZAtacada")]);
GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor] = COR_MLC;
GZDono[GetPVarInt(playerid,"GZAtacada")] = "MLC";
}
GivePlayerMoney(playerid, 10000);
GangZoneHideForAll(GangZonas[GetPVarInt(playerid,"GZAtacada")]);
GangZoneShowForAll(GangZonas[GetPVarInt(playerid,"GZAtacada")], GangZone[GetPVarInt(playerid,"GZAtacada")][GZColor]);
KillTimer(ContagemDominio[GetPVarInt(playerid,"GZAtacada")]);
ContagemDominio[GetPVarInt(playerid,"GZAtacada")] = 0;
SetPVarInt(playerid,"GZAtacada",-1);
SetPVarInt(playerid,"Tempo",0);
return 1;
}
else
{
SetPVarInt(playerid,"Tempo",GetPVarInt(playerid,"Tempo")+1);
format(string,sizeof(string),"~w~%i / ~r~30", GetPVarInt(playerid,"Tempo"));
GameTextForPlayer(playerid, string, 2500, 3);
}
return 1;
}
COMO TROCO GANGZONE POR PROGRESS BAR AQUI O MEU CODE QUE TA COM GANGZONE
PHP код:
|