Search the Community
Showing results for tags 'setaccountdata'.
-
function comprarbandito ( thePlayer, command) local playeraccount = getPlayerAccount ( source ) takePlayerMoney ( thePlayer, 500000 ) setAccountData ( playeraccount, "rc.bandito", adquirido ) end addCommandHandler ( "comprarbandito", comprarbandito ) function Banditoadquirido (_, playeraccount ) if ( playeraccount ) then local ban = getAccountData ( playeraccount, "rc.bandito" ) if ( ban ) then Banditocomprado = true end end end addEvent ( "banditobuyed", true ) addEventHandler ( "banditobuyed", getRootElement(), Banditoadquirido ) This function takes 500000 dollars to give a player permission to use a RC Bandito in a gui (Like in GTA Online) but, when i put the command "comprarbandito" Bad argument @ getplayeraccount, got nil, i never used getplayeraccount or setplayeraccount, and i don't know if the other function (Banditoadquirido) will work
- 1 reply
-
- setaccountdata
- script
-
(and 3 more)
Tagged with:
-
Quando o usuário se desconectar eu quero que isto seja feito. addEventHandler('onPlayerQuit', root, function() local account = getPlayerAccount(source) setAccountData(account, 'vehitem', true) end) isso para quando o usuário logar novamente e fazer uma ação em específico essa verificação funcionar: local accsalvo = getPlayerAccount(source) if getAccountData(accsalvo, 'vehitem') then exports._infobox:addNotification(source, 'funcionou', 'warning') else exports._infobox:addNotification(source, 'não funcionou', 'warning') end só que ela sempre retorna false, como se o setAccountData fosse ignorado, e agora?
- 9 replies
-
- setaccountdata
- não funciona
-
(and 1 more)
Tagged with:
-
This is the code: function onPlayerQuit ( thePlayer) local playeraccount = getPlayerAccount ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local nametagszin = getPlayerNametagColor ( thePlayer ) setAccountData ( playeraccount, "ntszin", nametagszin ) end end end function onPlayerLogin (_, playeraccount ) local playeraccount = getPlayerAccount ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if ( playeraccount ) then local nametagszin = getAccountData ( playeraccount, "ntszin" ) if ( nametagszin ) then setPlayerNametagColor ( thePlayer, r, g, b ) end end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) No error(s)/warning(s) in debugscript 3.. What wrong?
-
Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.