[Ajuda] Com IsPlayerInArea
#1

Код:
	for(new i = 0; i < MAX_PLAYERS; ++i)
	{
	    if(IsPlayerConnected(i))
	    {
	        for(new h =0; h < MAX_GZS; h++)
	        {
	        	if(IsPlayerInArea(i,checkGzs[h][0],checkGzs[h][1],checkGzs[h][2],checkGzs[h][3]))
	        	{
	    		    if(GZ_EXISTE[gzsids[h]][0] == 1)
					{
						TextDrawSetString(areaGangZona,"Ta dominado");
						TextDrawShowForPlayer(i,areaGangZona);
					}
					else
					{
						TextDrawSetString(areaGangZona,"Ninguem dominou");
						TextDrawShowForPlayer(i,areaGangZona);
					}
	        	}
	        	else
	        	{
	        	    TextDrawHideForPlayer(i,areaGangZona);
	        	}
	        }
	    }
	}
oque estб errado no meu cуdigo?
Reply
#2

Tб com erro em alguma linha ou й bug?

Se for bug, qual bug й? O TextDraw nгo aparece?
Reply
#3

nгo identifica que o player estб na бrea @_@
Reply
#4

Ai tem 4 "checkGzs"
E segundo o tutorial da Wiki que eu to vendo nгo funciona assim o IsPlayerInArea.

Aonde esse cуdigo estб?
Reply
#5

esses 4 ai, й uma ARRAY onde nela й salva o: X Y X Y
Reply
#6

Ah, beleza.
Vocк vai fazer assim.
Segundo o tutorial da Wiki (https://sampwiki.blast.hk/wiki/Areacheck)
Crie um SetTimer no seu OnGameModeInit:
PHP код:
SetTimer("isPlayerInArea"10001); 
Depois, adicione a public no final do seu GM:
PHP код:
public isPlayerInArea()
    {    
        new 
Float:XFloat:YFloat:Z;
        for(new 
0MAX_PLAYERS; ++i)
        {
           if(
IsPlayerConnected(i))
           {
               for(new 
=0MAX_GZSh++)
               {           
                  
GetPlayerPos(iXYZ);
                  if(
<= checkGzs[h][0] && >= checkGzs[h][1] && <= checkGzs[h][2] && >= checkGzs[h][3])
                  {
                     if(
GZ_EXISTE[gzsids[h]][0] == 1)
                       {
                          
TextDrawSetString(areaGangZona,"Ta dominado");
                          
TextDrawShowForPlayer(i,areaGangZona);
                       }
                       else
                       {
                          
TextDrawSetString(areaGangZona,"Ninguem dominou");
                          
TextDrawShowForPlayer(i,areaGangZona);
                       }
                  }
                  else
                  {
                      
TextDrawHideForPlayer(i,areaGangZona);
                  }
               }
           }
        }
    } 
Testa isso, se der erro ou ficar bugado me fala.
@edit -
Esqueci, cria a forward pra a public, no topo do GM:
PHP код:
forward isPlayerInArea(); 
Ah, e tambйm apague o cуdigo atual.
Reply
#7

nгo funcionou, que estranho
Reply
#8

Voce diz, vocк vai no local e a TextDraw nгo mostra?

Se for isso, eu tenho que saber:
PHP код:
if(<= checkGzs[h][0] && >= checkGzs[h][1] && <= checkGzs[h][2] && >= checkGzs[h][3]) 
Nessa linha, eu fui no chute. Eu nгo sei se o checkGzs[h][0] й o X. Ele pode ser o Y e eu nгo sei, por isso deve estar bugando.

Vocк sabe quem й quem?
Reply
#9

desse modo nem mostra o text entende, mas se eu por um BREAK; no segundo loop, em todas gangzona que eu for ele mostra que nгo estб dominada, mass, se eu comprar qualquer uma que seja, mostra em todas gangzona que estб dominada, atй em uma extra que eu fiz pra outra funзгo que nгo estб no array nem nada
Reply
#10

O bug entгo nгo seria nessa linha?
PHP код:
if(GZ_EXISTE[gzsids[h]][0] == 1
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)