Jump to content

not giveWeapon and animation in table


Kenix

Recommended Posts

Posted

Another problem with the tables this time harder.

do not want giveWeapon and setPedAnimation.

there are no errors in any "chatBox" debug works please tell me how to fix this problem :(

  
PedsPos = { 
{120,2779.4453125,-2407.8173828125,13.635701179504,180.54383850098},  
{135,2762.865234375,-2535.6484375,13.637379646301,127.07803344727}, 
{78,2762.845703125,-2537.8515625,13.636841773987,35.659423828125}, 
{79,2761.3046875,-2537.7509765625,13.634307861328,323.5166015625}, 
{200,2757.439453125,-2535.2880859375,13.637376785278,262.62942504883}, 
{118,2788.2470703125,-2507.21484375,13.640826225281,179.83520507813,30,300,"ped","IDLE_chat"} 
  
} 
  
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function( ) 
        for i,w in ipairs( PedsPos ) do 
            outputChatBox(""..i ) 
            ped[i] = createPed(w[1],w[2],w[3],w[4]) -- so it's good 
            setPedRotation(ped[i],w[5]) -- good 
            if ( i == 6 ) then  
                outputChatBox( " It's the 6th ped ") 
                giveWeapon(ped[6],tonumber(PedsPos[i][6]),tonumber(PedsPos[i][7]), true) -- not give weapon 
                setPedAnimation( ped[6], PedsPos[6][8],PedsPos[6][9] )  -- not setPedAnimation 
                outputChatBox("Weapon and animation" )  
            end 
            setPedFrozen(ped[i], true ) 
            setElementData(ped[i],"ndmg",true) 
        end  
    end 
) 
  

Posted
PedsPos = { 
{120,2779.4453125,-2407.8173828125,13.635701179504,180.54383850098}, 
{135,2762.865234375,-2535.6484375,13.637379646301,127.07803344727}, 
{78,2762.845703125,-2537.8515625,13.636841773987,35.659423828125}, 
{79,2761.3046875,-2537.7509765625,13.634307861328,323.5166015625}, 
{200,2757.439453125,-2535.2880859375,13.637376785278,262.62942504883}, 
{118,2788.2470703125,-2507.21484375,13.640826225281,179.83520507813,30,300,"ped","IDLE_chat"} 
  
} 
   
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function( ) 
    ped = {} 
        for i,w in ipairs( PedsPos ) do 
            outputChatBox(""..i ) 
            ped[i] = createPed(w[1],w[2],w[3],w[4]) -- so it's good 
            setPedRotation(ped[i],w[5]) -- good 
            if ( i == 6 ) then 
                outputChatBox( " It's the 6th ped ") 
                setTimer(giveWeapon, 1000, 1, ped[6], tonumber(PedsPos[6][6]), tonumber(PedsPos[6][7]), true) -- not give weapon 
                setTimer(setPedAnimation, 1000, 1, ped[6], PedsPos[6][8],PedsPos[6][9] )  -- not setPedAnimation 
                outputChatBox("Weapon and animation" ) 
            end 
            setPedFrozen(ped[i], true ) 
            setElementData(ped[i],"ndmg",true) 
        end 
    end 
) 

Posted
PedsPos = { 
{120,2779.4453125,-2407.8173828125,13.635701179504,180.54383850098}, 
{135,2762.865234375,-2535.6484375,13.637379646301,127.07803344727}, 
{78,2762.845703125,-2537.8515625,13.636841773987,35.659423828125}, 
{79,2761.3046875,-2537.7509765625,13.634307861328,323.5166015625}, 
{200,2757.439453125,-2535.2880859375,13.637376785278,262.62942504883}, 
{118,2788.2470703125,-2507.21484375,13.640826225281,179.83520507813,30,300,"ped","IDLE_chat"} 
  
} 
   
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function( ) 
    ped = {} 
        for i,w in ipairs( PedsPos ) do 
            outputChatBox(""..i ) 
            ped[i] = createPed(w[1],w[2],w[3],w[4]) -- so it's good 
            setPedRotation(ped[i],w[5]) -- good 
            if ( i == 6 ) then 
                outputChatBox( " It's the 6th ped ") 
                setTimer(giveWeapon, 1000, 1, ped[6], tonumber(PedsPos[6][6]), tonumber(PedsPos[6][7]), true) -- not give weapon 
                setTimer(setPedAnimation, 1000, 1, ped[6], PedsPos[6][8],PedsPos[6][9] )  -- not setPedAnimation 
                outputChatBox("Weapon and animation" ) 
            end 
            setPedFrozen(ped[i], true ) 
            setElementData(ped[i],"ndmg",true) 
        end 
    end 
) 

works only after restarting the resource.

Posted

What do you mean? i added a timer as you can see, also the missing ped table, wait 1 second after restarting the resource, then it will start playing the animation and give him an Ak-47.

Posted
What do you mean? i added a timer as you can see, also the missing ped table, wait 1 second after restarting the resource, then it will start playing the animation and give him an Ak-47.

know it but it works only after restarting the resource.

Posted

know it but it works only after restarting the resource.

it is the way it supposed to work

script [re]loads on [re]starting resource

  • Moderators
Posted

So try to use this function setElementStreamable and turn it to false

And when a player join, then apply the animation to this ped

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