Jump to content

Help x2


K4stic

Recommended Posts

1. how charge to the scale for object's be differend but only for this table

i know the code for scale is "setObjectScale ( object, scale )"

    local aObjects = 
    { 
        { "Hat 1", 2052 }, --scale 1 
        { "Hat 2", 2053 }, --scale 1 
        { "Hat 3", 2054 }, --scale 1 
        { "Grass Hat", 861 },--scale 0.9 
        { "Grass Hat 2", 862 }, --scale 0.9 
        { "Flag hat", 2993 }, --scale 1 
        { "Pizza Box hat", 2814 }, --scale 1 
        { "Roulete hat", 1895 }, --scale 0.8 
        { "Ventilator hat", 1661 }, --scale 0.8 
        { "Model car hat", 2485 }, --scale 1 
    }; 

2. how fix this to refresh blip's?

says warning on "getElementAttachedTo"

function updateBlipColor ( player ) 
    local attachedblip = getElementAttachedTo ( player ) 
    if ( attachedblip ) then 
        local r,g,b = getTeamColor ( getPlayerTeam( player ) ) 
        setBlipColor(blip, r,g,b, 255) 
    end 
end 

Link to comment

1) As far as I know clothing cannot be scaled as it is not an actual object.

2) Small errors:

    function updateBlipColor ( player ) 
        local attachedblip = getElementAttachedTo ( player ) 
        if ( attachedblip ) then 
            local r,g,b = getTeamColor ( getPlayerTeam( player ) ) 
            setBlipColor(attachedblip, r,g,b, 255) 
        end 
    end 

Make sure your calling this function...

Link to comment

no work

here full code

local playerBlipRoot = createElement("playerBlipRoot", "playerBlipRoot") 
  
function resourceStart() 
    for _, player in ipairs(getElementsByType("player")) do 
        if player ~= localPlayer then 
            local r,g,b = getTeamColor(getPlayerTeam(player)) 
            local blip = createBlipAttachedTo(player, 0, 2, r,g,b, 255, 1) 
            setElementParent(blip, playerBlipRoot) 
        end 
    end 
end 
addEventHandler("onClientResourceStart", root, resourceStart) 
  
function playerJoin() 
    local r,g,b = getTeamColor(getPlayerTeam(source)) 
    local blip = createBlipAttachedTo(source, 0, 2, r,g,b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) 
end 
addEventHandler("onClientPlayerJoin", root, playerJoin) 
  
function playerQuit() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
function updateBlipColor ( player ) 
        local attachedblip = getElementAttachedTo ( player ) 
        if ( attachedblip ) then 
            local r,g,b = getTeamColor ( getPlayerTeam( player ) ) 
            setBlipColor(attachedblip, r,g,b, 255) 
        end 
    end 
  
--setTimer(updateBlipColor, 1000, 0) 
  

Link to comment

It says in Wiki :

[ createBlibAttchedTo ]

( When using optional arguments, you must supply all arguments before the one you wish to use ),

You didn't in lines 7 and 16 !!

+

local blib is repeated twice, You should try making it out of the function body !!

i don't no if what i'm saying is right, but i hope so :D ..

Link to comment

Here try this one :

  
local playerBlipRoot = createElement( "playerBlipRoot", "playerBlipRoot" ) 
  
  
addEventHandler("onClientResourceStart", root,  
    function resourceStart() 
        for _, player in ipairs( getElementsByType ( "player" ) ) do 
            if player == localPlayer then 
                local r,g,b = getTeamColor( getPlayerTeam ( player ) ) 
                local blip = createBlipAttachedTo( player, 0, 2, r,g,b, 255, 1 ) 
                setElementParent(blip, playerBlipRoot) 
            end 
        end 
    end 
) 
  
function playerJoin() 
    local r,g,b = getTeamColor(getPlayerTeam(source)) 
    local blip = createBlipAttachedTo(source, 0, 2, r,g,b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) 
