1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Force playermodel color on certain jobs?

Discussion in 'DarkRP Modding Questions & Help' started by jackpm_, Jan 6, 2017.

  1. jackpm_

    jackpm_ New Member

    Is there a way to force a playermodel color on certain jobs? I want to have 2 squads of gangsters, one red and one blue. Is there a way to force this or do I have to get specific modded playermodels?
     
  2. System

    System Active Member

    Code (Text):
    local function SetColor( ply, color )
        ply:SetPlayerColor( Vector( color.r/255, color.g/255, color.b/255 ) )
    end
    However I suggest to use 2 playermodels cause most models dont have a proper setup for colorizing.
     
  3. jackpm_

    jackpm_ New Member

    Where do I put this function? In the job with the description, model, etc.? And I'm assuming I fill color.r, etc. with the RGB values? Are there are any other variables I need to fill in?
     
  4. MaccyD

    MaccyD Member

    this could be one way of doing it, not sure how it would work when you change job though :?

    You would put this in the job
    Code (Text):

    PlayerSpawn = function(ply)
               local color = Color(255,150,250) -- Set Color Here
               ply:SetPlayerColor( Vector( color.r/255, color.g/255, color.b/255 ) )
            end
     
    to make sure it changes back to default color use this
    Code (Text):

    PlayerSpawn = function(ply)
               local color = Color(255,150,250) -- Set Color Here
               ply:SetPlayerColor( Vector( color.r/255, color.g/255, color.b/255 ) )
            end
    PlayerDeath = function(ply)
               ply:SetPlayerColor( Vector( 1,1,1 ) )
            end
     
     
  5. jackpm_

    jackpm_ New Member

    Code (Text):
    TEAM_BLOODSBOSS = DarkRP.createJob("Bloods Boss", {
        color = Color(137, 5, 5, 255),
        model = "models/player/gman_high.mdl",
        description = [[You control the Bloods Gang.
        Use your unarrest baton to break your gang members out of prison.
        Use your lockpick to organize heists.
       
        Mug = Yes
        Raid = Yes
        Carjack = Yes
        Steal = Yes]],
        weapons = {"lockpick", "unarrest_stick", "fas2_ragingbull",},
        command = "bloodsboss",
        max = 1,
        salary = 20,
        admin = 0,
        vote = false,
        hasLicense = false,
        candemote = true,
        category = "Bloods Gang",
        PlayerSpawn = function(ply)
               local color = Color(255,0,0) -- Set Color Here
               ply:SetPlayerColor( Vector( color.r/255, color.g/255, color.b/255 ) )
            end
        PlayerDeath = function(ply)
               ply:SetPlayerColor( Vector( 1,1,1 ) )
            end
    })
    Am I doing this correctly? It doesn't seem to like it. I get this error, line number 163 is TEAM_BLOODSBOSS, and line 187 is PlayerDeath...

    Code (Text):
    [ERROR] Lua is unable to understand file "darkrp_customthings/jobs.lua" because its author made a mistake around line number 187.
    The best help I can give you is this:

    There is an opening '{' bracket at line 163, but this bracket is never closed or not closed in time. It was expected to be closed before the 'PlayerDeath' at line 187.

    Hints:
            - Did you forget a comma?
            - All open brackets ({, (, [) must have a matching closing bracket. Are you sure it's there?
            - Brackets must be opened and closed in the right order. This will work: ({}), but this won't: ({)}.

    ------- End of Simplerr error -------

      1. error - [C]:-1
       2. doInclude - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
        3. loadCustomDarkRPItems - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:137
         4. Call - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:148
          5. unknown - gamemodes/darkrp/gamemode/init.lua:108

    Couldn't Load Init Script: 'darkrp/gamemode/init.lua'
     
  6. MaccyD

    MaccyD Member


    Code (Text):

    TEAM_BLOODSBOSS = DarkRP.createJob("Bloods Boss", {
        color = Color(137, 5, 5, 255),
        model = "models/player/gman_high.mdl",
        description = [[You control the Bloods Gang.
        Use your unarrest baton to break your gang members out of prison.
        Use your lockpick to organize heists.
       
        Mug = Yes
        Raid = Yes
        Carjack = Yes
        Steal = Yes]],
        weapons = {"lockpick", "unarrest_stick", "fas2_ragingbull",},
        command = "bloodsboss",
        max = 1,
        salary = 20,
        admin = 0,
        vote = false,
        hasLicense = false,
        candemote = true,
        category = "Bloods Gang",
        PlayerSpawn = function(ply)
               local color = Color(255,0,0) -- Set Color Here
               ply:SetPlayerColor( Vector( color.r/255, color.g/255, color.b/255 ) )
            end, -- comma here
        PlayerDeath = function(ply)
               ply:SetPlayerColor( Vector( 1,1,1 ) )
            end, -- comma here for good practice (end of job)
    })
     
     

Share This Page