SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 12/03/2018, 07:39 PM   #1
HostedPlayerss
Little Clucker
 
HostedPlayerss's Avatar
 
Join Date: Feb 2017
Posts: 32
Reputation: 4
Default Checar a cor do carro em textdraw

Bom eu fiz um velocimetro e nesse velocimetro eu coloquei um Preview_Model pra ver qual e o carro que o player esta mas só que não checa a cor do veiculo tipo vai uma cor aleatória se alguém pudesse passar uma base de como fazer pra checar a cor do carro eu ficaria grato
__________________

Last edited by HostedPlayerss; 13/03/2018 at 05:48 PM.
HostedPlayerss is offline   Reply With Quote
Old 12/03/2018, 07:47 PM   #2
NelsonC
Big Clucker
 
NelsonC's Avatar
 
Join Date: Oct 2017
Location: Germany
Posts: 134
Reputation: 9
Default Re: Checar a cor do carro em textdrawn

Crie uma include com o seguinte código

PHP Code:
/*
        SA-MP "GetVehicleColor 0.3.7" Include by Ryder
        Update version by DarkLouis`
*/

#if defined _Included_GetVehicleColor
        #endinput
#endif

#define _Included_GetVehicleColor

#define PROPERTY_OFFSET(%0) \
        
((((%0) * ((%0) << 1)) << 2) + 65536)

stock n_AddStaticVehicle(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID AddStaticVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_AddStaticVehicleEx(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2respawn_Delaysirena 0)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID AddStaticVehicleEx(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delaysirena);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_CreateVehicle(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2respawn_Delaysirena 0)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID CreateVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delaysirena);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_DestroyVehicle(vehicleID)
{
        
deleteproperty(_""PROPERTY_OFFSET(vehicleID));

        return 
DestroyVehicle(vehicleID);
}

stock n_ChangeVehicleColor(vehicleIDcolor1color2)
{
        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(vehicleID), colorStr);

        return 
ChangeVehicleColor(vehicleIDcolor1color2);
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(vehicleid), colorStr);

        if(
funcidx("n_OnVehicleRespray") != -1)
        {
                return 
CallLocalFunction("n_OnVehicleRespray""iiii"playeridvehicleidcolor1color2);
        }
        return 
1;
}

stock GetVehicleColor(vehicleID, &color1, &color2)
{
        
vehicleID PROPERTY_OFFSET(vehicleID);

        if(
existproperty(_""vehicleID))
        {
                new
                        
colorStr[24],
                        
strPos
                
;
                
getproperty(_""vehicleIDcolorStr);
                
strunpack(colorStrcolorStr);

                if((
strPos strfind(colorStr"-")) != -1)
                {
                        
color1 strval(colorStr);
                        
color2 strval(colorStr[strPos 1]);
                        return 
1;
                }
        }
        return 
0;
}

#if defined _ALS_CreateVehicle
    #undef CreateVehicle
#else
    #define _ALS_CreateVehicle
#endif

#if defined _ALS_AddStaticVehicle
    #undef AddStaticVehicle
#else
    #define _ALS_AddStaticVehicle
#endif

#if defined _ALS_AddStaticVehicleEx
    #undef AddStaticVehicleEx
#else
    #define _ALS_AddStaticVehicleEx
#endif

#if defined _ALS_DestroyVehicle
    #undef DestroyVehicle
#else
    #define _ALS_DestroyVehicle
#endif

#define AddStaticVehicle n_AddStaticVehicle
#define AddStaticVehicleEx n_AddStaticVehicleEx
#define CreateVehicle n_CreateVehicle
#define DestroyVehicle n_DestroyVehicle
#define ChangeVehicleColor n_ChangeVehicleColor

#if defined _ALS_OnVehicleRespray
        #undef OnVehicleRespray
#else
        #define _ALS_OnVehicleRespray
#endif

#define OnVehicleRespray n_OnVehicleRespray

forward n_OnVehicleRespray(playeridvehicleidcolor1color2); 
e use a função GetVehicleColor
NelsonC is offline   Reply With Quote
Old 12/03/2018, 11:28 PM   #3
Mises
Little Clucker
 
Join Date: Dec 2017
Posts: 28
Reputation: 9
Default Re: Checar a cor do carro em textdrawn

Não consigo te ajudar, não sei o que significa Textdrawn e não consegui ler o problema porque só interpreto textos da 6° série em diante.
Mises is offline   Reply With Quote
Old 13/03/2018, 04:36 PM   #4
HostedPlayerss
Little Clucker
 
HostedPlayerss's Avatar
 
Join Date: Feb 2017
Posts: 32
Reputation: 4
Default Re: Checar a cor do carro em textdrawn

