Jump to content

help once again


mint3d

Recommended Posts

Posted

ok i have a script but when i die is dosent save my guns or my team

addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            for slot = 1, 12 do 
                setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) 
                setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerSpawn", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            setElementData ( source, "Role", role ) 
            spawnPlayer ( source, x, y, z, interior, dimension ) 
            setElementHealth ( source, health ) 
            setElementModel ( source, skin ) 
            setPlayerTeam ( source, getTeamFromName(team) ) 
            setPlayerMoney ( source, money ) 
            setPedArmor ( source, armor ) 
            for slot = 1, 12 do 
                local wep = getAccountData ( account, "save-wep".. slot ) 
                local ammo = getAccountData ( account, "save-ammo".. slot ) 
                giveWeapon ( source, wep, ammo ) 
            end 
        end 
    end 
) 
end 

Skype: Jordan_Nymph

Posted
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            for slot = 1, 12 do 
                setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) 
                setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerSpawn", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            setElementData ( source, "Role", role ) 
            spawnPlayer ( source, x, y, z, interior, dimension ) 
            setElementHealth ( source, health ) 
            setElementModel ( source, skin ) 
            setPlayerTeam ( source, getTeamFromName(team) ) 
            setPlayerMoney ( source, money ) 
            setPedArmor ( source, armor ) 
            for slot = 1, 12 do 
                local wep = getAccountData ( account, "save-wep".. slot ) 
                local ammo = getAccountData ( account, "save-ammo".. slot ) 
                giveWeapon ( source, wep, ammo ) 
            end 
        end 
    end 
) 

You had an unecessary 'end'.

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

At "onPlayerSpawn" function all of the variables aren't defined.

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

What part you don't understand?

ALL YOUR VARIABLES ARE UNDEFINED.

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

Did you save them like you did with weapons or not?

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

oh so like

setAccountData ( account, "save-team".. slot, getPedTeamName ( source, slot ) ) 

and

local team = getAccountData ( account, "save-team".. slot ) 

Skype: Jordan_Nymph

Posted

What is "slot" there for? and there's no such function: "getPedTeamName", could you please think what you are doing?

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

To get the team name use the following functions:

getPlayerTeam -- Gets the team element from a player. 
getTeamName -- Gets the team name from a team element. 

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
  
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            for slot = 1, 12 do 
                setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) 
                setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerSpawn", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            setElementData ( source, "Role", role ) 
            spawnPlayer ( source, x, y, z, interior, dimension ) 
            setElementHealth ( source, health ) 
            setElementModel ( source, skin ) 
            setPlayerTeam ( source, getTeamFromName(team) ) 
            setPlayerMoney ( source, money ) 
            setPedArmor ( source, armor ) 
            for slot = 1, 12 do 
                local wep = getAccountData ( account, "save-wep".. slot ) 
                local ammo = getAccountData ( account, "save-ammo".. slot ) 
                giveWeapon ( source, wep, ammo ) 
                local team = getPlayerTeam ( source ) 
    if ( team ) then 
        setAccountData ( account , "save-team" , getTeamName ( team ) ) 
    end 
            end 
        end 
    end 
     
) 

Skype: Jordan_Nymph

Posted
addEventHandler ( "onPlayerWasted", root,  
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            for slot = 1, 12 do 
                setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) 
                setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) 
            end 
            local team = getPlayerTeam ( source ) 
            if ( team ) then 
                setAccountData ( account, "save-team", getTeamName ( team ) ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerSpawn", root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        if ( account and not isGuestAccount ( account ) ) then 
            setElementData ( source, "Role", role ) 
            spawnPlayer ( source, x, y, z, interior, dimension ) 
            setElementHealth ( source, health ) 
            setElementModel ( source, skin ) 
            setPlayerTeam ( source, getTeamFromName(team) ) 
            setPlayerMoney ( source, money ) 
            setPedArmor ( source, armor ) 
            for slot = 1, 12 do 
                local wep = getAccountData ( account, "save-wep".. slot ) 
                local ammo = getAccountData ( account, "save-ammo".. slot ) 
                giveWeapon ( source, wep, ammo ) 
            end 
        end 
    end 
    
) 

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

It'll only save the team, it won't load 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

And how do you know that?

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

because my friend killed me and i didnt spawn in the same team

shouldn't there be something on the onplayerspawn side

Skype: Jordan_Nymph

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