Jump to content

Nametag Problem.


Vigo.K

Recommended Posts

Posted

Greetings.

I have problem with Nametag.

I'm using MTA: Paradise Role-Play gamemode.

Okay, I made one script, when I'm using: /duty, then player Nametag changes its color.

Here is script:

addCommandHandler( "duty", 
    function( thePlayer, commandName, r, g, b ) 
        if exports.players:isLoggedIn( thePlayer ) then 
            local inPD, factionID, factionName, factionTag = exports.factions:isPlayerInFactionType( thePlayer, 2 ) 
            if inPD and factionTag then 
                giveWeapon ( thePlayer, 41, 500 ) 
                setElementHealth ( thePlayer, 100 ) 
                setPlayerNametagColor ( thePlayer, 176, 0, 0 ) 
            end 
        end 
    end 
) 

But, when I'm using: /duty its changes to red color, but after 3-5 seconds it's back on white color.

Could you guys please, with your smart brains help me? :roll::roll:

Thanks anyway, waiting your answers. <3

656386733.png

____________________________________________

Posted

Maybe paradise game mode has something on it doing that, search in every script from it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Maybe paradise game mode has something on it doing that, search in every script from it.

Probably that knot is here...

Script:

local function updateNametagColor( player ) 
    local nametagColor = { 127, 127, 127, priority = 0 } 
    if p[ player ] and isLoggedIn( player ) then 
        nametagColor = { 255, 255, 255, priority = 0 } 
        if getOption( player, "staffduty" ) then 
            for key, value in ipairs( groups ) do 
                if isObjectInACLGroup( "user." .. p[ player ].username, aclGetGroup( value.aclGroup ) ) and value.nametagColor then 
                    if value.priority > nametagColor.priority then 
                        nametagColor = value.nametagColor 
                        nametagColor.priority = value.priority 
                    end 
                end 
            end 
        end 
    end 
    setPlayerNametagColor( player, unpack( nametagColor ) ) 
end 

656386733.png

____________________________________________

Posted

Hm, you could try to export the updateNametagColor function in the meta.xml, and let it update the color itself. (but I don't know if it would set the color you want)

Maybe you should put all the changes your script does into the paradise gamemode, it could prevent a lot of work for you.

Learn Lua - Learn to script - GUI scripting

Scripter tools - Find/fix errors yourself(!)

Don't pm me for scripting help, keep it for the Scripting subforum!

Posted

updateNametagColor calls for a getOption and setOption function, i tried working with your system but it's a little complicated when it comes to PRP's getOption and setOption

addCommandHandler( "duty", 
    function( thePlayer, commandName ) 
        if exports.players:isLoggedIn( thePlayer ) then 
            if isPlayerInFactionType( thePlayer, 1 ) then 
                if getElementData(thePlayer, "dutyOn") == true then 
                    takeWeapon( thePlayer, 41 ) 
                    setPedArmor( thePlayer, 0 ) 
                    setPlayerNametagColor( thePlayer, 255, 255, 255 ) 
                    outputChatBox("You are no longer on duty.", thePlayer, 255, 255, 255 ) 
                    setElementData(thePlayer, "dutyOn", false) 
                else 
                    giveWeapon( thePlayer, 41, 500 ) 
                    setPedArmor( thePlayer, 100 ) 
                    setPlayerNametagColor( thePlayer, 0, 0, 255 ) 
                    outputChatBox("You are now on duty.", thePlayer, 255, 255, 255 ) 
                    setElementData(thePlayer, "dutyOn", true) 
                end 
            end 
        end 
    end 
) 

Is how far I got with it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...