PashaBiceps Posted April 1, 2019 Share Posted April 1, 2019 Hi guys, im trying save some data onPlayerLogin, Quit, Resource Start and Stop but without success. Whats is wrong? I got an error. Thanks in Advance for any help attempt to call upvalue 'playerTraficante' (a table value) -- > ERROR function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local trabalhotr = playerTraficante ( source ) local ax = playerAx ( source ) local coca = playerCoca ( source ) local bagulho = playerBagulho ( source ) local IngAx1 = playerIngAx1 ( source ) local IngAx2 = playerIngAx2 ( source ) local IngCoca1 = playerIngCoca1 ( source ) local IngCoca2 = playerIngCoca2 ( source ) local IngCoca3 = playerIngCoca3 ( source ) local sementes = playerSementes ( source ) setAccountData ( playeraccount, "trabalhotr", trabalhotr ) setAccountData ( playeraccount, "droga.ax", ax ) setAccountData ( playeraccount, "droga.coca", coca ) setAccountData ( playeraccount, "droga.maconha", bagulho ) setAccountData ( playeraccount, "droga.ingax1", IngAx1 ) setAccountData ( playeraccount, "droga.ingax2", IngAx2 ) setAccountData ( playeraccount, "droga.ingcoca1", IngCoca1 ) setAccountData ( playeraccount, "droga.ingcoca2", IngCoca2 ) setAccountData ( playeraccount, "droga.ingcoca3", IngCoca3 ) setAccountData ( playeraccount, "droga.sementes", sementes ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local trabalhotr = getAccountData ( playeraccount, "trabalhotr" ) local ax = getAccountData ( playeraccount, "droga.ax" ) local coca = getAccountData ( playeraccount, "droga.coca" ) local bagulho = getAccountData ( playeraccount, "droga.maconha" ) local IngAx1 = getAccountData ( playeraccount, "droga.ingax1" ) local IngAx2 = getAccountData ( playeraccount, "droga.ingax2" ) local IngCoca1 = getAccountData ( playeraccount, "droga.ingcoca1" ) local IngCoca2 = getAccountData ( playeraccount, "droga.ingcoca2" ) local IngCoca3 = getAccountData ( playeraccount, "droga.ingcoca3" ) local sementes = getAccountData ( playeraccount, "droga.sementes" ) if ( trabalhotr ) then setAccountData ( source, trabalhotr ) end if ( ax ) then setAccountData ( source, ax ) end if ( coca ) then setAccountData ( source, coca ) end if ( bagulho ) then setAccountData ( source, bagulho ) end if ( IngAx1 ) then setAccountData ( source, IngAx1 ) end if ( IngAx2 ) then setAccountData ( source, IngAx2 ) end if ( IngCoca1 ) then setAccountData ( source, IngCoca1 ) end if ( IngCoca2 ) then setAccountData ( source, IngCoca2 ) end if ( IngCoca3 ) then setAccountData ( source, IngCoca3 ) end if ( sementes ) then setAccountData ( source, sementes ) end end end addEventHandler ( "onResourceStop", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onResourceStart", getRootElement ( ), onPlayerLogin ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Moderators IIYAMA Posted April 1, 2019 Moderators Share Posted April 1, 2019 playerTraficante = {} Is a table, tables can't be called. playerTraficante ( ) Only functions can be called. The reason why it is table instead of a function is unknown to me. Please ask the one that created the script for the reason why. Or if it is created by yourself, then ask yourself the same question. Also it might be handy to inspect the table first. iprint(playerTraficante) It might give you information about how to use it. 53 minutes ago, GodKraken said: Thanks in Advance for any help 1 Link to comment
PashaBiceps Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) 9 hours ago, IIYAMA said: É uma tabela, tabelas não podem ser chamadas. jogadorTraficante () Apenas funções podem ser chamadas. A razão pela qual é tabela em vez de uma função é desconhecida para mim. Por favor, pergunte ao que criou o script pelo motivo. Ou se for criado por você mesmo, então pergunte a si mesmo a mesma pergunta. Também pode ser útil inspecionar a tabela primeiro. Pode dar informações sobre como usá-lo. It's my own script, i used tables on Global Locals like this and a lot of many. local playerBagulho = {}; I will try use something like that to see if it works local traficante = playerTraficante(); Edited April 2, 2019 by GodKraken Link to comment
PashaBiceps Posted April 2, 2019 Author Share Posted April 2, 2019 41 minutes ago, GodKraken said: It's my own script, i used tables on Global Locals like this and a lot of many. local playerBagulho = {}; I will try use something like that to see if it works local traficante = playerTraficante(); Without Success, probably i need change all my script. Don't have another way to save this data from local tables? Thanks for helping me Link to comment
Moderators IIYAMA Posted April 2, 2019 Moderators Share Posted April 2, 2019 1 hour ago, GodKraken said: Without Success, probably i need change all my script. Don't have another way to save this data from local tables? Thanks for helping me Saving??????? This is about loading! Maybe you use it like this: local trabalhotr = playerTraficante[source] I have 0% knowledge about your system. You should know that better than me. 1 Link to comment
PashaBiceps Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) 17 minutes ago, IIYAMA said: Saving??????? This is about loading! Maybe you use it like this: local trabalhotr = playerTraficante[source] I have 0% knowledge about your system. You should know that better than me. Omg, i just can be idiot haha I already done my script, but instead of call the exact data, i was calling the tables ! Thanks a lot Edited April 2, 2019 by GodKraken 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now