Zauzimanje teritorije


Započeo Carera, Avgust 13, 2018, 21:20:02 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Kada pocne zauzimati teritoriju odmah pise da je napustio,ne znam do cega do neki dan je sve full radilo.
Dio skripte:
forward ZonaZauzmi( playerid );
public ZonaZauzmi( playerid )
{
	new string[ 128 ];
	if( IsPlayerInDynamicArea( playerid, gZoneInfo[ gZone_ID[ playerid ] ][ gZoneRectAngle ] ) )
	{

	    if( gZone_Time[ playerid ] > 0 )
		{
	        format( string, sizeof( string ), "~w~Ostanite u teritoriji jos ~r~%d ~w~sekundi", gZone_Time[ playerid ] );
	        GameTextForPlayer( playerid, string, 1000, 4 ) ;
	        gZone_Time[ playerid ]--;
	    }
	    else if( gZone_Time[ playerid ] == 0 )
		{
	        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        GangZoneHideForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        gZone_Time[ playerid ] = 0;
	        Dimi_KillTimer( gZone_Timer[ playerid ] );

	        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0xFFC801C8, "Vasa organizacija je prosirila svoju vladavinu na jos jednu teritoriju." );

	        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 )
			{
                format( string, sizeof( string ), "[TERITORIJA] Suparnicka organizacija %s je preuzela jednu od vasih teritorija.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
                OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );
                format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koju je kontrolisala organizacija %s.", ImeIgraca( playerid ), OI[ gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] ][ oName ] );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
			}
			else if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] == -1 )
			{
			    format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koja je bila slboodna.", ImeIgraca( playerid ) );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
			}
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] = PlayerInfo[ playerid ][ xClan ];
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTaken ] = true;

			new stringic[ 24 ];
            format( stringic, sizeof( stringic ), "%s", OI[ PlayerInfo[ playerid ][ xClan ] ][ oColor ] );
            strmid( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ], stringic, 0, strlen( stringic ), 255 );
			format( stringic, sizeof( stringic ), "0x%s66", gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ] );
            GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], HexToInt( stringic ) );
			GZone_Refresh( gZone_ID[ playerid ] );
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
			GZone_Save( gZone_ID[ playerid ] );
            PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );
            gZone_ID[ playerid ] = -1;
		}
	}
	else
	{
        GameTextForPlayer( playerid, "~w~Otisli ste iz teritorije!", 1000, 4) ;
        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	    gZone_Time[ playerid ] = 0;
	    Dimi_KillTimer( gZone_Timer[ playerid ] );
	    PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );
        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 )
		{
    		format( string, sizeof( string ), "[TERITORIJA] Suparnicka organizacija %s je napustila teritoriju i prestala sa preuzimanjem.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
            OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );
		}
		format( string, sizeof( string ), "[TERITORIJA] Clan %s je napustio teritoriju i prestao sa zauzimanjem.", ImeIgraca( playerid ) );
        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
        gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
        GZone_Save( gZone_ID[ playerid ] );
        gZone_ID[ playerid ] = -1;
	}
	return true;
}

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]//[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): //

Ovisi ti do tog kako veliku zonu napravis ako napravis tek tolko ce ti se to desavat ako napravis vecu onda probaj ovako