Quote:
Originally Posted by Mises View Post
Não consigo te ajudar, não sei o que significa Textdrawn e não consegui ler o problema porque só interpreto textos da 6° série em diante.
E porque veio citar no topico? se você não sabe como me ajudar tinha fechado a aba e não querer vim dar uma de fodão.
__________________
HostedPlayerss is offline   Reply With Quote
Old 13/03/2018, 04:46 PM   #5
HostedPlayerss
Little Clucker
 
HostedPlayerss's Avatar
 
Join Date: Feb 2017
Posts: 32
Reputation: 4
Default Re: Checar a cor do carro em textdrawn

Quote:
Originally Posted by NelsonC View Post
Crie uma include com o seguinte código

PHP Code:
/*
        SA-MP "GetVehicleColor 0.3.7" Include by Ryder
        Update version by DarkLouis`
*/

#if defined _Included_GetVehicleColor
        #endinput
#endif

#define _Included_GetVehicleColor

#define PROPERTY_OFFSET(%0) \
        
((((%0) * ((%0) << 1)) << 2) + 65536)

stock n_AddStaticVehicle(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID AddStaticVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_AddStaticVehicleEx(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2respawn_Delaysirena 0)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID AddStaticVehicleEx(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delaysirena);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_CreateVehicle(modelIDFloatspawn_XFloatspawn_YFloatspawn_ZFloatz_Anglecolor1color2respawn_Delaysirena 0)
{
        if(
color1 || color2 0)
        {
                
color1 random(255);
                
color2 random(255);
        }
        
modelID CreateVehicle(modelIDspawn_Xspawn_Yspawn_Zz_Anglecolor1color2respawn_Delaysirena);

        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(modelID), colorStr);

        return 
modelID;
}

stock n_DestroyVehicle(vehicleID)
{
        
deleteproperty(_""PROPERTY_OFFSET(vehicleID));

        return 
DestroyVehicle(vehicleID);
}

stock n_ChangeVehicleColor(vehicleIDcolor1color2)
{
        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(vehicleID), colorStr);

        return 
ChangeVehicleColor(vehicleIDcolor1color2);
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
        new
                
colorStr[24]
        ;
        
format(colorStrsizeof(colorStr), "%d-%d"color1color2);
        
setproperty(_""PROPERTY_OFFSET(vehicleid), colorStr);

        if(
funcidx("n_OnVehicleRespray") != -1)
        {
                return 
CallLocalFunction("n_OnVehicleRespray""iiii"playeridvehicleidcolor1color2);
        }
        return 
1;
}

stock GetVehicleColor(vehicleID, &color1, &color2)
{
        
vehicleID PROPERTY_OFFSET(vehicleID);

        if(
existproperty(_""vehicleID))
        {
                new
                        
colorStr[24],
                        
strPos
                
;
                
getproperty(_""vehicleIDcolorStr);
                
strunpack(colorStrcolorStr);

                if((
strPos strfind(colorStr"-")) != -1)
                {
                        
color1 strval(colorStr);
                        
color2 strval(colorStr[strPos 1]);
                        return 
1;
                }
        }
        return 
0;
}

#if defined _ALS_CreateVehicle
    #undef CreateVehicle
#else
    #define _ALS_CreateVehicle
#endif

#if defined _ALS_AddStaticVehicle
    #undef AddStaticVehicle
#else
    #define _ALS_AddStaticVehicle
#endif

#if defined _ALS_AddStaticVehicleEx
    #undef AddStaticVehicleEx
#else
    #define _ALS_AddStaticVehicleEx
#endif

#if defined _ALS_DestroyVehicle
    #undef DestroyVehicle
#else
    #define _ALS_DestroyVehicle
#endif

#define AddStaticVehicle n_AddStaticVehicle
#define AddStaticVehicleEx n_AddStaticVehicleEx
#define CreateVehicle n_CreateVehicle
#define DestroyVehicle n_DestroyVehicle
#define ChangeVehicleColor n_ChangeVehicleColor

#if defined _ALS_OnVehicleRespray
        #undef OnVehicleRespray
#else
        #define _ALS_OnVehicleRespray
#endif

#define OnVehicleRespray n_OnVehicleRespray

forward n_OnVehicleRespray(playeridvehicleidcolor1color2); 
e use a função GetVehicleColor
vlw cara, ajudou muito
__________________
HostedPlayerss is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[DUVIDA] Como Criar CARRO (/carro) Em interior davidjnio Português/Portuguese 43 23/09/2015 06:47 PM
[Ajuda] Imagem de carro em TextDrawn minimessi10 Português/Portuguese 1 11/09/2013 04:08 PM
[Ajuda] Textdrawn Lucas-Fc Português/Portuguese 0 06/12/2012 12:19 AM
TextDrawn '-' CanTLoGin Português/Portuguese 1 18/09/2011 03:13 PM
TextDrawn IuLyAnBoSs Română/Romanian 3 10/07/2011 05:08 PM


All times are GMT. The time now is 03:30 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.