stock FavCifrao1(playerid)
{
if(Player[playerid][pDono] < 1)
{
SendClientMessage(playerid, COR_ERRO,"ERRO: Vocк nгo tem permissгo para pegar o cifrгo!");
return 1;
}
new menssagem[256];
if(cifraoFav1 < 1)
{
SendClientMessage(playerid, COR_ERRO,"ERRO: Nгo hб nenhum dinheiro nesse Cifrгo!");
}
else
{
new menssagem[256];
format(menssagem, sizeof(menssagem),"[GW]: {FFFFFF}%s pegou $%d do cifrгo da favela Paraisopolis.", getPName(playerid), cifraoFav1);
SendClientMessageToAll(0xFF9900FF,menssagem);
GivePlayerMoney(playerid, cifraoFav1);
cifraoFav1 = 0;
GuardarCifrao();
}
return 1;
}
|
EX: Eu sou da favela 1, dominei a 2, ai eu posso pegar o cifrгo dela?
|
|
Usa array?
pode fazer assim: Player[playerid][DominouFav] = id da dominada; Checar na hora de pegar o dinheiro, se o Player[playerid][DominouFav] e = ao id da favela que ele estб tentando pegar o cifrгo. Tlg, bem simples, No caso tu seta essa variбvel ao lнder, ai sу ele poderб pegar. |
/dominar
{
Dominou
{
Checar qual favela ele estб dominando;
(Vocк pode checar isso com as cordenadas do local de dominio, cada uma tem uma, ai tu checa em qual ele
estб)
Getar id da favela que ele estб dominando;
Player[playerid][DominouFav] = idFAVELA;
}
}
Aqui no caso seria por array, mas tu tem uma stock pra cada uma, ent nem precisa checar.
PegarCifrгo()
{
Checar Onde o player estб novamente;
Getar o id da favela onde o player estб
Verificar se o id da favela = Player[playerid][DominouFav];
if(Player[playerid][DominouFav] == ID_FAVELA)
{
}
else
return SendClientMessage(playerid, -1, "ERRO: Vocк nгo dominou essa favela");
}
enum favela_dados =
{
id_fav,
nome[40],
float:cords[3],
}
new Favela[total de favelas][favela_dados] =
{
{0, "", 0.0 ,0.0, 0.0},
{1, "Favela 1", 2.1, 1.2, 3.3},
{2, "Favela 2", 3.4, 4.5, 4.6}
};
//cords ficticias
Pegar id de qual favela ele estб
GetarIDFavelaInPoint(playerid) //tentei deixar bonitoo nome kk
{
new str[128];
for(new i; i < total de favelas; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
Player[playerid][DominouFav] = Favela[i][id_fav];
}
return str;
}
GetarIDFavelaInPoint(playerid) //tentei deixar bonitoo nome kk
{
new id;
for(new i; i < total de favelas; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
id = i;
}
return id;
}
|
Checando em qual favela estб;
PHP код:
PHP код:
ex: stock dominandofavela1() tu ja seta o id 1; Mas em array ficar mais organizado e menor PHP код:
|
enum t_info
{
tNome[64],
Sigla[6],
Estado,
Float:Spawn[3],
tCor,
tSkin,
}
#define MAX_FACCOES 5 //
new Faccoes[MAX_FACCOES][t_info] = {
{"Faccao", "Sigla", 0, {0.0, 0.0, 0.0}, COR_FVL, 0},
{"Favela1", "1", 9, {2430.4404,-834.8191,108.6482}, COR_FVL, 0},//
{"Favela2", "2", 9, {1048.6327,2908.5356,49.0728}, COR_FVL, 0},//
{"Favela3", "3", 9, {-383.8202,-109.6752,51.3575}, COR_FVL, 0},//
{"Favela4", "4", 9, {1172.0436,-2004.6012,70.2221}, COR_FVL, 0},//
};
for(new i=0;i<MAX_GZS;i++)
{
if(GetPlayerVisibleDynamicCP(playerid) == ChecksDominio[i])
{
if(Player[playerid][pAdmin] >= 1)
{
if(ContagemDominio[i] != 0) return 1;
if((strcmp(GZDono[i], "{8B0000}FAC1", true) == 0) && Player[playerid][pFaccao] == 1 ||
(strcmp(GZDono[i], "{8B0000}FAC1", true) == 0) && Player[playerid][pFaccao] == 2 ||
(strcmp(GZDono[i], "{8B0000}FAC1", true) == 0) && Player[playerid][pFaccao] == 3 ||
(strcmp(GZDono[i], "{8B0000}FAC1", true) == 0) && Player[playerid][pFaccao] == 4 ||
return SendClientMessage(playerid, COR_ERRO, "ERRO: Esta favela jб estб dominada!");
SetPVarInt(playerid,"GZAtacada",i);
ContagemDominio[i] = SetTimerEx("Contagem",1000,1,"i",playerid);
GangZoneFlashForAll(GangZonas[GetPVarInt(playerid,"GZAtacada")],GetPlayerColor(playerid));
CP[playerid] = 4;
PegarCifrгo()
{
for(new ID_FAVELA; ID_FAVELA < total de favelas; ID_FAVELA++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Favela[ID_FAVELA][cords][0], Favela[ID_FAVELA][cords][1], Favela[ID_FAVELA][cords][2]))
{
if(Player[playerid][DominouFav] == ID_FAVELA)
{
Tu pegou o cifrгo arrombado.
Player[playerid][DominouFav] = 0;
}
else
{
SendClientMessage(playerid, -1, "ERRO: Vocк nгo dominou essa favela para pegar o cifrгo");
}
}
}
}