Jump to content

getPlayerAccount and other problems


DRW

Recommended Posts

Posted

It says it expects an element on getPlayerAccount, so it doesn't detect the source as a the player, what can I do?

addEventHandler ("onPlayerLogin",root, 
function() 
setTimer(function() 
    if not (isGuestAccount (getPlayerAccount (source))) then 
        local account = getPlayerAccount (source) 
        if (account) then 
            setAccountData (account, "zmgm.money", tostring (getPlayerMoney (source))) 
            setAccountData (account, "zmgm.skin", tostring (getPedSkin (source))) 
            setAccountData (account, "zmgm.health", tostring (getElementHealth (source))) 
            setAccountData (account, "zmgm.armor", tostring (getPedArmor (source))) 
            setAccountData (account, "zmgm.weaponID0", getPedWeapon (source, 0)) 
            setAccountData (account, "zmgm.weaponID1", getPedWeapon (source, 1)) 
            setAccountData (account, "zmgm.weaponID2", getPedWeapon (source, 2)) 
            setAccountData (account, "zmgm.weaponID3", getPedWeapon (source, 3)) 
            setAccountData (account, "zmgm.weaponID4", getPedWeapon (source, 4)) 
            setAccountData (account, "zmgm.weaponID5", getPedWeapon (source, 5)) 
            setAccountData (account, "zmgm.weaponID6", getPedWeapon (source, 6)) 
            setAccountData (account, "zmgm.weaponID7", getPedWeapon (source, 7)) 
            setAccountData (account, "zmgm.weaponID8", getPedWeapon (source, -- s8) -->) 
            setAccountData (account, "zmgm.weaponID9", getPedWeapon (source, 9)) 
            setAccountData (account, "zmgm.weaponID10", getPedWeapon (source, 10)) 
            setAccountData (account, "zmgm.weaponID11", getPedWeapon (source, 11)) 
            setAccountData (account, "zmgm.weaponID12", getPedWeapon (source, 12)) 
            setAccountData (account, "zmgm.weaponAmmo0", getPedTotalAmmo (source, 0)) 
            setAccountData (account, "zmgm.weaponAmmo1", getPedTotalAmmo (source, 1)) 
            setAccountData (account, "zmgm.weaponAmmo2", getPedTotalAmmo (source, 2)) 
            setAccountData (account, "zmgm.weaponAmmo3", getPedTotalAmmo (source, 3)) 
            setAccountData (account, "zmgm.weaponAmmo4", getPedTotalAmmo (source, 4)) 
            setAccountData (account, "zmgm.weaponAmmo5", getPedTotalAmmo (source, 5)) 
            setAccountData (account, "zmgm.weaponAmmo6", getPedTotalAmmo (source, 6)) 
            setAccountData (account, "zmgm.weaponAmmo7", getPedTotalAmmo (source, 7)) 
            setAccountData (account, "zmgm.weaponAmmo8", getPedTotalAmmo (source,8)) 
            setAccountData (account, "zmgm.weaponAmmo9", getPedTotalAmmo (source, 9)) 
            setAccountData (account, "zmgm.weaponAmmo10", getPedTotalAmmo (source, 10)) 
            setAccountData (account, "zmgm.weaponAmmo11", getPedTotalAmmo (source, 11)) 
            setAccountData (account, "zmgm.weaponAmmo12", getPedTotalAmmo (source, 12)) 
            setAccountData (account, "zmgm.skill0", getPedStat ( source, 69 )) 
            setAccountData (account, "zmgm.skill1", getPedStat ( source, 70 )) 
            setAccountData (account, "zmgm.skill2", getPedStat ( source, 71 )) 
            setAccountData (account, "zmgm.skill3", getPedStat ( source, 72 )) 
            setAccountData (account, "zmgm.skill4", getPedStat ( source, 73 )) 
            setAccountData (account, "zmgm.skill5", getPedStat ( source, 74 )) 
            setAccountData (account, "zmgm.skill6", getPedStat ( source, 75 )) 
            setAccountData (account, "zmgm.skill7", getPedStat ( source, 76 )) 
            setAccountData (account, "zmgm.skill8", getPedStat ( source, 77 )) 
            setAccountData (account, "zmgm.skill9", getPedStat ( source, 78 )) 
            setAccountData (account, "zmgm.skill10", getPedStat ( source, 79 )) 
        end 
        end 
    end,10000,0) 
  
end) 
  
  
  

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

it should be like this

