[Ajuda] Gangzone por Бrea
#6

Quote:
Originally Posted by Caiton
Посмотреть сообщение
bom amigo, eu deixei desse jeito.

Код:
forward VerificarGZ2();
public VerificarGZ2() {
    static cont,cont2, Str[150];
    for(new i; i != MAX_PLAYERS; i++) {
        // No lugar de 1248.011, 2072.804, 1439.348, 2204.319, coloque as suas coordenadas
        if(IsPlayerConnected(i) && IsPlayerInArea(i, 2071.699, -2175.33, 2790.435, -1760.817) && /*Variбvel da org inimiga Ex:*/ Player[i][MotoClube] == 2){ cont++; }
		if(IsPlayerConnected(i) && IsPlayerInArea(i, 2071.699, -2175.33, 2790.435, -1760.817) && /*Variбvel da org inimiga Ex:*/ Player[i][MotoClube] == 1){ cont2++; }
	}
	if(cont >= 3) {
        for(new i; i != MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) &&  Player[i][Gangs] == 1) {
                format(Str, 150, "{00A180}[SERVER]:{ffffff} Cuidado %i membros dos Mayans em Oakland.", cont);
                SendClientMessage(i, -1, Str);
            }
        }
    }
    if(cont2 >= 3) {
        for(new i; i != MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) &&  Player[i][Gangs] == 1) {
                format(Str, 150, "{00A180}[SERVER]:{ffffff} Cuidado %d membros dos Sons of Anarchy em Oakland.", cont2);
                SendClientMessage(i, -1, Str);
            }
        }
    }
    cont = 0;
    cont2 = 0;
    SetTimer("VerificarGZ2", 1000, false);
    return 1;
}
porйm como vc disse ela tб sendo chamada a todo momento... entгo quando entra 3 rivais fica floodando isso direto, como eu faзo para avisar apenas "1 vez" apуs 3 membros membros entrar ou + membros entrar na gz? e se por exemplo, sair 1 dos 3 vгo ficar 2, ai se entrar + 1 ai vai voltar pro 3 ai vai dar um aviso, ou seja sу avisar quando tiver 3 ou mais 1 vez, e quando entrar + rivais alйm dos 3 que jб estб lб dentro da GZ atualizar a quantidade de rivais lб dentro +1 vez...
tб complicado de explicar mas acho que entendeu...
Entendi o que vocк estб querendo dizer, fiz um cуdigo que possa talvez dar algum bug e talvez nгo seja o melhor cуdigo para este caso, mas nгo consegui pensar em outra lуgica para isso.

Bom, teste e veja se funciona e coloquei alguns comentбrios para que vocк possa tentar entender.

PHP код:
forward VerificarGZ2();
public 
VerificarGZ2() {
    new 
cont[2], //Coloque a quantidade de tipo de motoclub que desejar.
                 //Neste caso sу serгo vбlidos motoclub 1 e 2 (cйlula 0 = motoblub 1 \\\ cйlula 1 = motoclub 2)
        
Str[128];
    
    static 
boolplayer_GZ[MAX_PLAYERS][2]; //Variavel para setar true caso o player esteja na GZ, false caso ele nгo esteja na GZ
    
for(new i!= MAX_PLAYERSi++) {
        if(
IsPlayerConnected(i) && Player[i][MotoClube] < 3) { //Verifica se o motoclub й entre 1 e 2
            
if(IsPlayerInArea(i2071.699, -2175.332790.435, -1760.817)) { //Verifica quem estб na GZ
                
                
if(player_GZ[i][ Player[i][MotoClube] - ] == false) { //Verifica se existe mais jogadores na GZ, se ele nгo estava antes e estб na GZ irб contabilizar +1 e setarб a variбvel do jogador a true (ele estб na GZ)
                    
contPlayer[i][MotoClube] - ]++;
                    
player_GZ[i][ Player[i][MotoClube] - ] = true// motoclub 1 й cйlula 0 | motoclub 2 й cйlula 1
                
}
            }
            else 
player_GZ[i][ Player[i][MotoClube] - ] = false//Quem nгo estiver na GZ seta a variбvel a false
        
}
    }
    for(new 
x!= sizeof(cont); x++) { //Farб um loop em todas as contagens
        
if(cont[x] >= 3) { //Ira verificar se cada contagem й maior ou igual a 3
            
            
for(new i!= MAX_PLAYERSi++) {
                if(
IsPlayerConnected(i) && Player[i][Gangs] == 1) {                     
                    
format(Str128"{00A180}[SERVER]:{ffffff} Cuidado %i membros dos %s em Oakland."cont[x], GetNameMotoClube(1)); //Soma +1 pois queremos agr o valor real do motoclub
                    
SendClientMessage(i, -1Str);
                }
            }
        }
    }
    
SetTimer("VerificarGZ2"1000false);
    return 
1;
}
//Crie esta funзгo para pegar os nomes dos motoclub
GetNameMotoClube(playerid) {
    static 
Name[15];
    switch(
Player[playerid][MotoClube]) {
        
//case 0: Name = ""; //Nome do motoclub 0 se tiver, caso nгo tenha sу excluir a linha
        
case 1Name "Mayans";
        case 
2Name "Sons of Anarchy";
        default: 
Name "Nenhum";
    }
    return 
Name;

Reply


Messages In This Thread
Gangzone por Бrea - by Caiton - 27.12.2015, 02:24
Re: Gangzone por Бrea - by EditPawn - 27.12.2015, 02:53
Re: Gangzone por Бrea - by Caiton - 27.12.2015, 16:58
Re: Gangzone por Бrea - by EditPawn - 27.12.2015, 22:38
Re: Gangzone por Бrea - by Caiton - 28.12.2015, 00:36
Re: Gangzone por Бrea - by EditPawn - 28.12.2015, 01:38
Re: Gangzone por Бrea - by Caiton - 28.12.2015, 03:04
Re: Gangzone por Бrea - by Caiton - 29.12.2015, 18:06
Re: Gangzone por Бrea - by Caiton - 09.06.2017, 18:35
Re: Gangzone por Бrea - by RodrigoMSR - 09.06.2017, 21:09

Forum Jump:


Users browsing this thread: 1 Guest(s)