How to make these different colours
#1

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

They are objects. You cannot change the color of them.
Reply
#3

This one server has done it.

P:LA // Project: Los Angeles
Reply
#4

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

so for the FDL it would be

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

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

Can someone help me fix this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)