[Pedido] Checar a cor do carro em textdrawn
#1

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
Reply
#2

Crie uma include com o seguinte cуdigo

PHP код:
/*
        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
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by Mises
Посмотреть сообщение
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.
Reply
#5

Quote:
Originally Posted by NelsonC
Посмотреть сообщение
Crie uma include com o seguinte cуdigo

PHP код:
/*
        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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)