Jump to content

[Help] setPedStat


bebo1king

Recommended Posts

Posted (edited)

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

Skype :bebo.ahmad34

My channel on youtupe :

https://www.youtube.com/channel/UCOXfmMopyyBL5NBeO0RS04g/videos

Posted

You are using the index instead of clothing type.

addPedClothes (CJ,"hawaiired","hawaii",0) -- not 59 
-- and so on... 

Need a scripter? Feel free to contact me for inexpensive high-quality service!

Skype username: friedonibot

Posted
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) 

Skype :bebo.ahmad34

My channel on youtupe :

https://www.youtube.com/channel/UCOXfmMopyyBL5NBeO0RS04g/videos

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

Need a scripter? Feel free to contact me for inexpensive high-quality service!

Skype username: friedonibot

Posted
triggerServerEvent("CJAPS", CJ, 24, 999) -- 24 is Max Health, 999 the value 
  
function CJAPSs(stat, value) 
  setPedStat(source, stat, value) 
end 
  
addEvent("CJAPS",true) 
addEventHandler("CJAPS", getRootElement(), CJAPSs) 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

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.

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

Skype :bebo.ahmad34

My channel on youtupe :

https://www.youtube.com/channel/UCOXfmMopyyBL5NBeO0RS04g/videos

Posted
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) 

CiTLh.png
Posted
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

Skype :bebo.ahmad34

My channel on youtupe :

https://www.youtube.com/channel/UCOXfmMopyyBL5NBeO0RS04g/videos

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