SA-MP Forums Archive
[Ajuda] GPS Sу da a localizaзгo do seu respawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] GPS Sу da a localizaзгo do seu respawn (/showthread.php?tid=566760)



GPS Sу da a localizaзгo do seu respawn - MarlboroBr - 08.03.2015

Bom, nгo vou mentir, esse sistema de GPS nгo foi eu que fiz, e achei aqui mesmo no fуrum. Porem o player tambйm nгo sabia o motivo desse erro... Eu tentei aqui mais nada... Se alguem mais avanзado ai, achar o erro e puder me ajudar a corrigir, ficarei muito grato...

O erro й o seguinte, o GPS sу mostra o nome da cidade que vocк nasceu, vocк vai andando pelo mapa, e o nome nгo vai atualizando :/
PHP код:
    if( !strcmp( cmd, "/gpscidade", true ))
    {
        if( 
TextLocal[ playerid ][ 0 ] == 1 )
        {
            
tmp = strtok( cmdtext, idx );
              if( !
strlen( tmp ))
              {
                
SendClientMessage( playerid, COLOR_SISTEMA, "[ > ] Opзхes: ( Ativar, Desativar )" );
                 
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /GPScidade [ Opзгo ]" );
                return 
1;
            }
            if( !
strcmp( tmp, "ativar", true ))
            {
                if( 
TextLocal[ playerid ][ 2 ] == 1 )
                {
                    
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Seu gps cidade jб estб ativado !" );
                    return 
1;
                }
                
SendClientMessage( playerid, COLOR_SISTEMA, "[ > ] GPS cidade ativado !" );
                
dini_IntSet( f( playerid ), "StatusGPSc", 1 );
                
TextLocal[ playerid ][ 2 ] = 1;
            }
            else if( !
strcmp( tmp, "desativar", true ))
            {
                if( 
TextLocal[ playerid ][ 2 ] == 0 )
                {
                    
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Seu gps cidade jб estб desativado !" );
                    return 
1;
                }
                
SendClientMessage( playerid, COLOR_SISTEMA, "[ > ] GPS cidade desativado !" );
                
dini_IntSet( f( playerid ), "StatusGPSc", 0 );
                
TextLocal[ playerid ][ 2 ] = 0;
                
PlayerTextDrawHide( playerid, CityPlayer[ playerid ] );
            }
            return 
1;
        }
        else
          {
            
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo tem um GPS Cidade !" );
            
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк adquire um nas lojas de utilitarios !" );
        }
        return 
1;
    } 
PHP код:
                case 0: // 'GPS Cidade'
                
{
                    if( 
TextLocal[ playerid ][ 0 ] == 0 )
                    {
                        if( 
GetPlayerCash( playerid ) >= 15000 )
                        {
                            
SendClientMessage( playerid, COLOR_SISTEMA, "[ > ] GPS Cidade adquirido com sucesso ! Comandos GPS Cidade: /GPScidade" );
                            
TextLocal[ playerid ][ 0 ] = 1;
                              
sGivePlayerCash( playerid, -15000 );
                              
dini_IntSet( f( playerid ), "GPScidade", 1 );
                              
dini_IntSet( f( playerid ), "StatusGPSc", 0 );
                              
TextCreatePlayer( playerid );
                        }
                        else
                        {
                            
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк precisa ter $15000 para comprar o GPS Cidade !" );
                        }
                        return 
1;
                    }
                    else
                    {
                        
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк jб tem um GPS Cidade !" );
                    }
                    return 
1;
                } 
