[Include] GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011]
#42

Hello there. I changed things for the 0.3.7 samp version (for siren function). With the official include, I had problems using siren to the cars, and it gived me "warning 202: number of arguments does not match definition". Now I fixed all. Watch out for the include modified by me for the 0.3.7 version.

pawn Код:
/*
            SA-MP "GetVehicleColor v2.1" Include
            Copyright © 2011 RyDeR`
    */

     
    #if defined _Included_GetVehicleColor
            #endinput
    #endif
     
    #define _Included_GetVehicleColor
     
    #define PROPERTY_OFFSET(%0) \
            ((((%0) * ((%0) << 1)) << 2) + 65536)
     
    stock n_AddStaticVehicle(modelID, Float: spawn_X, Float: spawn_Y, Float: spawn_Z, Float: z_Angle, color1, color2)
    {
            if(color1 < 0 || color2 < 0)
            {
                    color1 = random(127);
                    color2 = random(127);
            }
            modelID = AddStaticVehicle(modelID, spawn_X, spawn_Y, spawn_Z, z_Angle, color1, color2);
           
            new
                    colorStr[24]
            ;      
            format(colorStr, sizeof(colorStr), "%d-%d", color1, color2);
            setproperty(_, "", PROPERTY_OFFSET(modelID), colorStr);
           
            return modelID;
    }
     
    stock n_AddStaticVehicleEx(modelID, Float: spawn_X, Float: spawn_Y, Float: spawn_Z, Float: z_Angle, color1, color2, respawn_Delay, addsiren = 0)
    {
            if(color1 < 0 || color2 < 0)
            {
                    color1 = random(127);
                    color2 = random(127);
            }
            modelID = AddStaticVehicleEx(modelID, spawn_X, spawn_Y, spawn_Z, z_Angle, color1, color2, respawn_Delay, addsiren);
           
            new
                    colorStr[24]
            ;      
            format(colorStr, sizeof(colorStr), "%d-%d", color1, color2);
            setproperty(_, "", PROPERTY_OFFSET(modelID), colorStr);
           
            return modelID;
    }
     
    stock n_CreateVehicle(modelID, Float: spawn_X, Float: spawn_Y, Float: spawn_Z, Float: z_Angle, color1, color2, respawn_Delay, addsiren = 0)
    {
            if(color1 < 0 || color2 < 0)
            {
                    color1 = random(127);
                    color2 = random(127);
            }
            modelID = CreateVehicle(modelID, spawn_X, spawn_Y, spawn_Z, z_Angle, color1, color2, respawn_Delay, addsiren);
           
            new
                    colorStr[24]
            ;      
            format(colorStr, sizeof(colorStr), "%d-%d", color1, color2);
            setproperty(_, "", PROPERTY_OFFSET(modelID), colorStr);
           
            return modelID;
    }
     
    stock n_DestroyVehicle(vehicleID)
    {
            deleteproperty(_, "", PROPERTY_OFFSET(vehicleID));
           
            return DestroyVehicle(vehicleID);
    }
     
    stock n_ChangeVehicleColor(vehicleID, color1, color2)
    {
            new
                    colorStr[24]
            ;      
            format(colorStr, sizeof(colorStr), "%d-%d", color1, color2);
            setproperty(_, "", PROPERTY_OFFSET(vehicleID), colorStr);
           
            return ChangeVehicleColor(vehicleID, color1, color2);
    }
     
    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
            new
                    colorStr[24]
            ;      
            format(colorStr, sizeof(colorStr), "%d-%d", color1, color2);
            setproperty(_, "", PROPERTY_OFFSET(vehicleid), colorStr);
           
            if(funcidx("n_OnVehicleRespray") != -1)
            {
                    return CallLocalFunction("n_OnVehicleRespray", "iiii", playerid, vehicleid, color1, color2);
            }
            return 1;
    }
     
    stock GetVehicleColor(vehicleID, &color1, &color2)
    {
            vehicleID = PROPERTY_OFFSET(vehicleID);
           
            if(existproperty(_, "", vehicleID))
            {
                    new
                            colorStr[24],
                            strPos
                    ;
                    getproperty(_, "", vehicleID, colorStr);
                    strunpack(colorStr, colorStr);
                   
                    if((strPos = strfind(colorStr, "-")) != -1)
                    {
                            color1 = strval(colorStr);
                            color2 = strval(colorStr[strPos + 1]);
                            return 1;
                    }
            }
            return 0;
    }
     
    #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(playerid, vehicleid, color1, color2);
Reply


Messages In This Thread
GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by RyDeR` - 05.03.2011, 16:14
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by [L3th4l] - 05.03.2011, 16:16
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 05.03.2011, 16:17
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by verti4cal - 07.03.2011, 12:40
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Strong_ADM - 23.03.2011, 01:00
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Stigg - 23.03.2011, 06:58
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Venice - 23.03.2011, 07:15
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Tee - 20.04.2011, 18:48
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by [03]Garsino - 20.04.2011, 18:53
Respuesta: GetVehicleColor v2.0 [Update 5'th March 2011] - by [DOG]irinel1996 - 05.06.2011, 16:47
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by tbedy - 05.06.2011, 18:10
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 05.06.2011, 21:10
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Jay_ - 05.06.2011, 21:12
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 06.06.2011, 10:26
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Scenario - 07.06.2011, 13:18
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 07.06.2011, 14:55
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by TheAntonioRHCP - 10.06.2011, 10:54
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 10.06.2011, 10:57
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by FANEX - 04.07.2011, 18:55
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by Desertsoulz - 20.07.2011, 18:45
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by [WSF]ThA_Devil - 02.08.2011, 08:59
Re: GetVehicleColor v2.0 [Update 5'th March 2011] - by RyDeR` - 02.08.2011, 10:23
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by [WSF]ThA_Devil - 02.08.2011, 11:43
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Laronic - 02.08.2011, 12:03
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Scenario - 02.08.2011, 14:04
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by RyDeR` - 06.08.2011, 12:40
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by titanak - 02.10.2011, 13:20
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Zonoya - 01.11.2011, 17:29
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Zonoya - 01.11.2011, 17:51
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by RyDeR` - 01.11.2011, 18:12
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by titanak - 02.12.2011, 16:12
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by clavador - 16.02.2012, 12:24
Respuesta: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by [Nikk] - 16.02.2012, 13:25
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Hanger - 01.05.2012, 16:50
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Jonny5 - 01.05.2012, 17:21
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by VincentDunn - 01.05.2012, 22:54
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Stgnature - 27.02.2014, 16:03
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Guest4390857394857 - 05.03.2014, 15:34
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by amirm3hdi - 02.05.2015, 00:37
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by ihatetn931 - 02.05.2015, 19:17
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by amirm3hdi - 15.05.2015, 02:37
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by DarK_FeneR - 25.06.2016, 09:34
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Dokins - 09.10.2016, 15:22
Re: GetVehicleColor v2.1 [NEW UPDATE - 02/08/2011] - by Primes007 - 28.12.2017, 13:30

Forum Jump:


Users browsing this thread: 3 Guest(s)