forward ZonaZauzmi( playerid );
public ZonaZauzmi( playerid ) {

	new string[ 128 ];
	
	if( IsPlayerInDynamicArea( playerid, gZoneInfo[ gZone_ID[ playerid ] ][ gZoneRectAngle ] ) ) {
	
	    if( gZone_Time[ playerid ] > 0 ) {

	        format( string, sizeof( string ), "~w~Ostanite u teritoriji jos ~r~%d ~w~sekundi", gZone_Time[ playerid ] );
	        GameTextForPlayer( playerid, string, 1000, 4 ) ;
	        
	        gZone_Time[ playerid ]--;
	    }
	    else if( gZone_Time[ playerid ] == 0 ) {
	    
	        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        GangZoneHideForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        gZone_Time[ playerid ] = 0;
	        Miki_KillTimer( gZone_Timer[ playerid ] );
	    
	        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0xFFC801C8, "Vasa organizacija je prosirila svoju vladavinu na jos jednu teritoriju." );
	    
	        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 ) {

                format( string, sizeof( string ), "[TERITORIJA] Suparnicka banda %s je preuzela jednu od vasih teritorija.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
                OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );

                format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koju je kontrolisala banda %s.", ImeIgraca( playerid ), OI[ gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] ][ oName ] );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
                DajIgracuNovac( playerid, 5000 );
			}
			else if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] == -1 ) {
			
			    format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koja je bila slobodna.", ImeIgraca( playerid ) );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
                DajIgracuNovac( playerid, 2000 );
			}
			
          
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] = PlayerInfo[ playerid ][ xClan ];
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTaken ] = true;
			
			new stringic[ 24 ];
            format( stringic, sizeof( stringic ), "%s", OI[ PlayerInfo[ playerid ][ xClan ] ][ oColor ] );
            strmid( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ], stringic, 0, strlen( stringic ), 255 );
            
            if( PlayerInfo[ playerid ][ xClan ] == 2 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x000000AA );
            else if( PlayerInfo[ playerid ][ xClan ] == 7 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xA52A2AAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 10 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xA52A2AAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 3 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xDABB3EAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 13 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x33CCFFAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 5 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFF6347AA );
            else if( PlayerInfo[ playerid ][ xClan ] == 8 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFFFFFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 17 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFFFFFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 9 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x8D8DFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 12 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x8D8DFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 11 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x000000FF );
            else
            {
				format( stringic, sizeof( stringic ), "0x%sAA", gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ] );
            	GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], HexToInt( stringic ) );
			}
			
			GZone_Refresh( gZone_ID[ playerid ] );
			
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
			
			GZone_Save( gZone_ID[ playerid ] );
			
            PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );

            gZone_ID[ playerid ] = -1;
		}
	}
	else {
	
        GameTextForPlayer( playerid, "~w~Otisli ste iz teritorije!", 1000, 4) ;
        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	    gZone_Time[ playerid ] = 0;
	    Miki_KillTimer( gZone_Timer[ playerid ] );
	    
	    PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );
        
        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 ) {

    		format( string, sizeof( string ), "[TERITORIJA] Suparnicka banda %s je napustila teritoriju i prestala sa preuzimanjem.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
            OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );
		}
		
		format( string, sizeof( string ), "[TERITORIJA] Clan %s je napustio teritoriju i prestao sa zauzimanjem.", ImeIgraca( playerid ) );
        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
        
        gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
        
        GZone_Save( gZone_ID[ playerid ] );
        
        gZone_ID[ playerid ] = -1;
	}
	return true;
}

Citat: Miki11 poslato Avgust 13, 2018, 21:50:55 POSLE PODNE
Ovisi ti do tog kako veliku zonu napravis ako napravis tek tolko ce ti se to desavat ako napravis vecu onda probaj ovako