Obrigado (:


Re: GPS Sу da a localizaзгo do seu respawn - Learning - 08.03.2015

Me manda o cуdigo de onde fica armazenado o TextLocal . forward, public.. tudo .


Re: GPS Sу da a localizaзгo do seu respawn - MarlboroBr - 08.03.2015

Ai man:

PHP код:
    if( dini_Int( f( playerid ), "GPScidade" ) == 1 )
    {
        
TextLocal[ playerid ][ 0 ] = 1;
        
TextLocal[ playerid ][ 2 ] = dini_Int( f( playerid ), "StatusGPSc" );
        
CityPlayer[ playerid ] = CreatePlayerTextDraw(playerid,189.000000, 376.000000, "_");
        
PlayerTextDrawAlignment(playerid,CityPlayer[ playerid ], 2);
        
PlayerTextDrawBackgroundColor(playerid,CityPlayer[ playerid ], 255);
        
PlayerTextDrawFont(playerid,CityPlayer[ playerid ], 2);
        
PlayerTextDrawLetterSize(playerid,CityPlayer[ playerid ], 0.270000, 1.000000);
        
PlayerTextDrawColor(playerid,CityPlayer[ playerid ], -1);
        
PlayerTextDrawSetOutline(playerid,CityPlayer[ playerid ], 0);
        
PlayerTextDrawSetProportional(playerid,CityPlayer[ playerid ], 1);
        
PlayerTextDrawSetShadow(playerid,CityPlayer[ playerid ], 1);
        
PlayerTextDrawSetSelectable(playerid,CityPlayer[ playerid ], 0);
        if( 
TextLocal[ playerid ][ 2 ] == 1 )
        {
            
PlayerTextDrawShow( playerid, CityPlayer[ playerid ] );
        }
    }
    if( 
dini_Int( f( playerid ), "GPSlocal" ) == 1 )
    {
        
TextLocal[ playerid ][ 1 ] = 1;
        
TextLocal[ playerid ][ 3 ] = dini_Int( f( playerid ), "StatusGPSl" );
        
LocalPlayer[ playerid ] = CreatePlayerTextDraw(playerid,189.000000, 396.000000, "_");
        
PlayerTextDrawAlignment(playerid,LocalPlayer[ playerid ], 2);
        
PlayerTextDrawBackgroundColor(playerid,LocalPlayer[ playerid ], 255);
        
PlayerTextDrawFont(playerid,LocalPlayer[ playerid ], 2);
        
PlayerTextDrawLetterSize(playerid,LocalPlayer[ playerid ], 0.200000, 0.899999);
        
PlayerTextDrawColor(playerid,LocalPlayer[ playerid ], -1);
        
PlayerTextDrawSetOutline(playerid,LocalPlayer[ playerid ], 0);
        
PlayerTextDrawSetProportional(playerid,LocalPlayer[ playerid ], 1);
        
PlayerTextDrawSetShadow(playerid,LocalPlayer[ playerid ], 1);
        
PlayerTextDrawSetSelectable(playerid,LocalPlayer[ playerid ], 0);
        if( 
TextLocal[ playerid ][ 3 ] == 1 )
        {
            
PlayerTextDrawShow( playerid, LocalPlayer[ playerid ] );
        }
    }
    
playerGZtext( playerid );
}
forward citylocal_textplayer_update( playerid );
public 
citylocal_textplayer_update( playerid )
{
    if( 
TextLocal[ playerid ][ 0 ] == 1 && TextLocal[ playerid ][ 2 ] == 1 && pInfo[ playerid ][ pLogin ] == false || pInfo[ playerid ][ Prof ] == TAXISTA && pInfo[ playerid ][ pLogin ] == false && IsPlayerInAnyVehicle( playerid ))
    {
        new
            
Cidade[ MAX_ZONE_NAME ]
        ;
        
GetPlayerCidade( playerid, Cidade, MAX_ZONE_NAME );
        
format( gStr, 128,  "~r~~h~~h~Cidade~n~~y~~h~%s", Cidade );
        
PlayerTextDrawSetString( playerid, CityPlayer[ playerid ], gStr );
        
PlayerTextDrawShow( playerid, CityPlayer[ playerid ] );
    }
    if( 
TextLocal[ playerid ][ 1 ] == 1 && TextLocal[ playerid ][ 3 ] == 1 && pInfo[ playerid ][ pLogin ] == false || pInfo[ playerid ][ Prof ] == TAXISTA && pInfo[ playerid ][ pLogin ] == false && IsPlayerInAnyVehicle( playerid ))
    {
        new
            
zone[ MAX_ZONE_NAME ]
        ;
        
GetPlayer2DZone( playerid, zone, MAX_ZONE_NAME );
        
format( gStr, 128,  "~r~~h~~h~Local~n~~y~~h~%s", zone );
        
PlayerTextDrawSetString( playerid, LocalPlayer[ playerid ], gStr );
        
PlayerTextDrawShow( playerid, LocalPlayer[ playerid ] );
    }
    return 
1;
} 



Re: GPS Sу da a localizaзгo do seu respawn - MarlboroBr - 09.03.2015

UP !!


Re: GPS Sу da a localizaзгo do seu respawn - Lуs - 09.03.2015