addEventHandler ("onPlayerLogin",root, 
    function(_,acc) 
        setTimer(function(player) 
        if (acc) then 
            setAccountData (acc, "zmgm.money", tostring (getPlayerMoney (player))) 
            setAccountData (acc, "zmgm.skin", tostring (getPedSkin (player))) 
            setAccountData (acc, "zmgm.health", tostring (getElementHealth (player))) 
            setAccountData (acc, "zmgm.armor", tostring (getPedArmor (player))) 
            setAccountData (acc, "zmgm.weaponID0", getPedWeapon (player, 0)) 
            setAccountData (acc, "zmgm.weaponID1", getPedWeapon (player, 1)) 
            setAccountData (acc, "zmgm.weaponID2", getPedWeapon (player, 2)) 
            setAccountData (acc, "zmgm.weaponID3", getPedWeapon (player, 3)) 
            setAccountData (acc, "zmgm.weaponID4", getPedWeapon (player, 4)) 
            setAccountData (acc, "zmgm.weaponID5", getPedWeapon (player, 5)) 
            setAccountData (acc, "zmgm.weaponID6", getPedWeapon (player, 6)) 
            setAccountData (acc, "zmgm.weaponID7", getPedWeapon (player, 7)) 
            setAccountData (acc, "zmgm.weaponID8", getPedWeapon (player, -- s8) -->) 
            setAccountData (acc, "zmgm.weaponID9", getPedWeapon (player, 9)) 
            setAccountData (acc, "zmgm.weaponID10", getPedWeapon (player, 10)) 
            setAccountData (acc, "zmgm.weaponID11", getPedWeapon (player, 11)) 
            setAccountData (acc, "zmgm.weaponID12", getPedWeapon (player, 12)) 
            setAccountData (acc, "zmgm.weaponAmmo0", getPedTotalAmmo (player, 0)) 
            setAccountData (acc, "zmgm.weaponAmmo1", getPedTotalAmmo (player, 1)) 
            setAccountData (acc, "zmgm.weaponAmmo2", getPedTotalAmmo (player, 2)) 
            setAccountData (acc, "zmgm.weaponAmmo3", getPedTotalAmmo (player, 3)) 
            setAccountData (acc, "zmgm.weaponAmmo4", getPedTotalAmmo (player, 4)) 
            setAccountData (acc, "zmgm.weaponAmmo5", getPedTotalAmmo (player, 5)) 
            setAccountData (acc, "zmgm.weaponAmmo6", getPedTotalAmmo (player, 6)) 
            setAccountData (acc, "zmgm.weaponAmmo7", getPedTotalAmmo (player, 7)) 
            setAccountData (acc, "zmgm.weaponAmmo8", getPedTotalAmmo (player,8)) 
            setAccountData (acc, "zmgm.weaponAmmo9", getPedTotalAmmo (player, 9)) 
            setAccountData (acc, "zmgm.weaponAmmo10", getPedTotalAmmo (player, 10)) 
            setAccountData (acc, "zmgm.weaponAmmo11", getPedTotalAmmo (player, 11)) 
            setAccountData (acc, "zmgm.weaponAmmo12", getPedTotalAmmo (player, 12)) 
            setAccountData (acc, "zmgm.skill0", getPedStat ( player, 69 )) 
            setAccountData (acc, "zmgm.skill1", getPedStat ( player, 70 )) 
            setAccountData (acc, "zmgm.skill2", getPedStat ( player, 71 )) 
            setAccountData (acc, "zmgm.skill3", getPedStat ( player, 72 )) 
            setAccountData (acc, "zmgm.skill4", getPedStat ( player, 73 )) 
            setAccountData (acc, "zmgm.skill5", getPedStat ( player, 74 )) 
            setAccountData (acc, "zmgm.skill6", getPedStat ( player, 75 )) 
            setAccountData (acc, "zmgm.skill7", getPedStat ( player, 76 )) 
            setAccountData (acc, "zmgm.skill8", getPedStat ( player, 77 )) 
            setAccountData (acc, "zmgm.skill9", getPedStat ( player, 78 )) 
            setAccountData (acc, "zmgm.skill10", getPedStat ( player, 79 )) 
        end 
    end,10000,0,source) 
end) 
  

BTW many things wrong in your code.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

It expects ped at getPedAmmo, getPedStats and getPedWeapon

BTW many things wrong in your code.

What's wrong?

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
It expects ped at getPedAmmo, getPedStats and getPedWeapon

What's wrong?

As i told you there is many things wrong .

timesToExecute must be 1 not 0.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
It expects ped at getPedAmmo, getPedStats and getPedWeapon

What's wrong?

As i told you there is many things wrong .

timesToExecute must be 1 not 0.

But I want it to repeat it every 10000ms or 30000, not only one time

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

you can't do it with "onPlayerLogin" event.

try to use sth like this

-- Example 
  
function yourFunctionName() 
    local players = getElementsByType ( "player" ) 
    for i , v in ipairs(players) do 
    -- Your code here 
    end  
end  
-- setTimer here 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
you can't do it with "onPlayerLogin" event.

try to use sth like this

-- Example 
  
function yourFunctionName() 
    local players = getElementsByType ( "player" ) 
    for i , v in ipairs(players) do 
    -- Your code here 
    end  
end  
-- setTimer here 

Still not working, tried almost everything and had to stay with the original save-system, people in my server is getting angry because their weapons won't save sometimes.

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

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