Jump to content

Bad Argument @ 'setPlayerNametagColor'


SoiiNoob

Recommended Posts

  
    local pickups = { 
        [createMarker ( 1605.1868896484, -1619.2677001953, 12.6, "cylinder", 1, 0, 0, 255, 170 )] = {weapons = {[25] = 200, [22] = 255, [3] = 1}, skin = 288, armor = 0, color = 0, 0, 255} 
    } 
      
    addEventHandler("onResourceStart",resourceRoot, 
        function () 
            for marker, markers in pairs">pairs(pickups) do 
                addEventHandler( "onMarkerHit", marker, policemarker ) 
            end 
        end 
    ) 
      
    function policemarker (hitElement, matchingDimension) 
        local elementType = getElementType( hitElement ) 
        if (elementType == "player") then 
            local pickup = pickups[source] 
            setPlayerNametagColor ( hitElement, pickup.color) 
            setElementModel ( hitElement, pickup.skin ) 
            setPlayerTeam ( hitElement, teampolice) 
            takeAllWeapons ( hitElement ) 
            for weapon, ammo in pairs">pairs(pickup.weapons) do 
                giveWeapon ( hitElement, weapon, ammo, true ) 
            end 
            setPedArmor ( hitElement, pickup.armor ) 
        end 
    end 

I want to set my colour name to blue when i hit the marker, but it says " Bad Argument @ 'setPlayerNametagColor' " , any help ? :S

Link to comment

that syntax is wrong: { color = 0, 0, 255 } that way color is 0, and other values are just other values.

so when you do setPlayerNametagColor there are not enough arguments.

try using "color = {0, 0, 255}" and then "setPlayerNametagColor ( hitElement, unpack(pickup.color))"

Link to comment

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...