Jump to content

HELP! Correct code


d43dr4

Recommended Posts

Hello Guys, ^^

How r yah ?

i have a code to set player stats, it works when i set just one stat

buy if i set too many stats the script stop working

The code which works :

    function changeBodyStrength ( player, commandName ) 
        if ( setPlayerStat ( player, 24, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true ) 
        end 
    end 
    addCommandHandler ( "xx", changeBodyStrength ) 

The code which not works : ( Cuz i set many stats )

    function changeBodyStrength ( player, commandName ) 
        if ( setPlayerStat ( player, 22, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true ) 
        elseif ( setPlayerStat ( player, 23, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )             
        elseif ( setPlayerStat ( player, 24, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 69, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 70, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 71, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )     
        elseif ( setPlayerStat ( player, 72, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 73, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )             
        elseif ( setPlayerStat ( player, 74, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )             
        elseif ( setPlayerStat ( player, 75, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 76, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 77, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 78, 999 ) ) then 
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        elseif ( setPlayerStat ( player, 79, 999 ) ) then        
            outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true )         
        end 
    end 
    addCommandHandler ( "xx", changeBodyStrength ) 

i hope you correct this script please ...

Link to comment
stats = 
{ 
    22, 
    23, 
    24, 
    69, 
    70, 
    71, 
    72, 
    73, 
    74, 
    75, 
    76, 
    77, 
    78, 
    79 
} 
  
function changeBodyStrength ( player ) 
    for _, stat in ipairs ( stats ) do 
        setPedStat ( player, stat, 999 ) 
    end 
    outputChatBox ( "* Your player looks really muscular", 0, 255, 0, true ) 
end 
addCommandHandler ( "xx", changeBodyStrength ) 

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