end 
addEventHandler("onClientPlayerJoin", root, playerJoin) 
  
function playerQuit() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
function updateBlipColor ( player ) 
        local attachedblip = getElementAttachedTo ( player ) 
        if ( attachedblip ) then 
            local r,g,b = getTeamColor ( getPlayerTeam( player ) ) 
            setBlipColor(attachedblip, r,g,b, 255) 
        end 
    end 
  
setTimer( updateBlipColor, 1000, 0 ) 
  

Link to comment
Here try this one :

  
local playerBlipRoot = createElement( "playerBlipRoot", "playerBlipRoot" ) 
  
  
addEventHandler("onClientResourceStart", root,  
    function resourceStart() 
        for _, player in ipairs( getElementsByType ( "player" ) ) do 
            if player == localPlayer then 
                local r,g,b = getTeamColor( getPlayerTeam ( player ) ) 
                local blip = createBlipAttachedTo( player, 0, 2, r,g,b, 255, 1 ) 
                setElementParent(blip, playerBlipRoot) 
            end 
        end 
    end 
) 
  
function playerJoin() 
    local r,g,b = getTeamColor(getPlayerTeam(source)) 
    local blip = createBlipAttachedTo(source, 0, 2, r,g,b, 255, 1) 
    setElementParent(blip, playerBlipRoot) 
    setTimer(updateBlipColor, 1500, 1, blip) 
end 
addEventHandler("onClientPlayerJoin", root, playerJoin) 
  
function playerQuit() 
    for _, blip in ipairs(getElementChildren(playerBlipRoot)) do 
        if getElementAttachedTo(blip) == source then 
            destroyElement(blip) 
        end 
    end 
end 
addEventHandler("onClientPlayerQuit", root, playerQuit) 
  
function updateBlipColor ( player ) 
        local attachedblip = getElementAttachedTo ( player ) 
        if ( attachedblip ) then 
            local r,g,b = getTeamColor ( getPlayerTeam( player ) ) 
            setBlipColor(attachedblip, r,g,b, 255) 
        end 
    end 
  
setTimer( updateBlipColor, 1000, 0 ) 
  

Line 6

function resourceStart() 

should be

function () 

Link to comment
local aObjectsName = { 
    [ "Hat 1" ] = createObject ( 2052, x, y, z ), 
    [ "Hat 2" ] = createObject ( 2053, x, y, z ), 
    [ "Hat 3" ] = createObject ( 2054, x, y, z ), 
    [ "Grass Hat" ] = createObject ( 861, x, y, z ), 
    [ "Grass Hat 2" ] = createObject ( 862, x, y, z ), 
    [ "Flag hat" ] = createObject ( 2993, x, y, z ), 
    [ "Pizza Box hat" ] = createObject ( 2814, x, y, z ), 
    [ "Roulete hat" ] = createObject ( 1895, x, y, z ),  
    [ "Ventilator hat" ] = createObject ( 1661, x, y, z ), 
    [ "Model car hat" ] = createObject ( 2485, x, y, z ), 
}; 
     
local aObjectsScale = {  
    { aObjectsName [ "Hat 1" ], 1 }, 
    { aObjectsName [ "Hat 2" ], 5 }, 
    { aObjectsName [ "Hat 3" ], 10 }, 
    { aObjectsName [ "Grass Hat" ], 0.9 }, 
    { aObjectsName [ "Grass Hat 2" ], 0.9 }, 
    { aObjectsName [ "Flag hat" ], 1 }, 
    { aObjectsName [ "Pizza Box hat" ], 1 }, 
    { aObjectsName [ "Roulete hat" ], 0.8 }, 
    { aObjectsName [ "Ventilator hat" ], 0.8 }, 
    { aObjectsName [ "Model car hat" ], 1 }, 
}; 
  
for _, v in ipairs ( aObjectsScale ) do 
    setObjectScale ( v[1], v[2] ) 
end; 

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