Jump to content

[Help] setPedStat


bebo1king

Recommended Posts

Hello,

I was trying to make CJ edit his body muscle but it dont work

My Code :

function CjCreating () 
    CJ = createPed (0,352.5,-256.29998779297,715,90) 
    setElementDimension (CJ , 200) 
     
    addPedClothes (CJ,"hawaiired","hawaii",59) 
    addPedClothes (CJ,"afrogoatee","afro",32) 
    addPedClothes (CJ,"worktrcamogrn","worktr",1) 
    addPedClothes (CJ,"bask1prowht","bask1",17) 
    addPedClothes (CJ,"neckhash","neck",4) 
    addPedClothes (CJ,"watchsub1","watch",0) 
    addPedClothes (CJ,"glasses04dark","glasses04",10) 
    addPedClothes (CJ,"capzipup","caprimup",40) 
     
    triggerServerEvent ("CJAPS",CJ,23,950) 
     
    setTimer (setPedAnimation,500,1,CJ, "BEACH", "ParkSit_M_loop") 
    setElementFrozen (CJ,true) 
  
end 
addEventHandler ("onClientResourceStart",root,CjCreating) 

Edited by Guest
Link to comment
You are using the index instead of clothing type.
addPedClothes (CJ,"hawaiired","hawaii",0) -- not 59 
-- and so on... 

i just saw it in the wiki thx

the new proBlem now in trigger its not working

-- Server

function CJAPSs(client,health) 
  setPedStat (source,client,health) 
end 
addEvent("CJAPS",true) 
addEventHandler("CJAPS",root,CJAPSs) 

Link to comment
-- CLIENT 
triggerServerEvent ("CJAPS",root,23,950) 
  
-- SERVER 
function CJAPSs(stat,value) 
  setPedStat (client,stat,value) 
end 
addEvent("CJAPS",true) 
addEventHandler("CJAPS",root,CJAPSs) 

'client' is a predefined variable. Maybe this would work.

Link to comment
You can't change the stats of the ped for the simple reason that the ped is created client-side, so the server is not aware of it.

If this what you mean :

function CjCreating () 
    CJ = createPed (0,352.5,-256.29998779297,715,90) 
    setElementDimension (CJ , 200) 
     
    addPedClothes (CJ,"tshirtmaddgrn","tshirt",0) 
    addPedClothes (CJ,"afrogoatee","afro",1) 
    addPedClothes (CJ,"worktrcamogrn","worktr",2) 
    addPedClothes (CJ,"conv","convproblk",3) 
    addPedClothes (CJ,"dogtag","neck",13) 
    addPedClothes (CJ,"watchsub1","watch",14) 
    addPedClothes (CJ,"glasses04dark","glasses04",15) 
     
    setPedStat(CJ, 23, 999) 
     
    setTimer (setPedAnimation,500,1,CJ, "BEACH", "ParkSit_M_loop") 
    setElementFrozen (CJ,true) 
  
end 
addEventHandler ("onResourceStart",root,CjCreating) 

it didn't work too

i put it in Server side now

and it still not working + no bug in debug

Link to comment
addEventHandler("onResourceStart", resourceRoot, 
function() 
    CJ = createPed(0, 352.5, -256.3, 715, 90) 
    setTimer(function() 
        setElementDimension(CJ , 200) 
        
        addPedClothes(CJ, "tshirtmaddgrn", "tshirt", 0) 
        addPedClothes(CJ, "afrogoatee", "afro", 1) 
        addPedClothes(CJ, "worktrcamogrn", "worktr", 2) 
        addPedClothes(CJ, "conv", "convproblk", 3) 
        addPedClothes(CJ, "dogtag", "neck", 13) 
        addPedClothes(CJ, "watchsub1", "watch", 14) 
        addPedClothes(CJ, "glasses04dark", "glasses04", 15) 
        
        setPedStat(CJ, 23, 999) 
        
        setPedAnimation(CJ, "BEACH", "ParkSit_M_loop") 
        setElementFrozen(CJ, true) 
    end, 500, 1) 
end) 

Link to comment
addEventHandler("onResourceStart", resourceRoot, 
function() 
    CJ = createPed(0, 352.5, -256.3, 715, 90) 
    setTimer(function() 
        setElementDimension(CJ , 200) 
        
        addPedClothes(CJ, "tshirtmaddgrn", "tshirt", 0) 
        addPedClothes(CJ, "afrogoatee", "afro", 1) 
        addPedClothes(CJ, "worktrcamogrn", "worktr", 2) 
        addPedClothes(CJ, "conv", "convproblk", 3) 
        addPedClothes(CJ, "dogtag", "neck", 13) 
        addPedClothes(CJ, "watchsub1", "watch", 14) 
        addPedClothes(CJ, "glasses04dark", "glasses04", 15) 
        
        setPedStat(CJ, 23, 999) 
        
        setPedAnimation(CJ, "BEACH", "ParkSit_M_loop") 
        setElementFrozen(CJ, true) 
    end, 500, 1) 
end) 

It worked now thank you very much TAPL

+ Thank you all for your help

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