-
Posts
101 -
Joined
-
Last visited
Posts posted by carlos eduardo
-
-
tem como tu botar um objeto em cima do carro, só n sei se da para fazer ele seguir perfeitinho assim
-
-
function DestroyVeiculo (veh, seat) if getElementData(veh, "starter_pack") == true and seat == 0 then if isTimer(vehicleElements[veh]) then killTimer(vehicleElements[veh]) end destroyElement(veh) end end addEventHandler ("onPlayerLogout", getRootElement(), DestroyVeiculo) addEventHandler ("onPlayerQuit", getRootElement(), DestroyVeiculo) addEventHandler ("onPlayerWasted", getRootElement(), DestroyVeiculo) addEventHandler ("onPlayerBan", getRootElement(), DestroyVeiculo) addEventHandler ("onPlayerDie", getRootElement(), DestroyVeiculo)
-
-
getElementData é dos dois lado
-
ja tens a função de criar o veiculo?
-
Não lembro, mas que eu me lembe setar no "setElementData" ele só salva enquanto o player esta logado, ao reiniciar perde a data do element
OBS:Não tenho certeza
edit: Voce está setando os dados no element na linha 19 e 20, e quando o player loga voce ta tentando puxar o AccountData do player na linha 39 e 40
-
1 hour ago, Lord Henry said:
Sim. Se já tiver o arquivo da animação dai fica tranquilo. Mas como criar o arquivo .ifp
https://www.mixmods.com.br/2015/11/tutorial-trocar-animacoes-entre-ifps.html, esse aqui mostra como trocar uma animação, como criar o arquivo eu não sei
EDIT:Achei um tutorial que fala como criar uma animação para o gta, http://brmodstudio.forumeiros.com/t4010-como-criar-uma-animacao-pra-gta-sa-ifp-tutorial-completo, só não sei se esse tutorial funciona pois não fiz ele.
- 1
-
-
tem um script de dança do fortnite, da para tu ver o script
-
45 minutes ago, Luccas said:
Não funcionou mano
no meu não ia, mas tirei todos os mods foi, ta dando interferencia com algum script
-
18 hours ago, Luccas said:
Sim, mais o problema de não salvar nenhuma arma vai arrumar todas? Ou só da AK-47?
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) if getAccountData (theCurrentAccount, "funmodev2-weapons") then local weaponData = fromJSON (getAccountData (account, "funmodev2-weapons")) -- Converte a string JSON em uma table. for i=1, 46 do -- Para cada ID de arma, faça: (seria do 0 ao 46, mas não precisa obter a mão do jogador) if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então: giveWeapon (source, i, weaponData[tostring(i)]) -- Os índices da table JSON sempre são em string. end end end setCameraTarget (source) fadeCamera (source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0, 78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source) fadeCamera (source, true, 2.0) end end end addEventHandler ("onPlayerLogin", root, playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", root, onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x, y, z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) local ammo = {} for i=0,12 do --Weapon Slots for k=1,46 do --Weapon IDs (seria do 0 ao 46, mas não precisa obter a mão do jogador, arma 0.) if getPedWeapon (source, i) == k then ammo[k] = getPedTotalAmmo (source, i) end end end setAccountData (account, "funmodev2-weapons", toJSON ( { ammo[1], ammo[2], ammo[3], ammo[4], ammo[5], ammo[6], ammo[7], ammo[8], ammo[9], ammo[10], ammo[11], ammo[12], ammo[13], ammo[14], ammo[15], ammo[16], ammo[17], ammo[18], ammo[19], ammo[20], ammo[21], ammo[22], ammo[23], ammo[24], ammo[25], ammo[26], ammo[27], ammo[28], ammo[29], ammo[30], ammo[31], ammo[32], ammo[33], ammo[34], ammo[35], ammo[36], ammo[37], ammo[38], ammo[39], ammo[40], ammo[41], ammo[42], ammo[43], ammo[44], ammo[45], ammo[46] } )) end end end addEventHandler ("onPlayerQuit", root, onQuit) function onWasted (totalAmmo, killer, killerWeapon, bodypart, stealth) if not (isGuestAccount (getPlayerAccount(source))) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", root, onWasted)
É esse o script, bota no server-side que ta funcionando com todas armas
-
Se tu ja baixou esse script da uma olhada na linha onde chama ele, pois uso no meu server e as vezes da uns bug na mensagem
-
Just now, Lord Henry said:
Por isso que é importante fazer o que eu digo.
Sim, mas antes eu falei que tinha desligado e desliguei, mas por algum motivo nao foi.Só com esse teu codigo novo foi
-
Just now, DNL291 said:
A propósito, percebi que tem um loop de todas armas dentro do loop dos slots, isso poderia ser simplificado assim:
local weapons = {} for slot=0, 12 do local weapon = getPedWeapon(player, slot) local ammo = getPedTotalAmmo(player, slot) weapons[weapon] = ammoend
Já que cada slot é reservado para determinadas armas, exemplo: Slot 2 > pistola, desert e pistola silenciosa. Mas com esse loop vai percorrer todos ids ignorando essa definição do jogo.
Eu vou continuar com esse script, pois não sou tão bom em criar uns complexos.Melhor eu deixar ele assim ^^
Pode ja fechar o topico se quiser eu acho
-
9 minutes ago, DNL291 said:
Se puder nos mostre aqui o que estava impedindo o save de funcionar, isso pode ajudar outras pessoas caso tenham esse tipo de conflito também.
@carlos eduardo
eu peguei um codigo da net de save system, e com a ajuda do Lord ele criou um sistema melhor de salvar as armas e tambem eu tive que desativar meu painelLogin(não sei o motivo de conflito deles)
Codigo:
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) if getAccountData (theCurrentAccount, "funmodev2-weapons") then local weaponData = fromJSON (getAccountData (account, "funmodev2-weapons")) -- Converte a string JSON em uma table. for i=1, 46 do -- Para cada ID de arma, faça: (seria do 0 ao 46, mas não precisa obter a mão do jogador) if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então: giveWeapon (source, i, weaponData[tostring(i)]) -- Os índices da table JSON sempre são em string. end end end setCameraTarget (source) fadeCamera (source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0, 78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source) fadeCamera (source, true, 2.0) end end end addEventHandler ("onPlayerLogin", root, playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", root, onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x, y, z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) local ammo = {} for i=0,12 do --Weapon Slots for k=1,46 do --Weapon IDs (seria do 0 ao 46, mas não precisa obter a mão do jogador, arma 0.) if getPedWeapon (source, i) == k then ammo[k] = getPedTotalAmmo (source, i) end end end setAccountData (account, "funmodev2-weapons", toJSON ( { ammo[1], ammo[2], ammo[3], ammo[4], ammo[5], ammo[6], ammo[7], ammo[8], ammo[9], ammo[10], ammo[11], ammo[12], ammo[13], ammo[14], ammo[15], ammo[16], ammo[17], ammo[18], ammo[19], ammo[20], ammo[21], ammo[22], ammo[23], ammo[24], ammo[25], ammo[26], ammo[27], ammo[28], ammo[29], ammo[30], ammo[31], ammo[32], ammo[33], ammo[34], ammo[35], ammo[36], ammo[37], ammo[38], ammo[39], ammo[40], ammo[41], ammo[42], ammo[43], ammo[44], ammo[45], ammo[46] } )) end end end addEventHandler ("onPlayerQuit", root, onQuit) function onWasted (totalAmmo, killer, killerWeapon, bodypart, stealth) if not (isGuestAccount (getPlayerAccount(source))) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", root, onWasted) function setTeam () local account = getPlayerAccount (source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName (team) then setPlayerTeam (source, getTeamFromName (team)) -- sets players team end end addEventHandler ("onPlayerLogin", root, setTeam) -- sets players team on login function save() local team = getPlayerTeam (source) -- Gets the players team local account = getPlayerAccount (source) if (team) and not isGuestAccount (account) then -- Checks to see if the player is a guest or not setAccountData (account, "team", getTeamName (team)) --saves team end end addEventHandler ("onPlayerQuit", root, save) -- saves team on quit
EDIT:Se o Lord permitir eu posso criar um winrar do script para te mandar.
- 1
-
O problema era o painel de login
-
É erro com algum script mesmo, tirou todos e foi, vou testando de um em um para ver qual ta interferindo
1 minute ago, carlos eduardo said:É erro com algum script mesmo, tirou todos e foi, vou testando de um em um para ver qual ta interferindo
vou botar os scripts de um em um
-
Resetei todas as datas e n foi
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) if getAccountData (theCurrentAccount, "funmodev2-weapons") then local weaponData = fromJSON (getAccountData (account, "funmodev2-weapons")) -- Converte a string JSON em uma table. for i=1, 46 do -- Para cada ID de arma, faça: (seria do 0 ao 46, mas não precisa obter a mão do jogador) if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então: giveWeapon (source, i, weaponData[tostring(i)]) -- Os índices da table JSON sempre são em string. end end end setCameraTarget (source) fadeCamera (source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0, 78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source) fadeCamera (source, true, 2.0) end end end addEventHandler ("onPlayerLogin", root, playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", root, onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x, y, z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) local ammo = {} for i=0,12 do --Weapon Slots for k=1,46 do --Weapon IDs (seria do 0 ao 46, mas não precisa obter a mão do jogador, arma 0.) if getPedWeapon (source, i) == k then ammo[k] = getPedTotalAmmo (source, i) end end end setAccountData (account, "funmodev2-weapons", toJSON ( { ammo[1], ammo[2], ammo[3], ammo[4], ammo[5], ammo[6], ammo[7], ammo[8], ammo[9], ammo[10], ammo[11], ammo[12], ammo[13], ammo[14], ammo[15], ammo[16], ammo[17], ammo[18], ammo[19], ammo[20], ammo[21], ammo[22], ammo[23], ammo[24], ammo[25], ammo[26], ammo[27], ammo[28], ammo[29], ammo[30], ammo[31], ammo[32], ammo[33], ammo[34], ammo[35], ammo[36], ammo[37], ammo[38], ammo[39], ammo[40], ammo[41], ammo[42], ammo[43], ammo[44], ammo[45], ammo[46] } )) end end end addEventHandler ("onPlayerQuit", root, onQuit) function onWasted (totalAmmo, killer, killerWeapon, bodypart, stealth) if not (isGuestAccount (getPlayerAccount(source))) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", root, onWasted) function setTeam () local account = getPlayerAccount (source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName (team) then setPlayerTeam (source, getTeamFromName (team)) -- sets players team end end addEventHandler ("onPlayerLogin", root, setTeam) -- sets players team on login function save() local team = getPlayerTeam (source) -- Gets the players team local account = getPlayerAccount (source) if (team) and not isGuestAccount (account) then -- Checks to see if the player is a guest or not setAccountData (account, "team", getTeamName (team)) --saves team end end addEventHandler ("onPlayerQuit", root, save) -- saves team on quit
-
resetei toda o internal, vou agora adicionar os mods para criar as datas e testar
-
3 minutes ago, DNL291 said:
Parece ter algo errado nesta linha:
if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então:
Está convertendo 'i' para string, e se não constar na chave a referência como uma string irá falhar a verificação. Tente removendo o tostring.
Vou tentar fazer aquilo que falei e dps se n der eu tento isso
-
3 minutes ago, Lord Henry said:
Cara, isso não é possível. Deve ter algum resource entrando em conflito. Aqui funciona perfeitamente.
Vou fazer um backup do server sem o save-system e depois botar ele, é que ja botei um monte de safe-system pq n funcionavam
-
4 minutes ago, Lord Henry said:
É pq vc precisa iniciar o resource com o jogador logado e depois sair do servidor pra ele criar essa data.
ja tem a data, mas mesmo assim nao da arma
-
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) if getAccountData (theCurrentAccount, "funmodev2-weapons") then local weaponData = fromJSON (getAccountData (account, "funmodev2-weapons")) -- Converte a string JSON em uma table. for i=1, 46 do -- Para cada ID de arma, faça: (seria do 0 ao 46, mas não precisa obter a mão do jogador) if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então: giveWeapon (source, i, weaponData[tostring(i)]) -- Os índices da table JSON sempre são em string. end end end setCameraTarget (source) fadeCamera (source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0, 78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source) fadeCamera (source, true, 2.0) end end end addEventHandler ("onPlayerLogin", root, playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", root, onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x, y, z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) local ammo = {} for i=0,12 do --Weapon Slots for k=1,46 do --Weapon IDs (seria do 0 ao 46, mas não precisa obter a mão do jogador, arma 0.) if getPedWeapon (source, i) == k then ammo[k] = getPedTotalAmmo (source, i) end end end setAccountData (account, "funmodev2-weapons", toJSON ( { ammo[1], ammo[2], ammo[3], ammo[4], ammo[5], ammo[6], ammo[7], ammo[8], ammo[9], ammo[10], ammo[11], ammo[12], ammo[13], ammo[14], ammo[15], ammo[16], ammo[17], ammo[18], ammo[19], ammo[20], ammo[21], ammo[22], ammo[23], ammo[24], ammo[25], ammo[26], ammo[27], ammo[28], ammo[29], ammo[30], ammo[31], ammo[32], ammo[33], ammo[34], ammo[35], ammo[36], ammo[37], ammo[38], ammo[39], ammo[40], ammo[41], ammo[42], ammo[43], ammo[44], ammo[45], ammo[46] } )) end end end addEventHandler ("onPlayerQuit", root, onQuit) function onWasted (totalAmmo, killer, killerWeapon, bodypart, stealth) if not (isGuestAccount (getPlayerAccount(source))) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", root, onWasted) function setTeam () local account = getPlayerAccount (source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName (team) then setPlayerTeam (source, getTeamFromName (team)) -- sets players team end end addEventHandler ("onPlayerLogin", root, setTeam) -- sets players team on login function save() local team = getPlayerTeam (source) -- Gets the players team local account = getPlayerAccount (source) if (team) and not isGuestAccount (account) then -- Checks to see if the player is a guest or not setAccountData (account, "team", getTeamName (team)) --saves team end end addEventHandler ("onPlayerQuit", root, save) -- saves team on quit
esse é o codigo
3 minutes ago, DNL291 said:Mostre o seu código completo, vai ficar mais fácil pra ajudar.
-
Não esta indo, mas acho que sei o erro mas n sei como arrumar
if getAccountData (theCurrentAccount, "funmodev2-weapons") then
aqui ta pedindo uma data que não existe no codigo
-
6 minutes ago, Lord Henry said:
Troque o previousAcc por account
O codigo ficou assim, mas nao da as armas, mesmo não aparecendo nada no /debugscript 3
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) if getAccountData (currentAcc, "funmodev2-weapons", account) then local weaponData = fromJSON (getAccountData (account, "funmodev2-weapons")) -- Converte a string JSON em uma table. for i=1, 46 do -- Para cada ID de arma, faça: (seria do 0 ao 46, mas não precisa obter a mão do jogador) if weaponData[tostring(i)] then -- Se existe o ID "i" de arma na table, então: giveWeapon (source, i, weaponData[tostring(i)]) -- Os índices da table JSON sempre são em string. end end end setCameraTarget (source, source) fadeCamera(source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0,78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0)) setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1)) setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2)) setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3)) setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4)) setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5)) setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6)) setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7)) setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, 8)) setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9)) setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10)) setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11)) setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12)) setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, 8)) setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12)) local ammo = {} for i=0,12 do --Weapon Slots for k=1,46 do --Weapon IDs (seria do 0 ao 46, mas não precisa obter a mão do jogador, arma 0.) if getPedWeapon (source, i) == k then ammo[k] = getPedTotalAmmo (source, i) end end end setAccountData (previousAcc, "funmodev2-weapons", toJSON ( { ammo[1], ammo[2], ammo[3], ammo[4], ammo[5], ammo[6], ammo[7], ammo[8], ammo[9], ammo[10], ammo[11], ammo[12], ammo[13], ammo[14], ammo[15], ammo[16], ammo[17], ammo[18], ammo[19], ammo[20], ammo[21], ammo[22], ammo[23], ammo[24], ammo[25], ammo[26], ammo[27], ammo[28], ammo[29], ammo[30], ammo[31], ammo[32], ammo[33], ammo[34], ammo[35], ammo[36], ammo[37], ammo[38], ammo[39], ammo[40], ammo[41], ammo[42], ammo[43], ammo[44], ammo[45], ammo[46] } )) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) --- function setTeam() local account = getPlayerAccount(source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end addEventHandler("onPlayerLogin",root,setTeam) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then -- Checks to see if the player is a guest or not setAccountData(account, "team", getTeamName(team)) --saves team end end addEventHandler("onPlayerQuit", getRootElement(), save) -- saves team on quit
Tab bugando arma
in Programação em Lua
Posted
Tab no mta tambem é usado para dar tiro, acho que não tem como remover uma função do mta