PHP код:
    if( dini_Int( f( playerid ), "GPScidade" ) == 1 ) 
    { 
        
TextLocal[ playerid ][ 0 ] = 1; 
        
TextLocal[ playerid ][ 2 ] = dini_Int( f( playerid ), "StatusGPSc" ); 

        
CityPlayer[ playerid ] = CreatePlayerTextDraw(playerid,189.000000, 376.000000, "_"); 
        
PlayerTextDrawAlignment(playerid,CityPlayer[ playerid ], 2); 
        
PlayerTextDrawBackgroundColor(playerid,CityPlayer[ playerid ], 255); 
        
PlayerTextDrawFont(playerid,CityPlayer[ playerid ], 2); 
        
PlayerTextDrawLetterSize(playerid,CityPlayer[ playerid ], 0.270000, 1.000000); 
        
PlayerTextDrawColor(playerid,CityPlayer[ playerid ], -1); 
        
PlayerTextDrawSetOutline(playerid,CityPlayer[ playerid ], 0); 
        
PlayerTextDrawSetProportional(playerid,CityPlayer[ playerid ], 1); 
        
PlayerTextDrawSetShadow(playerid,CityPlayer[ playerid ], 1); 
        
PlayerTextDrawSetSelectable(playerid,CityPlayer[ playerid ], 0); 

        if( 
TextLocal[ playerid ][ 2 ] == 1 ) 
        { 
            
PlayerTextDrawShow( playerid, CityPlayer[ playerid ] ); 
            
SetTimerEx("citylocal_textplayer_update", 1000, true, "i", playerid);
        } 
    } 
    if( 
dini_Int( f( playerid ), "GPSlocal" ) == 1 ) 
    { 
        
TextLocal[ playerid ][ 1 ] = 1; 
        
TextLocal[ playerid ][ 3 ] = dini_Int( f( playerid ), "StatusGPSl" ); 

        
LocalPlayer[ playerid ] = CreatePlayerTextDraw(playerid,189.000000, 396.000000, "_"); 
        
PlayerTextDrawAlignment(playerid,LocalPlayer[ playerid ], 2); 
        
PlayerTextDrawBackgroundColor(playerid,LocalPlayer[ playerid ], 255); 
        
PlayerTextDrawFont(playerid,LocalPlayer[ playerid ], 2); 
        
PlayerTextDrawLetterSize(playerid,LocalPlayer[ playerid ], 0.200000, 0.899999); 
        
PlayerTextDrawColor(playerid,LocalPlayer[ playerid ], -1); 
        
PlayerTextDrawSetOutline(playerid,LocalPlayer[ playerid ], 0); 
        
PlayerTextDrawSetProportional(playerid,LocalPlayer[ playerid ], 1); 
        
PlayerTextDrawSetShadow(playerid,LocalPlayer[ playerid ], 1); 
        
PlayerTextDrawSetSelectable(playerid,LocalPlayer[ playerid ], 0); 

        if( 
TextLocal[ playerid ][ 3 ] == 1 ) 
        { 
            
PlayerTextDrawShow( playerid, LocalPlayer[ playerid ] ); 
            
SetTimerEx("citylocal_textplayer_update", 1000, true, "i", playerid);
        } 
    } 
    
playerGZtext( playerid ); 
} 

forward citylocal_textplayer_update( playerid ); 
public 
citylocal_textplayer_update( playerid ) 
{ 
    if( 
TextLocal[ playerid ][ 0 ] == 1 && TextLocal[ playerid ][ 2 ] == 1 && pInfo[ playerid ][ pLogin ] == false || pInfo[ playerid ][ Prof ] == TAXISTA && pInfo[ playerid ][ pLogin ] == false && IsPlayerInAnyVehicle( playerid )) 
    { 
        new 
            
Cidade[ MAX_ZONE_NAME ] 
        ; 
        
GetPlayerCidade( playerid, Cidade, MAX_ZONE_NAME ); 
        
format( gStr, 128,  "~r~~h~~h~Cidade~n~~y~~h~%s", Cidade ); 
        
PlayerTextDrawSetString( playerid, CityPlayer[ playerid ], gStr );
    } 
    if( 
TextLocal[ playerid ][ 1 ] == 1 && TextLocal[ playerid ][ 3 ] == 1 && pInfo[ playerid ][ pLogin ] == false || pInfo[ playerid ][ Prof ] == TAXISTA && pInfo[ playerid ][ pLogin ] == false && IsPlayerInAnyVehicle( playerid )) 
    { 
        new 
            
zone[ MAX_ZONE_NAME ] 
        ; 
        
GetPlayer2DZone( playerid, zone, MAX_ZONE_NAME ); 
        
format( gStr, 128,  "~r~~h~~h~Local~n~~y~~h~%s", zone ); 
        
PlayerTextDrawSetString( playerid, LocalPlayer[ playerid ], gStr ); 
    } 
    return 
1; 
} 
Nгo vi vocк adicionando ali o timer para atualizar a TextDraw. Pode ser isto.


Re: GPS Sу da a localizaзгo do seu respawn - MarlboroBr - 09.03.2015

Nooossa Lуs <3
Obrigado mano !
+Rep
@Resolvido