forward ZonaZauzmi( playerid );
public ZonaZauzmi( playerid ) {

	new string[ 128 ];
	
	if( IsPlayerInDynamicArea( playerid, gZoneInfo[ gZone_ID[ playerid ] ][ gZoneRectAngle ] ) ) {
	
	    if( gZone_Time[ playerid ] > 0 ) {

	        format( string, sizeof( string ), "~w~Ostanite u teritoriji jos ~r~%d ~w~sekundi", gZone_Time[ playerid ] );
	        GameTextForPlayer( playerid, string, 1000, 4 ) ;
	        
	        gZone_Time[ playerid ]--;
	    }
	    else if( gZone_Time[ playerid ] == 0 ) {
	    
	        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        GangZoneHideForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	        gZone_Time[ playerid ] = 0;
	        Miki_KillTimer( gZone_Timer[ playerid ] );
	    
	        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0xFFC801C8, "Vasa organizacija je prosirila svoju vladavinu na jos jednu teritoriju." );
	    
	        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 ) {

                format( string, sizeof( string ), "[TERITORIJA] Suparnicka banda %s je preuzela jednu od vasih teritorija.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
                OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );

                format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koju je kontrolisala banda %s.", ImeIgraca( playerid ), OI[ gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] ][ oName ] );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
                DajIgracuNovac( playerid, 5000 );
			}
			else if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] == -1 ) {
			
			    format( string, sizeof( string ), "[TERITORIJA] Clan %s je zauzeo teritoriju koja je bila slobodna.", ImeIgraca( playerid ) );
            	OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
                DajIgracuNovac( playerid, 2000 );
			}
			
          
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] = PlayerInfo[ playerid ][ xClan ];
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTaken ] = true;
			
			new stringic[ 24 ];
            format( stringic, sizeof( stringic ), "%s", OI[ PlayerInfo[ playerid ][ xClan ] ][ oColor ] );
            strmid( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ], stringic, 0, strlen( stringic ), 255 );
            
            if( PlayerInfo[ playerid ][ xClan ] == 2 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x000000AA );
            else if( PlayerInfo[ playerid ][ xClan ] == 7 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xA52A2AAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 10 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xA52A2AAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 3 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xDABB3EAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 13 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x33CCFFAA );
            else if( PlayerInfo[ playerid ][ xClan ] == 5 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFF6347AA );
            else if( PlayerInfo[ playerid ][ xClan ] == 8 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFFFFFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 17 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0xFFFFFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 9 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x8D8DFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 12 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x8D8DFF00 );
            else if( PlayerInfo[ playerid ][ xClan ] == 11 ) GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], 0x000000FF );
            else
            {
				format( stringic, sizeof( stringic ), "0x%sAA", gZoneInfo[ gZone_ID[ playerid ] ][ gZoneColor ] );
            	GangZoneShowForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ], HexToInt( stringic ) );
			}
			
			GZone_Refresh( gZone_ID[ playerid ] );
			
			gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
			
			GZone_Save( gZone_ID[ playerid ] );
			
            PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );

            gZone_ID[ playerid ] = -1;
		}
	}
	else {
	
        GameTextForPlayer( playerid, "~w~Otisli ste iz teritorije!", 1000, 4) ;
        GangZoneStopFlashForAll( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneID ] );
	    gZone_Time[ playerid ] = 0;
	    Miki_KillTimer( gZone_Timer[ playerid ] );
	    
	    PostaviWanted( playerid, "Zauzimanje Teritorija", "Nepoznati", 6 );
        
        if( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ] != -1 ) {

    		format( string, sizeof( string ), "[TERITORIJA] Suparnicka banda %s je napustila teritoriju i prestala sa preuzimanjem.", OI[ PlayerInfo[ playerid ][ xClan ] ][ oName ] );
            OrgPoruka( gZoneInfo[ gZone_ID[ playerid ] ][ gZoneGangID ], 0x95b4a2FF, string );
		}
		
		format( string, sizeof( string ), "[TERITORIJA] Clan %s je napustio teritoriju i prestao sa zauzimanjem.", ImeIgraca( playerid ) );
        OrgPoruka( PlayerInfo[ playerid ][ xClan ], 0x95b4a2FF, string );
        
        gZoneInfo[ gZone_ID[ playerid ] ][ gZoneTime ] = 30;
        
        GZone_Save( gZone_ID[ playerid ] );
        
        gZone_ID[ playerid ] = -1;
	}
	return true;
}

Ma radilo sve uvjek, i odjednom kada probas zauzimati zonu kaze da ste otisli daleko a na istom mjestu sam,probat cu to pa ti javim :)