Jump to content

Jonas^

Members
  • Posts

    1,016
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Jonas^

  1. O código está certo posso te afirmar isso, seu problema é no meta, mas por via das dúvidas copie o código de novo: local porte = createMarker (249.60, 68.46, 1002.64, "cylinder", 1, 255, 255, 255, 50) setElementDimension (porte, 1) setElementInterior (porte, 6) addCommandHandler ("comprarporte", function (player, cmd) if (not isGuestAccount (getPlayerAccount (player))) then -- Se o jogador não estiver deslogado, então: if isElementWithinMarker (player, porte) then -- Se o jogador estiver no marker, então: if not getAccountData (getPlayerAccount(player), "porte") then -- Se o jogador não estiver com a account-data "porte", então: if getPlayerMoney (player) >= 30000 then -- Se o jogador tiver menos ou igual a 30k, então: takePlayerMoney (player, 30000) -- Debita 30k da conta do jogador. setAccountData (getPlayerAccount(player), "porte", true) -- Seta a account-data na conta do jogador. outputChatBox ("[AVISO] Você comprou o porte de armas!", player, 0, 255, 0) else --Se o jogador não tiver 30k, então: outputChatBox ("[AVISO] Você não tem dinheiro para o porte!", player, 255, 30, 30) end else -- Se o jogador tiver a account-data, então: outputChatBox ("[AVISO] Você já tem o porte de armas!", player, 255, 30, 30) end else -- Se o jogador não estiver no marker, então: outputChatBox ("[AVISO] Você não está na delegacia!", player, 255, 30, 30) end else -- Se o jogador estiver deslogado, então: outputChatBox ("[AVISO] Você não pode comprar o porte estando deslogado.", player, 255, 30, 30) end end) Meta: <meta> <script src="server.lua" type="server"/> </meta>
  2. Pra falar a verdade é source ao invés de localPlayer mesmo pois no evento onClientPedDamage quem recebe o Damage é o source volte pra source nas datas, e no server está errado, a data neste caso você precisa informar um valor bool. Troque por: setElementData (player_alvo, "shock", true) Onde essa função emshock esta sendo chamada no server-side ? Acredito que de pra gente fazer tudo server-side e nem precisamos usar as datas no client. Digite /debugscript 3 e diga se aparecer erros quando startar o resouce.
  3. /debugscript 3 me diga oque mostra ao restartar o resouce
  4. Está errado, coloque server no meta em type="server" ao invés de client. onResouceStart/Stop são eventos server-side e não client-side.
  5. radius: A floating point number representing the radius that will be eliminated. Como foi citado no tópico é o raio de onde a remoção sera aplicada, ele usou 15, mas você pode usar, 30, 50, 100, enfim.
  6. addCommandHandler ("comprarporte", function (player, cmd) if (not isGuestAccount (getPlayerAccount (player))) then -- Se o jogador não estiver deslogado, então: if isElementWithinMarker (player, porte) then -- Se o jogador estiver no marker, então: if not getAccountData (getPlayerAccount(player), "porte") then -- Se o jogador não estiver com a account-data "porte", então: if getPlayerMoney (player) >= 30000 then -- Se o jogador tiver menos ou igual a 30k, então: takePlayerMoney (player, 30000) -- Debita 30k da conta do jogador. setAccountData (getPlayerAccount(player), "porte", true) -- Seta a account-data na conta do jogador. outputChatBox ("[AVISO] Você comprou o porte de armas!", player, 255, 255, 255) else --Se o jogador não tiver 30k, então: outputChatBox ("[AVISO] Você não tem dinheiro para o porte!", player, 255, 255, 255) end else -- Se o jogador tiver a account-data, então: outputChatBox ("[AVISO] Você já tem o porte de armas!", player, 255, 255, 255) end else -- Se o jogador não estiver no marker, então: outputChatBox ("[AVISO] Você não está na delegacia!", player, 255, 255, 255) end else -- Se o jogador estiver deslogado, então: outputChatBox ("[AVISO] Você não pode comprar o porte estando deslogado.", player, 255, 255, 255) end end) @Renazz
  7. Não, setAccountData requer uma conta e não um elemento como argumento, e porque deixou a verificação de getElementData?
  8. De onde você tirou giveElementData? essa função não existe no MTA, pra salvar permanente use setAccountData.
  9. Troque source por localPlayer nas datas, pensei que o resource fosse server-side. Se você tivesse com o /debugscript 3 ativo já teria visto.
  10. local money = getPlayerMoney (localPlayer) if money > 99999999 then money = 99999999 end local cash = money local stcash = tostring(money) if #stcash == 1 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 2 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 3 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage(x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 4 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 5 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 6 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 7 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if #stcash == 8 then dxDrawText ("$"..convertNumber(cash), x*1133, y*65, x*956, y*65, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false) dxDrawImage (x*1105, y*57, x*30, y*25, "Img/Carteira.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end ----[convert]----- function convertNumber (number) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k == 0) then break end end return formatted end @Luccas
  11. addEventHandler ("onClientKey", root, function (button, press) if getElementData (localPlayer, "shock") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" then cancelEvent () end end end)
  12. Quase, tem algumas coisas erradas, tente assim: cFunc["anim_check"] = function(_, wep, bodypart) if(wep == 23) and (bodypart == 9) then setPedAnimation(source, "ped", "KO_shot_face", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 8) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 7) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 6) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 5) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 4) then setPedAnimation(source, "CRACK", "crckdeth3", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 3) then setPedAnimation(source, "ped", "KO_shot_stom", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 2) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) elseif(wep == 23) and (bodypart == 1) then setPedAnimation(source, "CRACK", "crckdeth2", 30000, false, true, false) setElementData (source, "shock", true) setTimer (function () setElementData (source, "shock", false) end, 30000, 1) end end addEventHandler ("onClientKey", root, function (button, press) if getElementData (localPlayer, "preso") or getElementData (localPlayer, "algemado") or getElementData (localPlayer, "shock") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" then cancelEvent () end end end)
  13. Depende, o taser seta alguma data no jogador enquanto ele estiver sobre o efeito do taser? se sim é possível sim, caso contrário você vai ter que setar uma data no jogador que for atingido pelo taser e quando o efeito passar remover essa data, dai no onclientkey você apenas verifica se o jogador estiver essa data e a ação sera cancelada
  14. Você não precisa declarar duas funções pra fazer a mesma coisa, basta verificar ambas as datas em uma só, retire a primeira função onClientKey e deixe somente essa no lugar da última: addEventHandler ("onClientKey", root, function (button, press) if getElementData (localPlayer, "preso") or getElementData (localPlayer, "algemado") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" then cancelEvent () end end end)
  15. Lógico que esta dando erro cara, você esta usando um parâmetro que nem esta definido na função.... Não sei porque você insiste em usar um código pior, te dei um código melhor que esse seu aí e você ainda assim insiste em usar esse código seu todo bugado mal feito. Enfim, não tem humildade pra aceitar conhecimento, quer fazer tudo sem nem se quer entender oque esta fazendo, boa sorte aí.
  16. Esses símbolos são do fórum, é só formatar o código pra ANSI e tira-los e colocar em UTF-8 (sem bom) novamente. Se o playTime for um timer que soma quantos segundos o jogador estiver logado em cada sessão, tem um código pronto aqui:
  17. Pelo visto não foi você que fez esse resource, nem se quer pelo visto abriu os links que o @DNL291 lhe forneceu, tentar então nem pensar, vou te dar o código pronto só desta vez, próxima vez tente fazer com os links que te fornecerem e poste o código assim você mostra interesse em aprender. Código: ----------------------------- -- Salvamento/Carregamento -- ----------------------------- function savePlayerKills (thePlayer, acc) local acc = acc or getPlayerAccount (thePlayer) if not isGuestAccount(acc) and thePlayer then local setkills = getElementData (thePlayer, "kills") or 0 local setdeaths = getElementData (thePlayer, "deaths") or 0 setAccountData (acc, "kills", tostring(setkills)) setAccountData (acc, "deaths", tostring(setdeaths)) end end function loadPlayerKills (thePlayer) local acc = getPlayerAccount (thePlayer) if not isGuestAccount(acc) then local getKills = tonumber(getAccountData(acc, "kills")) or 0 local getDeaths = tonumber(getAccountData(acc, "deaths")) or 0 setElementData (thePlayer, "kills", getKills) setElementData (thePlayer, "deaths", getDeaths) end end addEventHandler ("onResourceStop", resourceRoot, function () for i, p in pairs (getElementsByType("player")) do savePlayerKills (p) end end) addEventHandler ("onResourceStart", resourceRoot, function () for i, p in pairs (getElementsByType("player")) do loadPlayerKills (p) end end) addEventHandler ("onPlayerQuit", root, function () savePlayerKills (source) end) addEventHandler ("onPlayerLogout", root, function (acc) savePlayerKills (source, acc) end) addEventHandler ("onPlayerLogin", root, function () loadPlayerKills (source) end) Adicione no final do seu código. @MR.Kingos
  18. Como o @Lord Henry já disse, código corrigido. OBS: Fiz alguns upgrades. addCommandHandler ("skin", function (thePlayer, cmd) if not getElementData (thePlayer, "skin->gang") then -- Se o jogador não estiver a data, então: outputChatBox ("Você pegou a skin da sua gang.", thePlayer, 0, 255, 0) setElementModel (thePlayer, 12) -- Seta skin 12 nele. setElementData (thePlayer, "skin->gang", true) -- Seta a data no jogador. theTimer = setTimer (function () setElementData (thePlayer, "skin->gang", false) -- Quando o tempo do timer acabar, seta a data como false no jogador. outputChatBox ("Agora você pode pegar sua skin novamente!", thePlayer, 0, 255, 0) theTimer = nil -- Anula a variável do timer pra não ficar ocupando espaço na memória. end, 10000, 1) else -- Se já existir a data, então: if isTimer (theTimer) then -- Se estiver um timer em andamento, então: outputChatBox ("Aguarde "..math.floor(getTimerDetails (theTimer) / 1000).." segundos para usar esse comando novamente!", thePlayer, 255, 30, 30) end end end) EDIT: Não testado.
  19. Estranho, nunca passei por esse problemas, conheço grandes servidores (NETWORKS) que usam windows e nunca passaram por isso, estranho mesmo.
  20. Eu optaria por utilizar Windows além de ser muito mais simples de mexer sem precisar ficar abrindo terminal etc, não entendo o motivo de você querer apenas linux pra hospedar um servidor. OBS: Eu uso windows na minha vps e nunca tive problemas com o mta.
  21. Verdade, código atualizado: addEventHandler ("onClientRender", root, function () local money = getPlayerMoney (localPlayer) dxDrawBorderedText (1, "Seu Dinheiro:", 560, 344, 729, 376, tocolor(244, 131, 10, 255), 2.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawBorderedText (1, "$"..convertNumber(money), 729, 344, 898, 376, tocolor(255, 255, 255, 200), 2.00, "default-bold", "left", "top", false, false, false, false, false) end) function convertNumber (number) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k == 0) then break end end return formatted end function dxDrawBorderedText (outline, text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) for oX = (outline * -1), outline do for oY = (outline * -1), outline do dxDrawText (text, left + oX, top + oY, right + oX, bottom + oY, tocolor(wr, wg, wb), scale, font, alignX, alignY, clip, wordBreak, postGUI) end end dxDrawText (text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end Se não conseguir adaptar no seu código poste seu código atual que eu coloco, mas é só dar ctrl c + v no meu exemplo. @Luccas
  22. Resumindo: Você quer que todos os ped aí ao jogador clicar a data seja setada no jogador é isso? Se for oque eu citei acima eu tinha testado aqui e funcionou perfeitamente. function openGang (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, elem) if button == "left" and state == "up" then if elem and getElementType(elem) == "ped" then if getElementData (localPlayer, "character->inJobPanel") then -- Se o jogador não estiver a data então: setElementData (localPlayer, "character->inJobPanel", true) -- Seta a data como true. outputChatBox ("@Data Setada") else -- Senão: outputChatBox ("@Você já esta com a data") -- Retorna informando que o jogador já tem a data. end end end end addEventHandler ("onClientClick", root, openGang) Depurei o código pra ficar mais simples de você entender, testei com todos os ped da table. @LucasMTA
  23. Você quer setar essa data no ped? pois você declarou ped ali não sei se você viu, se você quer que abra em jogadores declare player.
  24. Faz um teste assim: function openGang (button, state, xx, yy, xxx, yyy, zzz, clickedElement) if clickedElement then if getElementType (clickedElement) == "ped" then addEventHandler ("onClientRender", root, GangPanel) setElementData (localPlayer, "character->inJobPanel", true) showChat (false) Panel = 1 end end end addEventHandler ("onClientClick", root, openGang) Testa se abre.
  25. Jonas^

    SetElementData

    local account = getPlayerAccount (client)
×
×
  • Create New...