[Ajuda] Cifrгo.
#1

Код:
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;
}
Queria saber como faзo pra sу poder pegar o cifrгo da favela se a favela estiver dominada pela sua facзгo?
Variavel da facзгo pFaccao 1, 2 3 e 4 que sгo da facзгo 1.
Reply
#2

EX: Eu sou da favela 1, dominei a 2, ai eu posso pegar o cifrгo dela?
Reply
#3

Quote:
Originally Posted by ThiagoMikael
Посмотреть сообщение
EX: Eu sou da favela 1, dominei a 2, ai eu posso pegar o cifrгo dela?
Isso mano, tu so pode pegar da 2 se tu tiver dominado ela, no caso se o dono da gz for voce, se n for n vai poder pegar. ..
Reply
#4

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.
Reply
#5

Quote:
Originally Posted by Jonorusc
Посмотреть сообщение
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.
Fica assim mais ou menos pelo oque entendi:
PHP код:
/dominar

    
Dominou
    
{
          
Checar qual favela ele estб dominando;
          (
Vocк pode checar isso com as cordenadas do local de dominiocada uma tem umaai tu checa em qual ele
          estб
)
          
Getar id da favela que ele estб dominando;
          
Player[playerid][DominouFav] = idFAVELA;
    }

PHP код:
Aqui no caso seria por array, mas tu tem uma stock pra cada umaent 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");
 

Reply
#6

Checando em qual favela estб;

PHP код:
enum favela_dados 
{
   
id_fav,
   
nome[40],
   
float:cords[3],
}
new 
Favela[total de favelas][favela_dados] = 
{
  {
0""0.0 ,0.00.0},
  {
1"Favela 1"2.11.23.3},
  {
2"Favela 2"3.44.54.6}
};
//cords ficticias 
Checando

PHP код:
Pegar id de qual favela ele estб
GetarIDFavelaInPoint
(playerid//tentei deixar bonitoo nome kk
{
    new 
str[128];
    for(new 
itotal de favelasi++)
    {
    
        if(
IsPlayerInRangeOfPoint(playerid5.0Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
        
Player[playerid][DominouFav] = Favela[i][id_fav];
    }
    return 
str;

MAs se vc tiver uma stock pra cada um dominar, ai nem precisa disso:
ex: stock dominandofavela1()
tu ja seta o id 1;
Mas em array ficar mais organizado e menor


PHP код:
GetarIDFavelaInPoint(playerid//tentei deixar bonitoo nome kk
{
    new 
id;
    for(new 
itotal de favelasi++)
    {
    
        if(
IsPlayerInRangeOfPoint(playerid5.0Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
                      
id i;
    }
    return 
id;

Reply
#7

Quote:
Originally Posted by ThiagoMikael
Посмотреть сообщение
Checando em qual favela estб;

PHP код:
enum favela_dados 
{
   
id_fav,
   
nome[40],
   
float:cords[3],
}
new 
Favela[total de favelas][favela_dados] = 
{
  {
0""0.0 ,0.00.0},
  {
1"Favela 1"2.11.23.3},
  {
2"Favela 2"3.44.54.6}
};
//cords ficticias 
Checando

PHP код:
Pegar id de qual favela ele estб
GetarIDFavelaInPoint
(playerid//tentei deixar bonitoo nome kk
{
    new 
str[128];
    for(new 
itotal de favelasi++)
    {
    
        if(
IsPlayerInRangeOfPoint(playerid5.0Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
        
Player[playerid][DominouFav] = Favela[i][id_fav];
    }
    return 
str;

MAs se vc tiver uma stock pra cada um dominar, ai nem precisa disso:
ex: stock dominandofavela1()
tu ja seta o id 1;
Mas em array ficar mais organizado e menor


PHP код:
GetarIDFavelaInPoint(playerid//tentei deixar bonitoo nome kk
{
    new 
id;
    for(new 
itotal de favelasi++)
    {
    
        if(
IsPlayerInRangeOfPoint(playerid5.0Favela[i][cords][0], Favela[i][cords][1], Favela[i][cords][2]))
                      
id i;
    }
    return 
id;

Код:
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;
esses dados, posso reaproveita-los?
Reply
#8

tu pode so fazer isso:
PHP код:
PegarCifrгo()
{
    for(new 
ID_FAVELAID_FAVELA total de favelasID_FAVELA++) 
    { 
     
        if(
IsPlayerInRangeOfPoint(playerid5.0Favela[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");
            }                 
       }
   }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)