←  Problemy z pluginami

AMXX.pl: Support AMX Mod X i SourceMod

»

[Problem] HUD - loose indentation

  • +
  • -
Obelix - zdjęcie Obelix 06.04.2019

Witam, 
Posiadam plugin Gangi, wszystko działa, oprócz HUD'u z informacją o nazwie Gangu oraz Zabójstwach 
Jeżeli ktoś potrafi to naprawić, to wielkie dzięki! 
Plugin GANGI.SMA --> http://wklejto.pl/729662

Błędy podczas Kompilacji: 

gangi.sma(252) : warning 217: loose indentation
gangi.sma(254) : warning 217: loose indentation
gangi.sma(1244) : warning 217: loose indentation
gangi.sma(1245) : warning 217: loose indentation
gangi.sma(1246) : warning 217: loose indentation
gangi.sma(1250) : warning 217: loose indentation
gangi.sma(1262) : warning 217: loose indentation
gangi.sma(1263) : warning 217: loose indentation
gangi.sma(1266) : warning 217: loose indentation
Odpowiedz

  • +
  • -
Robiin - zdjęcie Robiin 06.04.2019

public Ham_PlayerSpawn_Post( id )
{
        if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
                return HAM_IGNORED;
                                
                if(!task_exists(id+ZADANIE_POKAZ_INFORMACJE))   set_task(0.1, "PokazInformacje", id+ZADANIE_POKAZ_INFORMACJE, _, _, "b");
                
        if( g_iGang[ id ] == -1 )
        {
                return HAM_IGNORED;
        }
                
        new aData[ GangInfo ];
        ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
        
        new iGravity = 800 - ( get_pcvar_num( g_pGravityPerLevel ) * aData[ GangGravity ] );
        set_user_gravity( id, float( iGravity ) / 800.0 );
        
        if( aData[ GangStamina ] > 0 )
                set_user_maxspeed( id, 250.0 + ( aData[ GangStamina ] * get_pcvar_num( g_pStaminaPerLevel ) ) );
                
        return HAM_IGNORED;
}

Błąd jest tutaj:


                if(!task_exists(id+ZADANIE_POKAZ_INFORMACJE))   set_task(0.1, "PokazInformacje", id+ZADANIE_POKAZ_INFORMACJE, _, _, "b");

Loose indentation - błąd mówiący o złej tabulacji kodu (klikasz tab, albo dajesz 4 spacje). W powyższym przypadku wystarczy cofnąć o jeden tab w lewo, a warning zniknie.

Odpowiedz

  • +
  • -
Obelix - zdjęcie Obelix 06.04.2019

public Ham_PlayerSpawn_Post( id )
{
        if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
                return HAM_IGNORED;
                                
                if(!task_exists(id+ZADANIE_POKAZ_INFORMACJE))   set_task(0.1, "PokazInformacje", id+ZADANIE_POKAZ_INFORMACJE, _, _, "b");
                
        if( g_iGang[ id ] == -1 )
        {
                return HAM_IGNORED;
        }
                
        new aData[ GangInfo ];
        ArrayGetArray( g_aGangs, g_iGang[ id ], aData );
        
        new iGravity = 800 - ( get_pcvar_num( g_pGravityPerLevel ) * aData[ GangGravity ] );
        set_user_gravity( id, float( iGravity ) / 800.0 );
        
        if( aData[ GangStamina ] > 0 )
                set_user_maxspeed( id, 250.0 + ( aData[ GangStamina ] * get_pcvar_num( g_pStaminaPerLevel ) ) );
                
        return HAM_IGNORED;
}

Błąd jest tutaj:


                if(!task_exists(id+ZADANIE_POKAZ_INFORMACJE))   set_task(0.1, "PokazInformacje", id+ZADANIE_POKAZ_INFORMACJE, _, _, "b");

Loose indentation - błąd mówiący o złej tabulacji kodu (klikasz tab, albo dajesz 4 spacje). W powyższym przypadku wystarczy cofnąć o jeden tab w lewo, a warning zniknie.

 

Okej dzięki ! + 
Poprawiłem wszystko, nie ma już błędu podczas Kompilacji, natomiast HUD dalej nie działa :/ Reszta działa prawidłowo. 
Wiesz, gdzie leży błąd, że nie wyświetla się informacja HUD? 

Odpowiedz

  • +
  • -
Eryk172 - zdjęcie Eryk172 07.04.2019

Na przyszlość - https://amxx.pl/topi...PluginPierwszy 

Polecam ^D^

Odpowiedz

  • +
  • -
Toldi - zdjęcie Toldi 07.04.2019

public PokazInformacje(id) 
{
	id -= ZADANIE_POKAZ_INFORMACJE;
	
	if(!is_user_connected(id))
	{
		remove_task(id+ZADANIE_POKAZ_INFORMACJE);
		return PLUGIN_CONTINUE;
	}
	
	if(!is_user_alive(id))
	{
		new target = pev(id, pev_iuser2);
		new szGang2[33];
		PobierzGang2(target, szGang2, 32);
		new szGang[33];
		PobierzGang(target, szGang, 32);
		if(!equali(szGang,"")){
		}else szGang = "Brak"
		
		if(!target)
			return PLUGIN_CONTINUE;
		
		set_hudmessage(255, 255, 255, 0.6, -1.0, 0, 1.0, 1.0, 0.1, 0.1);
		ShowSyncHudMsg(id, SyncHudObj, "Gang: %s^nZabojstwa klanu: %u", szGang, szGang2);
		
		return PLUGIN_CONTINUE;
	}
	if(is_user_alive(id))
	{
		new szGang2[33];
		PobierzGang2(id, szGang2, 32);
		new szGang[33];
		PobierzGang(id, szGang, 32);
		if(!equali(szGang,"")){
		}else szGang = "Brak"
		set_hudmessage(255, 255, 255, 0.6, -1.0, 0, 1.0, 1.0, 0.1, 0.1);
		ShowSyncHudMsg(id, SyncHudObj, "Gang: %s^nZabojstwa klanu: %u", szGang, szGang2);
	}
	
	return PLUGIN_CONTINUE;
}

Mogło to być spowodowane tym że najpierw chciałeś wyświetlić informację a dopiero potem ustawiasz jej parametry (polozenie, kolor, itp...). W sumię pierwszy raz się z tym spotykam i nie wiem czy to pomoże.

Odpowiedz