SA-MP Forums Archive
How to make these different colours - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make these different colours (/showthread.php?tid=348458)



How to make these different colours - sanplayer - 05.06.2012

pawn Код:
CMD:pdl(playerid, params[])
{
    if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 1)
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
            SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            return 1;
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                    return 1;
                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s Put's a Police Siren on their vehicle", sendername);
                 ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 0)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
                    return 1;
                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s Takes the Police Siren Down.", sendername);
                ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /pdl [type]");
                SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            }
        }
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
}

CMD:fdl(playerid, params[])
{
    if(PlayerInfo[playerid][pMember] == 4)
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
            SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            return 1;
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                    return 1;
                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s Put's a Fire Dept Siren on their vehicle.", sendername);
                 ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 0)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
                    return 1;
                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s Takes the Fire Dept Light Down.", sendername);
                ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /pdl [type]");
                SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            }
        }
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
}

CMD:adl(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 2)
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
            SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            return 1;
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                    return 1;
                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s Put's a Admin Light on their vehicle.", sendername);
                 ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 0)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
                    return 1;
                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s Takes the Admin Light Down.", sendername);
                ProxDetector(40.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /pdl [type]");
                SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = On, 2 = Off.");
            }
        }
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
}
How do I make:

PDL = Blue light

FDL = Red light

ADL = Green light

-----

The spinning light


Re: How to make these different colours - Edward156 - 05.06.2012

They are objects. You cannot change the color of them.


Re: How to make these different colours - sanplayer - 05.06.2012

This one server has done it.

P:LA // Project: Los Angeles


Re: How to make these different colours - FalconX - 05.06.2012

Quote:
Originally Posted by Edward156
Посмотреть сообщение
They are objects. You cannot change the color of them.
Umm, there is another way of doing that:-

pawn Код:
SetObjectMaterial( objectid, materialindex, modelid, txdname[], texturename[], materialcolor );
You can use this function to replace the texture of an object with the texture from another model in the game. Important Note: You MUST use ARGB color format, not RGBA like used in client messages etc.

https://sampwiki.blast.hk/wiki/SetObjectMaterial

or you can do this for individual players.

pawn Код:
SetPlayerObjectMaterial( playerid, objectid, materialindex, modelid, txdname[], texturename[], materialcolor );
https://sampwiki.blast.hk/wiki/SetPlayerObjectMaterial

Hope this helps
FalconX


Re: How to make these different colours - sanplayer - 05.06.2012

so for the FDL it would be

pawn Код:
SetObjectMaterial(FDL, 0, 18646, "Red FDL Light", "Red FDL Light", 0xDF0101AA);
For the red spinning light?


Re: How to make these different colours - sanplayer - 05.06.2012

It says I put a light on my vehicle but it doesnt show.

Can someone help me fix this?