[DUDA] No funciona del todo
#1

Hola, pasa que tengo este comando para "vomitar" a los que esten a un rango de 10.0 de distancia, todo funciona bien, los infecta, pero tambiйn me infecta a mi, cosa que no deberнa ser por que tiene que infectar a los demбs, que tendrб de malo?:
Код:
if(newkeys == KEY_YES) // Tecla [Y] <
	{
        if(gTeam[playerid] == TEAM_ZOMBIES)
		{
			if(Informacion[playerid][ClaseZombies] == 3) // Boomer
			{
			    if(TiempitoVomito(playerid)){SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: {FFFFFF}Puedes vomitar solo cada 40 segundos, mira la barra de vomito boomer.");return 1;}
				TiempoVomito[playerid] = GetTickCount();
				new Float:pos[3];
    			GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    			for(new i=0; i< MAX_PLAYERS ; i++)
    			{
        			if(IsPlayerInRangeOfPoint(i, 10.0 , pos[0], pos[1], pos[2]))
        			{
            			SetTimerEx("MatarTimer", 2000,0,"d",i); // Mata el timer para la victima!
            			PlayerPlaySound(i, 1190, 0.0, 0.0, 0.0);
  						GameTextForPlayer(i, "~w~vomitado por ~r~boomer!!", 4000, 3);
  						SetPlayerDrunkLevel(i, 9999); // marea
  						TextDrawShowForPlayer(i, VistaZombie);
  						SetPlayerTime(i, 3, 0);
   						SetPlayerWeather(i, 45);
        			}
    			}
    		}
    	}
    }
Reply
#2

PHP код:
if(newkeys == KEY_YES// Tecla [Y] <
    
{
        if(
gTeam[playerid] == TEAM_ZOMBIES)
        {
            if(
Informacion[playerid][ClaseZombies] == 3// Boomer
            
{
                if(
TiempitoVomito(playerid)){SendClientMessage(playerid0xFF0000FF"[ERROR]: {FFFFFF}Puedes vomitar solo cada 40 segundos, mira la barra de vomito boomer.");return 1;}
                
TiempoVomito[playerid] = GetTickCount();
                new 
Float:pos[3];
                
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                for(new 
i=0iMAX_PLAYERS i++)
                {
                    if(
playerid == i) continue;
                    if(
IsPlayerInRangeOfPoint(i10.0 pos[0], pos[1], pos[2]))
                    {
                        
SetTimerEx("MatarTimer"2000,0,"d",i); // Mata el timer para la victima!
                        
PlayerPlaySound(i11900.00.00.0);
                          
GameTextForPlayer(i"~w~vomitado por ~r~boomer!!"40003);
                          
SetPlayerDrunkLevel(i9999); // marea
                          
TextDrawShowForPlayer(iVistaZombie);
                          
SetPlayerTime(i30);
                           
SetPlayerWeather(i45);
                    }
                }
            }
        }
    } 
Reply
#3

Tu fallo estб en:
pawn Код:
if(playerid == i) continue;
Nunca serб llamado ya que el bucle busca en "i" no en "playerid".

Asн deberнa funcionar.

pawn Код:
if(i ==playerid  ) continue;
Reply
#4

Como puedo hacerlo para que si no hay ningun jugador cerca dentro del rango del 10.0 o no afecte a nadie el vomito no se cumpla la funcion
Reply
#5

Si te funciona lo que te dicen, dilo y al menos agradйcelo ya que quitas las ganas de ayudarte...

pawn Код:
if(newkeys == KEY_YES) // Tecla [Y] <
    {
        if(gTeam[playerid] == TEAM_ZOMBIES)
        {
            if(Informacion[playerid][ClaseZombies] == 3) // Boomer
            {
                if(TiempitoVomito(playerid)){SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: {FFFFFF}Puedes vomitar solo cada 40 segundos, mira la barra de vomito boomer.");return 1;}
                TiempoVomito[playerid] = GetTickCount();
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                for(new i=0; i< MAX_PLAYERS ; i++)
                {
                    if(i == playerid) continue;
                    new Conteo = 0;
                    if(IsPlayerInRangeOfPoint(i, 10.0 , pos[0], pos[1], pos[2]))
                    {
                        Conteo ++;
                    }
                    if(Conteo > 0)
                    {
                        SetTimerEx("MatarTimer", 2000,0,"d",i); // Mata el timer para la victima!
                        PlayerPlaySound(i, 1190, 0.0, 0.0, 0.0);
                        GameTextForPlayer(i, "~w~vomitado por ~r~boomer!!", 4000, 3);
                        SetPlayerDrunkLevel(i, 9999); // marea
                        TextDrawShowForPlayer(i, VistaZombie);
                        SetPlayerTime(i, 3, 0);
                        SetPlayerWeather(i, 45);
                    }
                }
            }
        }
Reply
#6

Quote:
Originally Posted by Tirael
Посмотреть сообщение
Si te funciona lo que te dicen, dilo y al menos agradйcelo ya que quitas las ganas de ayudarte...

pawn Код:
if(newkeys == KEY_YES) // Tecla [Y] <
    {
        if(gTeam[playerid] == TEAM_ZOMBIES)
        {
            if(Informacion[playerid][ClaseZombies] == 3) // Boomer
            {
                if(TiempitoVomito(playerid)){SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: {FFFFFF}Puedes vomitar solo cada 40 segundos, mira la barra de vomito boomer.");return 1;}
                TiempoVomito[playerid] = GetTickCount();
                new Float:pos[3];
                GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
                for(new i=0; i< MAX_PLAYERS ; i++)
                {
                    if(i == playerid) continue;
                    new Conteo = 0;
                    if(IsPlayerInRangeOfPoint(i, 10.0 , pos[0], pos[1], pos[2]))
                    {
                        Conteo ++;
                    }
                    if(Conteo > 0)
                    {
                        SetTimerEx("MatarTimer", 2000,0,"d",i); // Mata el timer para la victima!
                        PlayerPlaySound(i, 1190, 0.0, 0.0, 0.0);
                        GameTextForPlayer(i, "~w~vomitado por ~r~boomer!!", 4000, 3);
                        SetPlayerDrunkLevel(i, 9999); // marea
                        TextDrawShowForPlayer(i, VistaZombie);
                        SetPlayerTime(i, 3, 0);
                        SetPlayerWeather(i, 45);
                    }
                }
            }
        }
Perdуn, pero la funciуn de arriba me funcionу pero al tuya me tira esto al compilar:
Код:
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2281) : warning 219: local variable "Conteo" shadows a variable at a preceding level
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2284) : error 022: must be lvalue (non-constant)
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2284) : warning 215: expression has no effect
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2286) : warning 213: tag mismatch
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2286) : warning 206: redundant test: constant expression is non-zero
C:\Users\matia\Desktop\Carpetas\SERVER\GTASERVER\Left 4 dead\gamemodes\GMZ.pwn(2281) : warning 204: symbol is assigned a value that is never used: "Conteo"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

Cambia Conteo por otra cosa pues parece que ya la usas.
Deja las lineas de errores / warning.
Reply
#8

Quote:
Originally Posted by Tirael
Посмотреть сообщение
Cambia Conteo por otra cosa pues parece que ya la usas.
Deja las lineas de errores / warning.
Код:
new Conteo = 0; //2312
					if(IsPlayerInRangeOfPoint(i, 10.0 , pos[0], pos[1], pos[2]))
					{
						Conteo ++; //2315
					}
					if(Conteo > 0) //2317
					{
Reply
#9

pawn Код:
new ConteoVariable = 0; //2312
                    if(IsPlayerInRangeOfPoint(i, 10.0 , pos[0], pos[1], pos[2]))
                    {
                        ConteoVariable ++; //2315
                    }
                    if(ConteoVariable > 0) //2317
                    {
Reply
#10

Quote:
Originally Posted by Tirael
Посмотреть сообщение
Tu fallo estб en:
pawn Код:
if(playerid == i) continue;
Nunca serб llamado ya que el bucle busca en "i" no en "playerid".

Asн deberнa funcionar.

pawn Код:
if(i ==playerid  ) continue;
Disculpa que me salga de tema pero йsto no tiene sentido. playerid == i es equivalente a i == playerid y no tiene nada que ver con el problema del autor del hilo. En este caso, el orden de los operandos no altera el resultado de la operaciуn.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)