Jump to content

Welf

Members
  • Posts

    42
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Welf's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Como eu poderia salvar as informações na conta do player quando ele saisse do Marker (MIdentidade) na linha 3?
  2. Deu certo, porém queria que caso o jogador ja tenha essas informações setadas, aparecesse a informação de que ele já tirou a identidade (LINHA 24), porém não tá funcionando! quando passo no marker ele abre o painel normalmente Consegui dessa forma: Entrada = createMarker(1183.8770751953,-1234.6398925781,19.155364990234-1,"cylinder",2,255,255,255,0) Saida = createMarker(1183.5395507813,-1239.0718994141,18.603658676147-1,"cylinder",2,255,255,255,0) MIdentidade = createMarker(1181.6715087891,-1221.7287597656,19.155364990234 -1,"cylinder",1.1,0,100,200,0) MTrabalho = createMarker(1181.5675048828,-1225.3601074219,19.155364990234 -1,"cylinder",1.1,0,100,200,0) MAgencia = createMarker(1174.1483154297,-1220.9399414063,19.155364990234 -1,"cylinder",1.1,0,100,200,0) function Entrar(thePlayer) triggerClientEvent(thePlayer,"Entrou",thePlayer) end addEventHandler("onMarkerHit",Entrada,Entrar) function Saiu(thePlayer) triggerClientEvent(thePlayer,"Saiu",thePlayer) end addEventHandler("onMarkerHit",Saida,Saiu) function Identidade(thePlayer) local Serial = getPlayerSerial ( thePlayer ) setElementData ( thePlayer, "IDs", ""..Serial.."" ) local Identidade = getElementData(thePlayer,"Identidade:Nome") or "N/C" if Identidade == "N/C" then triggerClientEvent(thePlayer,"Open:Identidade",thePlayer) else outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ JÁ POSSUI RG EMITIDO!",thePlayer,255,255,255,true) return end end addEventHandler("onMarkerHit",MIdentidade,Identidade) function fadeCameraDelayed(player) if (isElement(player)) then fadeCamera(player, true, 0.5) end end function Agencia(thePlayer) local account = getPlayerAccount (thePlayer) local Trabalho = getElementData(thePlayer,"Identidade:Trabalho") or "N/C" if isGuestAccount (account) then outputChatBox ( "Você não pode trabalhar deslogado, crie uma conta!", thePlayer, 255,0,0,true) return end if isElementWithinMarker(thePlayer, MAgencia) then if Trabalho == "N/C" then outputChatBox("#ff0000-> #ffffffVocê não tem uma carteira de trabalho.",thePlayer,255,255,255,true) return else triggerClientEvent(thePlayer,"Hy:Abrir",thePlayer) end end end addEventHandler("onMarkerHit",MAgencia,Agencia) function Trabalho(thePlayer) local Identidade = getElementData(thePlayer,"Identidade:Nome") or "N/C" local Trabalho = getElementData(thePlayer,"Identidade:Trabalho") or "N/C" if Identidade == "N/C" then outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ NÃO POSSUI RG!",thePlayer,255,255,255,true) return end if Trabalho == "N/C" then triggerClientEvent(thePlayer,"Open:Trabalho",thePlayer) else outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ JÁ POSSUI CARTEIRA DE TRABALHO",thePlayer,255,255,255,true) return end end addEventHandler("onMarkerHit",MTrabalho,Trabalho) function Carregar_Dis ( conta ) if not isGuestAccount ( conta ) then if conta then local source = getAccountPlayer ( conta ) local Name = getAccountData ( conta, "Identidade:Nome") or "N/C" local Idade = getAccountData ( conta, "Identidade:Idade") or "N/C" local Local = getAccountData ( conta, "Identidade:Local") or "N/C" local Trabalho = getAccountData ( conta, "Identidade:Trabalho") or "N/C" local Assinou = getAccountData ( conta, "Assinou:Trabalho") or "N/C" setElementData ( source, "Identidade:Nome", Name ) setElementData ( source, "Identidade:Idade", Idade ) setElementData ( source, "Identidade:Local", Local ) setElementData ( source, "Identidade:Trabalho", Trabalho ) setElementData ( source, "Assinou:Trabalho", Assinou ) end end end function Iniciar_Resource ( res ) if res == getThisResource ( ) then for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then Carregar_Dis ( acc ) end end end end addEventHandler ( "onResourceStart", getRootElement ( ), Iniciar_Resource ) function Salvar_Dis ( conta ) if conta then local source = getAccountPlayer ( conta ) local Name = getElementData ( source, "Identidade:Nome") or "N/C" local Idade = getElementData ( source, "Identidade:Idade") or "N/C" local Local = getElementData ( source, "Identidade:Local") or "N/C" local Trabalho = getElementData ( source, "Identidade:Trabalho") or "N/C" local Assinou = getElementData ( source, "Assinou:Trabalho") or "N/C" setAccountData ( conta, "Identidade:Nome", Name ) setAccountData ( conta, "Identidade:Idade", Idade ) setAccountData ( conta, "Identidade:Local", Local ) setAccountData ( conta, "Identidade:Trabalho", Trabalho ) setAccountData ( conta, "Assinou:Trabalho", Assinou ) end end function Desligar_Dis ( res ) if res == getThisResource ( ) then for i, player in ipairs(getElementsByType("player")) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then Salvar_Dis ( acc ) end end end end addEventHandler ( "onResourceStop", getRootElement(), Desligar_Dis ) function Sair_Dis_Servidor ( quitType ) local acc = getPlayerAccount(source) if not isGuestAccount ( acc ) then if acc then Salvar_Dis ( acc ) end end end addEventHandler ( "onPlayerQuit", getRootElement(), Sair_Dis_Servidor )
  3. Olá galera tudo bem? to editando um script de identidade, onde basicamente o jogador coloca seu nome, data de nascimento e local de nascimento, no entanto, quando o jogador sai do servidor nada disso fica salvo na conta dele, ele precisa novamente ter que emitir a identidade, como posso fazer as informações fiquem salvas na conta dele? (Identidade:Nome - Identidade:Idade - Identidade:Local) Client: local screenW,screenH = guiGetScreenSize() local resW, resH = 1024,768 local x, y = (screenW/resW), (screenH/resH) Texto = { msg = {} } Texto.msg[1] = guiCreateEdit(x*360, y*315, x*200, y*27, "", false) Texto.msg[2] = guiCreateEdit(x*360, y*365, x*200, y*27, "", false) Texto.msg[3] = guiCreateEdit(x*360, y*415, x*200, y*27, "", false) guiSetVisible ( Texto.msg[1], false ) guiSetVisible ( Texto.msg[2], false ) guiSetVisible ( Texto.msg[3], false ) function ConfigurarBrancos () if Painel == true then Nome = guiGetText(Texto.msg[1]) Idade = guiGetText(Texto.msg[2]) Local = guiGetText(Texto.msg[3]) end end setTimer ( ConfigurarBrancos, 50, 0 ) function Identidade() local RG = getElementData(localPlayer, "ID") or "0" local Brito_RGNumero = getElementData ( localPlayer, "IDs" ) or "Erro " Cor = tocolor(218, 218, 218, 255) if isCursorOnElement(x*579, y*529, x*101, y*28) then Cor = tocolor(0,100,200,150) end dxDrawImage(375, 70, 438, 424, "gfx/bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- dxDrawRectangle(x*350, y*184, x*342, y*394, tocolor(238, 238, 238, 255), false) -- dxDrawText("Identidade BNC", x*350, y*184, x*692, y*207, tocolor(0, 138, 244, 255), x*1.20, "sans", "center", "center", false, false, false, false, false) -- dxDrawText("Olá, seja bem vindo(a) ao Brasil Nacional City\nAqui é onde você vai preencher sua identidade\n\nOBS: Não será possível preencher novamente,\npreencha corretamente ou poderá ser preso.", x*356, y*217, x*698, y*240, tocolor(0, 138, 244, 255), 1.10, "sans", "left", "top", false, false, false, false, false) dxDrawRectangle(x*579, y*529, x*101, y*28, Cor, false) dxDrawText("EMITIR", x*580, y*529, x*680, y*557, tocolor(255, 255, 255, 255), x*1.00, "sans", "center", "center", false, false, false, false, false) dxDrawText("Pressione 'Enter' para fechar", x*348, y*580, x*692, x*597, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "top", false, false, false, false, false) dxDrawText(""..RG.."", 89, 225, 777, 594, tocolor(0, 128, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(""..Brito_RGNumero.."", 285, -115, 777, 594, tocolor(0, 128, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) -- dxDrawText("Nomes irregulares e ofensivos\npoderão ocasionar em prisões ou\naté mesmo banimentos.", x*360, y*447, x*670, y*497, tocolor(255, 95, 95, 255), x*1.00, "sans", "center", "center", false, false, false, false, false) end Painel = false function Abrir() if Painel == false then toggleAllControls(false) showChat(false) showCursor ( true ) addEventHandler ( "onClientRender", root, Identidade ) guiSetVisible ( Texto.msg[1], true ) guiSetVisible ( Texto.msg[2], true ) guiSetVisible ( Texto.msg[3], true ) Painel = true end end addEvent("Open:Identidade",true) addEventHandler("Open:Identidade",root,Abrir) function Fechar() if Painel then toggleAllControls(true) showChat(true) showCursor ( false ) removeEventHandler ( "onClientRender", root, Identidade ) guiSetVisible ( Texto.msg[1], false ) guiSetVisible ( Texto.msg[2], false ) guiSetVisible ( Texto.msg[3], false ) Painel = false end end addCommandHandler("fecharp",Fechar) bindKey("enter","down","fecharp") function outputEditBox ( button ) if button == "left" then guiSetText(Texto.msg[1],"") end end addEventHandler ( "onClientGUIClick", Texto.msg[1], outputEditBox) function outputEditBox ( button ) if button == "left" then guiSetText(Texto.msg[2],"") end end addEventHandler ( "onClientGUIClick", Texto.msg[2], outputEditBox) function outputEditBox ( button ) if button == "left" then guiSetText(Texto.msg[3],"") end end addEventHandler ( "onClientGUIClick", Texto.msg[3], outputEditBox) function ConfirmarContinuar (_,state) if Painel == true then if state == "down" then if isCursorOnElement (x*579, y*529, x*101, y*28) then if guiGetText(Nome) == "" then return else if guiGetText(Nome) == "" then return else if guiGetText(Idade) == "" then return else if guiGetText(Idade) == "" then return else if guiGetText(Local) == "" then return else if guiGetText(Local) == "" then return else setElementData ( localPlayer, "Identidade:Nome", Nome) setElementData ( localPlayer, "Identidade:Idade",Idade) setElementData ( localPlayer, "Identidade:Local", Local) toggleAllControls(true) showChat(true) showCursor ( false ) removeEventHandler ( "onClientRender", root, Identidade ) guiSetVisible ( Texto.msg[1], false ) guiSetVisible ( Texto.msg[2], false ) guiSetVisible ( Texto.msg[3], false ) Painel = false outputChatBox("[PARABÉNS] VOCÊ REALIZOU COM SUCESSO A EMISSÃO DA SUA CARTEIRA DE IDENTIDADE",0,255,0) end end end end end end end end end end addEventHandler ( "onClientClick", root, ConfirmarContinuar ) function isCursorOnElement( x,y,w,h ) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end Server: Entrada = createMarker(1183.8770751953,-1234.6398925781,19.155364990234-1,"cylinder",2,255,255,255,0) Saida = createMarker(1183.5395507813,-1239.0718994141,18.603658676147-1,"cylinder",2,255,255,255,0) MIdentidade = createMarker(1181.6715087891,-1221.7287597656,19.155364990234 -1,"cylinder",1.1,0,100,200,0) MTrabalho = createMarker(1181.5675048828,-1225.3601074219,19.155364990234 -1,"cylinder",1.1,0,100,200,0) MAgencia = createMarker(1174.1483154297,-1220.9399414063,19.155364990234 -1,"cylinder",1.1,0,100,200,0) function Entrar(thePlayer) triggerClientEvent(thePlayer,"Entrou",thePlayer) end addEventHandler("onMarkerHit",Entrada,Entrar) function Saiu(thePlayer) triggerClientEvent(thePlayer,"Saiu",thePlayer) end addEventHandler("onMarkerHit",Saida,Saiu) function Identidade(thePlayer) local Serial = getPlayerSerial ( thePlayer ) setElementData ( thePlayer, "IDs", ""..Serial.."" ) local Identidade = getElementData(thePlayer,"Identidade:Nome") or "N/C" if Identidade == "N/C" then triggerClientEvent(thePlayer,"Open:Identidade",thePlayer) else outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ JÁ POSSUI RG EMITIDO!",thePlayer,255,255,255,true) return end end addEventHandler("onMarkerHit",MIdentidade,Identidade) function fadeCameraDelayed(player) if (isElement(player)) then fadeCamera(player, true, 0.5) end end function Agencia(thePlayer) local account = getPlayerAccount (thePlayer) local Trabalho = getElementData(thePlayer,"Identidade:Trabalho") or "N/C" if isGuestAccount (account) then outputChatBox ( "Você não pode trabalhar deslogado, crie uma conta!", thePlayer, 255,0,0,true) return end if isElementWithinMarker(thePlayer, MAgencia) then if Trabalho == "N/C" then outputChatBox("#ff0000-> #ffffffVocê não tem uma carteira de trabalho.",thePlayer,255,255,255,true) return else triggerClientEvent(thePlayer,"Hy:Abrir",thePlayer) end end end addEventHandler("onMarkerHit",MAgencia,Agencia) function Trabalho(thePlayer) local Identidade = getElementData(thePlayer,"Identidade:Nome") or "N/C" local Trabalho = getElementData(thePlayer,"Identidade:Trabalho") or "N/C" if Identidade == "N/C" then outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ NÃO POSSUI RG!",thePlayer,255,255,255,true) return end if Trabalho == "N/C" then triggerClientEvent(thePlayer,"Open:Trabalho",thePlayer) else outputChatBox("#ff0000ATENDENTE:#ffffff VOCÊ JÁ POSSUI CARTEIRA DE TRABALHO",thePlayer,255,255,255,true) return end end addEventHandler("onMarkerHit",MTrabalho,Trabalho)
  4. Olá galera, tenho um script que calcula a distancia percorrida pelo jogador no veículo e exibe na tela, como um odômetro, porém eu queria que esses dados da distancia ficassem salvos na conta do jogador, pra caso ele saia do server, quando retornasse estivesse lá tentei isso, mas não funcionou: -------------------------------------------------- CLIENT local font1 = dxCreateFont("files/RobotoCondensed.ttf", 35) local SizeX, SizeY = guiGetScreenSize() local px,py = 1920,1080 local x,y = (SizeX/px), (SizeY/py) function speedometrs () if getElementData(getLocalPlayer(), "hud") == true then return end local veh = getPedOccupiedVehicle(getLocalPlayer()) if not veh or getVehicleOccupant ( veh ) ~= localPlayer then return true end if not driveDistance then lastTick = getTickCount() driveDistance = getElementData(localPlayer, "driveDistance") or 0 end local neux, neuy, neuz = getElementPosition(veh) dxDrawText(""..tostring(math.round(driveDistance),1).." км",SizeX,SizeY - 40, SizeX - 360,SizeY, tocolor(255,255,255,180), 0.3,0.3, font1,"center","center") if not altx or not alty or not altz then altx, alty, altz=getElementPosition(veh) end local driveTotal = getDistanceBetweenPoints3D(neux,neuy,neuz,altx,alty,altz) driveTotal = driveTotal/400 altx,alty,altz=neux,neuy,neuz driveDistance = math.round(driveDistance+driveTotal,3) if lastTick+5000 < getTickCount() then lastTick = getTickCount() setElementData(localPlayer, "driveDistance", driveDistance) end end addEventHandler("onClientRender", root, speedometrs) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),function(veh,seat) if source == localPlayer then altx, alty, altz=getElementPosition(veh) lastTick = getTickCount() driveDistance = getElementData(localPlayer, "driveDistance") end end) --SERVER function CarregarLoginPlay ( conta ) if not isGuestAccount ( conta ) then if conta then local source = getAccountPlayer ( conta ) local emp = getAccountData ( conta, "driveDistance" ) or "N/C" setElementData ( source, "driveDistance", emp ) end end end function SalvarLoginPlay ( conta ) if conta then local Nome = getElementData ( source, "driveDistance" ) or "N/C" setAccountData ( conta, "driveDistance", Nome ) end
  5. O erro que me refiro é esse: local RG = getElementData ( localPlayer, "Brito_ID" ) or "Erro " -- aqui Ao invés de retornar o nome ele ta retornando "erro"
  6. Não funcionou, continua retornando "erro"
  7. Trata-se de um sistema de RG, ou seja, ele salva o nome, idade e local de nascimento do player, no entanto eu coloquei a opção nesse sistema, de puxar o nome da conta (AccountName) e incluir esse nome no espaço destinado pro player escrever (Client Linha 46), tornando assim o (PlayerName) igual ao (AccountName), pois o jogador só precisaria confirma, no entanto quando o script ta puxando o AccountName ele ta retornando "erro" e não o nome da conta Aqui especificamente: Client: local RG = getElementData ( localPlayer, "Brito_ID" ) or "Erro " -- aqui BritoSCR01 = guiCreateEdit ( 562, 355, 231, 22, ""..RG.."", false ) guiSetVisible ( BritoSCR01, false ) guiSetAlpha ( BritoSCR01, 0.85 ) guiEditSetMaxLength ( BritoSCR01, 22 ) guiEditSetReadOnly( BritoSCR01, true ) Server: local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) setElementData ( source, "Brito_ID", ""..accname.."" ) Pensei no fato do script está iniciando antes do player fazer login, mas o evento é OnPlayerLogin, por isso não entendi E aí Ele ta retornando "erro"
  8. Olá galera, to com um script que é um sistema de RG, no entanto, quando o player cria sua conta em vez de retornar o nome usado no login (getAccountName) ele ta retornando dando erro (LINHA 52 foi Definido isso), porém o script só inicia depois que o player faz login, não to entendendo o por que de não retornar o nome da conta! se alguem puder ajudar! Client: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) RGPainel = false function Brito_DXRG () local Brito_RGNumero = getElementData ( localPlayer, "Brito_RG" ) or "Erro " local Brito_DataExpedicao = getElementData ( localPlayer, "Brito_DataExpedicao" ) or "Erro " local Brito_NomeCompleto = getElementData ( localPlayer, "charname" ) or "Erro " local Brito_DataDeNascimento = getElementData ( localPlayer, "Brito_RG_DataDeNascimento" ) or "Erro " local Brito_LocalDeNascimento = getElementData ( localPlayer, "Brito_RG_LocalDeNascimento" ) or "Erro " dxDrawRectangle(407, 204, 562, 352, tocolor(31, 31, 31, 197), false) dxDrawRectangle(407, 204, 561, 67, tocolor(15, 15, 15, 197), false) dxDrawRectangle(406, 268, 563, 3, tocolor(255, 255, 255, 255), false) dxDrawText("IDENTIDADE", 406, 203, 968, 261, tocolor(255, 255, 255, 255), 3.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Registro Geral: "..Brito_RGNumero, 437, 288, 782, 310, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Data de Expedição: "..Brito_DataExpedicao, 437, 313, 782, 333, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Nome de Registro: "..Brito_NomeCompleto, 437, 352, 783, 378, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Data de Nascimento: " ..Brito_DataDeNascimento, 437, 383, 785, 410, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Local de Nascimento: " ..Brito_LocalDeNascimento, 437, 414, 784, 441, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("BRASIL VIRTUAL", 406, 514, 969, 546, tocolor(255, 254, 254, 197), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(411, 517, 554, 29, tocolor(255, 254, 254, 21), false) end function Brito_AbrirFecharRGDX () if RGPainel == false then addEventHandler ( "onClientRender", root, Brito_DXRG ) RGPainel = true else removeEventHandler ( "onClientRender", root, Brito_DXRG ) RGPainel = false end end addCommandHandler ( "rg", Brito_AbrirFecharRGDX ) ---------- Criar essa merda maluco local RG = getElementData ( localPlayer, "Brito_ID" ) or "Erro " -- aqui BritoSCR01 = guiCreateEdit ( 562, 355, 231, 22, ""..RG.."", false ) guiSetVisible ( BritoSCR01, false ) guiSetAlpha ( BritoSCR01, 0.85 ) guiEditSetMaxLength ( BritoSCR01, 22 ) guiEditSetReadOnly( BritoSCR01, true ) BritoSCR02 = guiCreateEdit( 562, 388, 231, 22, "", false) guiSetVisible ( BritoSCR02, false ) guiSetAlpha ( BritoSCR02, 0.85 ) guiEditSetMaxLength ( BritoSCR02, 10 ) BritoSCR03 = guiCreateEdit( 562, 419, 231, 22, "Los Santos - BR", false) guiSetVisible ( BritoSCR03, false ) guiSetAlpha ( BritoSCR03, 0.85 ) guiEditSetMaxLength ( BritoSCR03, 40 ) guiEditSetReadOnly( BritoSCR03, true ) function ConfigurarBrancos () if CriandoRG == true then BritoSCR_edit01 = guiGetText(BritoSCR01) BritoSCR_edit02 = guiGetText(BritoSCR02) BritoSCR_edit03 = guiGetText(BritoSCR03) end end setTimer ( ConfigurarBrancos, 50, 0 ) BritoSCR_edit01 = 0 BritoSCR_edit02 = 0 BritoSCR_edit03 = 0 CriandoRG = false function CriarRG () setTimer ( function() local Brito_RGNumero = getElementData ( localPlayer, "Brito_RG" ) or "Erro Desconhecido, Contate um Administrador (01)" local Brito_DataExpedicao = getElementData ( localPlayer, "Brito_DataExpedicao" ) or "Erro Desconhecido, Contate um Administrador (02)" dxDrawRectangle(407, 204, 562, 352, tocolor(31, 31, 31, 197), false) dxDrawRectangle(407, 204, 561, 67, tocolor(15, 15, 15, 197), false) dxDrawRectangle(406, 268, 563, 3, tocolor(255, 255, 255, 255), false) dxDrawText("IDENTIDADE", 406, 208, 968, 261, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false) dxDrawText("Registro Geral: "..Brito_RGNumero, 437, 288, 782, 310, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Data de Expedição: "..Brito_DataExpedicao, 437, 313, 782, 333, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Nome de Registro:", 437, 352, 783, 378, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Data de Nascimento:", 437, 383, 785, 410, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("Local de Nascimento:", 437, 414, 784, 441, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) dxDrawText("BEM-VINDO AO BRASIL VIRTUAL \nDESEJAMOS UM ÓTIMO JOGO!", 406, 515, 969, 547, tocolor(255, 254, 254, 197), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(411, 517, 554, 29, tocolor(255, 254, 254, 21), false) if cursorPosition ( 585, 480, 200, 34 ) then dxDrawRectangle(585, 480, 200, 34, tocolor(254, 254, 254, 74), false) else dxDrawRectangle(254, 254, 254, 0, tocolor(254, 254, 254, 74), false) end dxDrawText("Confirmar", 586, 478, 785, 514, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) end, 1200, 1 ) end CriarRG() if key == F1 then cancelEvent() end function Brito_AbrirFecharRGCriacao () if CriandoRG == false then addEventHandler ( "onClientRender", root, CriarRG ) guiSetVisible ( BritoSCR01, true ) guiSetVisible ( BritoSCR02, true ) guiSetVisible ( BritoSCR03, true ) showCursor ( true ) CriandoRG = true else removeEventHandler ( "onClientRender", root, CriarRG ) guiSetVisible ( BritoSCR01, false ) guiSetVisible ( BritoSCR02, false ) guiSetVisible ( BritoSCR03, false ) showCursor ( false ) CriandoRG = false end end addEventHandler("onClientKey", root, function (button, press) if getElementData(localPlayer, "Brito_SolicitarCriarRG" ) == "Sim" then if button == "t" or button == "y" or button == "u" or button == "i" or button == "o" or button == "p" or button == "" or button == "" or button == "" or button == "" or button == "" or button == "" then cancelEvent() end end end ) function nomealterado() local NomeC = tostring(getElementData ( localPlayer , "charname" )) local NomeN = getPlayerName ( localPlayer ) if NomeC == NomeN then else triggerServerEvent ("alterarnome", getLocalPlayer()) end end setTimer ( nomealterado, 50, 0 ) function ReceberSolicitacaoCriarRG () if getElementData ( localPlayer, "Brito_SolicitarCriarRG" ) == "Sim" then setElementData ( localPlayer, "Brito_SolicitarCriarRG", "Não" ) Brito_AbrirFecharRGCriacao () -- Abrir end end setTimer ( ReceberSolicitacaoCriarRG, 50, 0 ) function ConfirmarContinuar (_,state) local nomelimite = guiGetText(BritoSCR01) local nomeLen = nomelimite:len() if CriandoRG == true then if state == "down" then if isCursorOnElement ( 585, 480, 200, 34 ) then if guiGetText(BritoSCR01) == "" or guiGetText(BritoSCR02) == "00/00/0000" or guiGetText(BritoSCR03) == "Cidade - Estado" then exports.vz_info:showBox("Verifique Os Campos Preenchidos, e Tente Novamente!", "error") return end if (nomeLen < 3) then exports.vz_info:showBox("Seu Nome deve conter no minimo 3 letras", "error") return end setElementData ( localPlayer, "charname", ""..BritoSCR_edit01.."" ) setElementData ( localPlayer, "Brito_RG_DataDeNascimento", ""..BritoSCR_edit02.."" ) setElementData ( localPlayer, "Brito_RG_LocalDeNascimento", ""..BritoSCR_edit03.."" ) Brito_AbrirFecharRGCriacao () -- Fechar setElementData ( localPlayer, "Brito_PossuiRG", "Sim" ) triggerServerEvent ("alterarnome", getLocalPlayer()) end end end end addEventHandler ( "onClientClick", root, ConfirmarContinuar ) -- Extras function cursorPosition(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function isCursorOnElement( x,y,w,h ) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end --------------------- Server: --[[ =================================== Meu discord Para suport: Zakk_#6792 =================================== --]] addEventHandler("onPlayerLogin", root, function( _, acc ) CarregarLoginPlay ( acc ) end ) function CarregarLoginPlay ( conta ) if not isGuestAccount ( conta ) then if conta then local source = getAccountPlayer ( conta ) local emp = getAccountData ( conta, "Brito_PossuiRG" ) or "N/C" setElementData ( source, "Brito_PossuiRG", emp ) local emp = getAccountData ( conta, "Brito_DataExpedicao" ) or "N/C" setElementData ( source, "Brito_DataExpedicao", emp ) local emp = getAccountData ( conta, "charname" ) or "Sem_Registro" setElementData ( source, "charname", emp ) local emp = getAccountData ( conta, "Brito_RG_DataDeNascimento" ) or "N/C" setElementData ( source, "Brito_RG_DataDeNascimento", emp ) local emp = getAccountData ( conta, "Brito_RG_LocalDeNascimento" ) or "N/C" setElementData ( source, "Brito_RG_LocalDeNascimento", emp ) local texto = tostring(getElementData ( source , "charname" )) or "Sem_Registro" texto = string.gsub(texto, "ã", "a") texto = string.gsub(texto, " ", "_") setPlayerName(source, texto) local Serial = getPlayerSerial ( source ) setElementData ( source, "Brito_RG", ""..Serial.."" ) local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) setElementData ( source, "Brito_ID", ""..accname.."" ) if getElementData ( source, "Brito_PossuiRG" ) == "Sim" then return end local time = getRealTime() or 0 local hora = time.hour or 0 local minuto = time.minute or 0 local dia = time.monthday or 0 local mes = time.month + 1 or 0 local ano = time.year + 1900 or 0 setElementData ( source, "Brito_DataExpedicao", ""..dia.."/"..mes.."/"..ano.." - "..hora..":"..minuto.."" ) setElementData ( source, "Brito_SolicitarCriarRG", "Sim" ) end end end ----------- alterar nome function alterarnome() local texto = tostring(getElementData ( source , "charname" )) or "Sem_Registro" local NomeN = getPlayerName ( source ) local acc = getPlayerAccount ( source ) if isGuestAccount ( acc ) then if NomeN == "Sem_Registro" then else setPlayerName (source, "Sem_Registro") end return end if texto == NomeN then else texto = string.gsub(texto, "ãáàâ", "a") texto = string.gsub(texto, "éèê", "e") texto = string.gsub(texto, "ç", "c") texto = string.gsub(texto, "õôóò", "o") texto = string.gsub(texto, "#!#!#!#$#%$%¨%¨%¨%¨%¨%¨&*&)(&(*0698596784867365726442543-=+§¬¢¬¢££££³²¹¹²³£¢¬§ªºª´[´~´´];~.ç.,.,><^~~´`°?/°''*/-+", "_") texto = string.gsub(texto, " ", "_") setPlayerName(source, texto) end end addEvent("alterarnome", true) addEventHandler("alterarnome", root, alterarnome) --------------- function nomealterado() local NomeC = tostring(getElementData ( source , "charname" )) NomeC = string.gsub(NomeC, " ", "_") setPlayerName( source, NomeC ) end addEvent("setnamet", true) addEventHandler("setnamet", root, nomealterado) ---------------- function ReiniciarScript ( res ) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then CarregarLoginPlay ( acc ) end end end end addEventHandler ( "onResourceStart", getRootElement ( ), ReiniciarScript ) -- function SalvarLoginPlay ( conta ) if conta then local source = getAccountPlayer ( conta ) local RG = getElementData ( source, "Brito_PossuiRG" ) or "N/C" setAccountData ( conta, "Brito_PossuiRG", RG ) local Data = getElementData ( source, "Brito_DataExpedicao" ) or "N/C" setAccountData ( conta, "Brito_DataExpedicao", Data ) local Nome = getElementData ( source, "charname" ) or "N/C" setAccountData ( conta, "charname", Nome ) local DataNas = getElementData ( source, "Brito_RG_DataDeNascimento" ) or "N/C" setAccountData ( conta, "Brito_RG_DataDeNascimento", DataNas ) local LocalNas = getElementData ( source, "Brito_RG_LocalDeNascimento" ) or "N/C" setAccountData ( conta, "Brito_RG_LocalDeNascimento", LocalNas ) end end function DesligarScript ( res ) if res == getThisResource ( ) then for i, player in ipairs ( getElementsByType ( "player" ) ) do local acc = getPlayerAccount ( player ) if not isGuestAccount ( acc ) then SalvarLoginPlay ( acc ) end end end end addEventHandler ( "onResourceStop", getRootElement ( ), DesligarScript ) function JogadorQuit ( quitType ) local acc = getPlayerAccount ( source ) if not isGuestAccount ( acc ) then if acc then SalvarLoginPlay ( acc ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), JogadorQuit ) ----------------------------- Trocar Nome function tagPlayer ( source, command, thePlayer, tag ) local sPlayerElement = getPlayerFromName ( thePlayer ) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin")) then if ( sPlayerElement ) then if getElementType ( sPlayerElement ) == "player" then local oldName = getPlayerName ( sPlayerElement ) local taggedName = tag setElementData ( sPlayerElement, "charname", taggedName ) outputChatBox ( "Jogador #ff0000" .. thePlayer .. " #ffffffalterado para: #00ff00" .. taggedName , source, 255, 255, 255, true ) end else outputChatBox ( "#ff0000Jogador Não encontrado!", source, 255, 255, 255, true ) end end end addCommandHandler ( "mudarnome", tagPlayer ) ------- Para mudar o nome /mudarnome Nick NovoNome Ex: /mudarnome Brito Pedro_Brito -------------- function tagPlayer2 ( source, command, thePlayer ) local sPlayerElement = getPlayerFromName ( thePlayer ) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin")) then if ( sPlayerElement ) then if getElementType ( sPlayerElement ) == "player" then local oldName = getPlayerName ( sPlayerElement ) setElementData ( sPlayerElement, "Brito_PossuiRG", "Não" ) outputChatBox ( "Retirado o RG de #ff0000" .. thePlayer, source, 255, 255, 255, true ) end else outputChatBox ( "#ff0000Jogador Não encontrado!", source, 255, 255, 255, true ) end end end addCommandHandler ( "tirarrg", tagPlayer2 ) ------------------------ addEventHandler("onPlayerCommand",root, function(command) if (command == "nick") then cancelEvent() end end)
  9. Hi guys! If someone can guide me on how to proceed: I have a dealership mod, in addition to it I have vehicle fuel mods and another one that counts the Mileage traveled, however, I wanted this data to be saved in the dealership that owns the purchased vehicle panel, that way when the player leaves the server or remove the car from the map, both KM and gasoline are saved! If someone can explain it to me! Thanks!
  10. Olá galera! Se alguem puder me orientar em como proceder: Tenho um mod de concessionária, além dele possuo mods de combustível dos veículos e outro que conta a Quilometragem percorrida, no entanto, eu queria que esses dados ficassem salvos na concessionária que possui o painel de veiculos comprados, dessa forma quando o player saísse do servidor ou removesse o carro do mapa, tanto o KM, quanto a gasolina ficassem salvos! Se alguem puder me explicar! Valeu!
  11. Olá galera, fiz o download do sistema de casas da versão do @Lord Henry aqui, no entanto to com uma duvida, queria que em vez de aparecer nas informações da casa o nome do dono como login (getAccountName), aparecesse o nickname do jogador (getPlayerName), Exemplo: Login da Conta: Teste123, Nick no jogo: Forum123 - Dessa forma, no script atual, aparece: Proprietário: Teste123 Preço: xxxx - Preciso que apareça: Proprietário: Forum123 Preço: xxxx local sqly = { Query = executeSQLQuery }; addEventHandler( 'onResourceStart', resourceRoot, function() sqly.Query( "CREATE TABLE IF NOT EXISTS housevip_data (\ ID INTEGER, en_X REAL, en_Y REAL, en_Z REAL,\ en_tX REAL, en_tY REAL, en_tZ REAL,\ ex_X REAL, ex_Y REAL, ex_Z REAL,\ ex_tX REAL, ex_tY REAL, ex_tZ REAL,\ int INTEGER, dim INTEGER, cost INTEGER,\ owner TEXT, subowner TEXT, user1 TEXT, user2 TEXT,\ user3 TEXT, rent1 INTEGER, rent2 INTEGER, rent3 INTEGER, tipe TEXT, status TEXT, key TEXT, creator TEXT )" ); for i, v in ipairs( getElementsByType( 'player' ) ) do setElementData( v, 'ke_len', tonumber( get( 'keyVipLength' ) ) ); local acc = getPlayerAccount( v ); if not isGuestAccount( acc ) then setElementData( v, 'HSV_accountName', getAccountName( acc ) ); end; setElementData( v, 'mark_in', nil ); end; local hr = sqly.Query( "SELECT * FROM housevip_data" ); for i = 1, #hr do createHouseVip( false, hr[i].ID, hr[i].owner, hr[i].subowner, hr[i].user1, hr[i].user2, hr[i].user3, hr[i].rent1, hr[i].rent2, hr[i].rent3, hr[i].status, hr[i].en_X, hr[i].en_Y, hr[i].en_Z, hr[i].en_tX, hr[i].en_tY, hr[i].en_tZ, hr[i].ex_X, hr[i].ex_Y, hr[i].ex_Z, hr[i].ex_tX, hr[i].ex_tY, hr[i].ex_tZ, hr[i].int, hr[i].dim, hr[i].cost, hr[i].tipe, hr[i].key, hr[i].creator ); end; end ); function resetHomeConfig(theStaff, cmd, theResource) if hasObjectPermissionTo (theStaff, "function.setResourceDefaultSetting", false) then if theResource == "sistema-home" then local metaXML = xmlLoadFile( "meta.xml" ) local settings = xmlFindChild( metaXML, "settings", 0 ) local setting01 = xmlFindChild ( settings, "setting", 0 ) local setting02 = xmlFindChild ( settings, "setting", 1 ) local setting03 = xmlFindChild ( settings, "setting", 2 ) local setting04 = xmlFindChild ( settings, "setting", 3 ) local setting05 = xmlFindChild ( settings, "setting", 4 ) local valor = xmlNodeGetAttribute ( setting01, "value" ) valor = string.gsub(valor, "%p", "") set ("*playerHomeCounter", tonumber (valor)) local valor = xmlNodeGetAttribute ( setting02, "value" ) valor = string.gsub(valor, "%p", "") set ("*keyVipLength", tonumber (valor)) local valor = xmlNodeGetAttribute ( setting03, "value" ) set ("*vipACL", valor) local valor = xmlNodeGetAttribute ( setting04, "value" ) set ("*premiumACL", valor) local valor = xmlNodeGetAttribute ( setting05, "value" ) valor = string.gsub(valor, "%p", "") set ("*rentTimer", tonumber (valor)) outputChatBox ("As configurações do resource '"..theResource.."' foram resetadas ao valor padrão.", theStaff) elseif not theResource then outputChatBox ("Erro de sintaxe: /reset <nome-do-resource>", theStaff) end else outputChatBox ("Você não tem acesso a este comando.", theStaff, 255, 50, 50) end end addCommandHandler("reset", resetHomeConfig) addEventHandler( 'onResourceStop', resourceRoot, function() for i, v in ipairs( getElementsByType( 'player' ) ) do setElementData( v, 'ke_len', nil ); setElementData( v, 'HSV_accountName', nil ); end; end ); addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'ke_len', tonumber( get( 'keyVipLength' ) ) ); end ); addEventHandler( 'onPlayerLogin', root, function( _, acc ) setElementData( source, 'HSV_accountName', getAccountName( acc ) ); end ); addEventHandler( 'onPlayerLogout', root, function( _, acc ) setElementData( source, 'HSV_accountName', nil ); end ); testMode = false --Não mexa aqui! addCommandHandler( 'home', function( theStaff ) if hasObjectPermissionTo (theStaff, "command.home", false) then --Se o jogador tem essa permissão, faz o seguinte: if testMode == true then --Se estiver em modo teste, manda a mensagem abaixo e nada acontece. outputChatBox( 'O resource associado com este comando está em modo testes. Portanto, este comando está indisponível.', theStaff, 255, 0, 0 ); else --Se não estiver em modo teste, faz o seguinte: if not getElementData( theStaff, 'HPV_Opened' ) and not getElementData( theStaff, 'mark_in' ) then --Se o painel de criação de casas não estiver aberto, faz o seguinte: triggerClientEvent( theStaff, 'HPV_SetVisible', root, true ); --Abre o painel de criação de casas. end; end else --Se o jogador não tem a permissão, manda a mensagem abaixo e nada acontece. outputChatBox( 'Você não possui permissão para usar este comando.', theStaff, 255, 0, 0 ); end end); --Por padrão, coloquei a permissão na ACL Group 'autogroup_sistema-home', basta adicionar seu 'user.login' lá para obter acesso. --Ao instalar este resource pela primeira vez, ele vai solicitar permissão aos comandos descritos no meta.xml, autorize todos eles com o comando /aclrequest allow sistema-home all --Tenha certeza de que existam os ACL Groups que estão configurados nos settings deste resource. Você pode alterá-los, caso necessário. Por padrão é 'Vip' e 'Premium'. --É necessário reiniciar este resource depois de alterar alguma configuração dele. addEvent( 'onPlayerAttemptCreateHouseVip', true ); addEventHandler( 'onPlayerAttemptCreateHouseVip', root, function( rt ) createHouseVip( true, #sqly.Query( "SELECT * FROM housevip_data" ) + 1, '', '', '', '', '', '', '', '', 'closed', rt[1], rt[2], rt[3], rt[4], rt[5], rt[6], rt[7], rt[8], rt[9], rt[10], rt[11], rt[12], rt[13], rt[14], rt[15], rt[16], '', rt[17]); end ); function createHouseVip( add, ID, owner, subowner, user1, user2, user3, rent1, rent2, rent3, status, eX, eY, eZ, etX, etY, etZ, exX, exY, exZ, extX, extY, extZ, int, dim, cost, tipe, key, creator ) if add then sqly.Query("INSERT INTO housevip_data (ID, en_X, en_Y, en_Z, en_tX, en_tY, en_tZ, ex_X, ex_Y, ex_Z, ex_tX, ex_tY, ex_tZ, int, dim, cost, owner, subowner, user1, user2, user3, rent1, rent2, rent3, tipe, status, key, creator) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", ID, eX, eY, eZ, etX, etY, etZ, exX, exY, exZ, extX, extY, extZ, int, dim, cost, "", "", "", "", "", "", "", "", tipe, status, "", creator); -- outputChatBox (tostring(add), client) --Use para testes, para verificar se os valores passados estão corretos. -- outputChatBox ("ID: "..tostring(ID), client) -- outputChatBox ("Owner: "..tostring(owner), client) -- outputChatBox ("SubOwner: "..tostring(subowner), client) -- outputChatBox ("User1: "..tostring(user1), client) -- outputChatBox ("User2: "..tostring(user2), client) -- outputChatBox ("User3: "..tostring(user3), client) -- outputChatBox ("Rent1: "..tostring(rent1), client) -- outputChatBox ("Rent2: "..tostring(rent2), client) -- outputChatBox ("Rent3: "..tostring(rent3), client) -- outputChatBox ("Status: "..tostring(status), client) -- outputChatBox ("eX: "..tostring(eX), client) -- outputChatBox ("eY: "..tostring(eY), client) -- outputChatBox ("eZ: "..tostring(eZ), client) -- outputChatBox ("etX: "..tostring(etX), client) -- outputChatBox ("etY: "..tostring(etY), client) -- outputChatBox ("etZ: "..tostring(etZ), client) -- outputChatBox ("exX: "..tostring(exX), client) -- outputChatBox ("exY: "..tostring(exY), client) -- outputChatBox ("exZ: "..tostring(exZ), client) -- outputChatBox ("extX: "..tostring(extX), client) -- outputChatBox ("extY: "..tostring(extY), client) -- outputChatBox ("extZ: "..tostring(extZ), client) -- outputChatBox ("int: "..tostring(int), client) -- outputChatBox ("dim: "..tostring(dim), client) -- outputChatBox ("cost: "..tostring(cost), client) -- outputChatBox ("tipe: "..tostring(tipe), client) -- outputChatBox ("key: "..tostring(key), client) -- outputChatBox ("creator: "..tostring(creator), client) outputChatBox( 'A casa #'..ID..' foi criada com sucesso!', client, 255, 255, 0 ); end; local m_Enter = createMarker( eX, eY, eZ - 1, 'cylinder', 1.25, 255, 255, 0, 150 ); --Cria amarelo, o original é (0, 153, 255, 150) setElementData( m_Enter, 'HSV_INFO', { etX, etY, etZ, int, dim, cost, owner, subowner, ID, user1, user2, user3, rent1, rent2, rent3, status, tipe, key, creator } ); -- 'HSV_INFO' [1] = etX -- 'HSV_INFO' [2] = etY -- 'HSV_INFO' [3] = etZ -- 'HSV_INFO' [4] = int -- 'HSV_INFO' [5] = dim -- 'HSV_INFO' [6] = cost -- 'HSV_INFO' [7] = owner -- 'HSV_INFO' [8] = subowner (antes era key) -- 'HSV_INFO' [9] = ID -- 'HSV_INFO'[10] = user1 -- 'HSV_INFO'[11] = user2 -- 'HSV_INFO'[12] = user3 -- 'HSV_INFO'[13] = rent1 -- 'HSV_INFO'[14] = rent2 -- 'HSV_INFO'[15] = rent3 -- 'HSV_INFO'[16] = status -- 'HSV_INFO'[17] = tipe (era pra ser type, mas essa palavra é reservada na programação) -- 'HSV_INFO'[18] = key -- 'HSV_INFO'[19] = creator if getElementData( m_Enter, 'HSV_INFO' )[7] ~= '' then --Se a casa tem dono (dono é diferente de vazio), independente do tipo então: setMarkerColor( m_Enter, 255, 51, 36, 150 ); --Muda o marker para vermelho. elseif getElementData( m_Enter, 'HSV_INFO' )[7] == '' and getElementData( m_Enter, 'HSV_INFO' )[17] == 'Free' then --Se a casa não tem dono e o tipo dela é 'Free', então: setMarkerColor( m_Enter, 0, 153, 255, 150 ); --Muda o marker para azul ciano. elseif getElementData( m_Enter, 'HSV_INFO' )[7] == '' and getElementData( m_Enter, 'HSV_INFO' )[17] == 'Reserved' then --Se a casa não tem dono e o tipo dela for 'Reserved', então: setMarkerColor( m_Enter, 255, 255, 255, 150 ); --Muda o marker para Branco. end; --Se a casa não tem dono e o tipo dela for VIP, continua amarelo. addEventHandler( 'onMarkerHit', m_Enter, function( player, dim ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) and dim then if not getElementData( player, 'HPV_Opened' ) then if not isGuestAccount( getPlayerAccount( player ) ) then setElementData( player, 'mark_in', getElementData( source, 'HSV_INFO' )[9] ); onPlayerHouseMarkerHit( player, source, true ); setElementFrozen( player, true ); else outputChatBox( 'Você precisa estar logado para abrir o painel desta casa!', player, 255, 51, 36 ); end; end; end; end); addEventHandler( 'onMarkerLeave', m_Enter, function( player ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then setElementData( player, 'mark_in', nil ); end; end ); local m_Exit = createMarker( exX, exY, exZ - 1, 'cylinder', 1.25, 0, 153, 255, 150 ); setElementData( m_Exit, 'parent', m_Enter ); setElementInterior( m_Exit, int ); setElementDimension( m_Exit, dim ); setElementData( m_Exit, 'extX', extX ); setElementData( m_Exit, 'extY', extY ); setElementData( m_Exit, 'extZ', extZ ); addEventHandler( 'onMarkerHit', m_Exit, function( player, dim ) if getElementType( player ) == 'player' and dim then toggleAllControls( player, false ); fadeCamera( player, false ); setTimer( function( player, mark ) if getPedOccupiedVehicle( player ) then removePedFromVehicle( player ); end; local x, y, z = getElementData( mark, 'extX' ), getElementData( mark, 'extY' ), getElementData( mark, 'extZ' ); setElementPosition( player, x, y, z ); setElementInterior( player, 0 ); setElementDimension( player, 0 ); toggleAllControls( player, true ); fadeCamera( player, true ); end, 1200, 1, player, source ); end; end ); end; function onPlayerHouseMarkerHit( player, mark, cursor ) local acc = getPlayerAccount( player ); local housetype = getElementData( mark, 'HSV_INFO' )[17]; if isGuestAccount( acc ) then outputChatBox( 'Você precisa estar logado para abrir o painel desta casa!', player, 255, 51, 36 ); setElementData( player, 'mark_in', nil ); setElementFrozen( player, false ); return false; end; local tts = { [1] = false, [2] = false, [3] = false, [4] = false, [5] = false, [6] = false, [7] = false }; local owner = getElementData( mark, 'HSV_INFO' )[7]; local subowner = getElementData( mark, 'HSV_INFO' )[8]; local resident1 = getElementData( mark, 'HSV_INFO' )[10]; local resident2 = getElementData( mark, 'HSV_INFO' )[11]; local resident3 = getElementData( mark, 'HSV_INFO' )[12]; local accName = getAccountName( acc ); local status = getElementData( mark, 'HSV_INFO' )[16]; if housetype == 'Free' then if owner == '' then--If the house has not an owner. (owner is empty) tts[1] = true;--The player can buy the house. if hasObjectPermissionTo( player, 'command.ban', false ) then--If the players is a SuperModerator or above. tts[4] = true;--Can Enter the house. end; elseif owner ~= '' then --If the house have an owner. if subowner == accName then--If the player is the sub owner, he can't buy the house because it already has an owner, he can do everything except delete the house, sell the house and change ownership. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif owner == accName then--If the player is the owner, he can't buy the house because it already has an owner, he can do everything except delete the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = true; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif resident1 == accName or resident2 == accName or resident3 == accName then --If the player is one of the residents, he can enter the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. elseif status == 'opened' then tts[1] = false; --1=Buy tts[2] = false; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. end if accName == "guest" then --If the player is logged with an account named 'guest' then he can do nothing. (this is different from not logged) tts[1] = false; tts[2] = false; tts[3] = false; tts[4] = false; tts[5] = false; tts[6] = false; outputChatBox ("Sua conta 'guest' é ilegal, você não pode usar o painel de casas.", player, 255, 51, 36 ); --Tell him that the account 'guest' is ilegal. end; end; if hasObjectPermissionTo( player, 'command.delete', false ) then --If he is Admin or above, he can delete the house. tts[7] = true; --7=Delete house end; elseif housetype == 'VIP' then if owner == '' then if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup(get('vipACL')) ) then--If the player is VIP. tts[1] = true;--Can buy the house. end if hasObjectPermissionTo( player, 'command.ban', false ) then tts[4] = true;--Can Enter the house. end; elseif owner ~= '' then --If the house have an owner. if subowner == accName then--If the player is the sub owner, he can't buy the house because it already has an owner, he can do everything except delete the house, sell the house and change ownership. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif owner == accName then--If the player is the owner, he can't buy the house because it already has an owner, he can do everything except delete the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = true; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif resident1 == accName or resident2 == accName or resident3 == accName then --If the player is one of the residents, he can enter the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. elseif status == 'opened' then tts[1] = false; --1=Buy tts[2] = false; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. end if accName == "guest" then --If the player is logged with an account named 'guest' then he can do nothing. (this is different from not logged) tts[1] = false; tts[2] = false; tts[3] = false; tts[4] = false; tts[5] = false; tts[6] = false; outputChatBox ("Sua conta 'guest' é ilegal, você não pode usar o painel de casas.", player, 255, 51, 36 ); --Tell him that the account 'guest' is ilegal. end; end; if hasObjectPermissionTo( player, 'command.delete', false ) then --If he is Admin or above, he can delete the house. tts[7] = true; --7=Delete house end; if isObjectInACLGroup ('user.'..getAccountName (acc), aclGetGroup ('Console')) or isObjectInACLGroup ('user.'..getAccountName (acc), aclGetGroup ('Sub-Dono')) then--If the player is Console, he can Delete the house. tts[7] = true; --7=Delete house end; elseif housetype == 'Reserved' then if owner == '' then if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup(get('premiumACL')) ) then--If the player is Premium. (the player needs to be added here temporaly, after he buys the house, he needs to be removed from this ACL or he will have permission to buy all the Reserved houses.) tts[1] = true;--Can buy the house. end if hasObjectPermissionTo( player, 'command.ban', false ) then tts[4] = true;--Can Enter the house. end; elseif owner ~= '' then --If the house have an owner. if subowner == accName then--If the player is the sub owner, he can't buy the house because it already has an owner, he can do everything except delete the house, sell the house and change ownership. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif owner == accName then--If the player is the owner, he can't buy the house because it already has an owner, he can do everything except delete the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = true; --3=Change Status tts[4] = true; --4=Enter House tts[5] = true; --5=Give Ownership to sub owner. tts[6] = true; --6=Add Resident or sub owner. elseif resident1 == accName or resident2 == accName or resident3 == accName then --If the player is one of the residents, he can enter the house. tts[1] = false; --1=Buy tts[2] = true; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. elseif status == 'opened' then tts[1] = false; --1=Buy tts[2] = false; --2=Sell/Leave tts[3] = false; --3=Change Status tts[4] = true; --4=Enter House tts[5] = false; --5=Give Ownership to sub owner. tts[6] = false; --6=Add Resident or sub owner. end if accName == "guest" then --If the player is logged with an account named 'guest' then he can do nothing. (this is different from not logged) tts[1] = false; tts[2] = false; tts[3] = false; tts[4] = false; tts[5] = false; tts[6] = false; outputChatBox ("Sua conta 'guest' é ilegal, você não pode usar o painel de casas.", player, 255, 51, 36 ); --Tell him that the account 'guest' is ilegal. end; end; if isObjectInACLGroup ('user.'..getAccountName (acc), aclGetGroup ('Console')) or isObjectInACLGroup ('user.'..getAccountName (acc), aclGetGroup ('Sub-Dono')) then--If the player is Console, he can Delete the house. tts[7] = true; --7=Delete house end; end tts[8] = getElementData( mark, 'HSV_INFO' )[9]; -- ID tts[9] = getElementData( mark, 'HSV_INFO' )[7]; -- Owner tts[10] = getElementData( mark, 'HSV_INFO' )[6]; -- Cost tts[11] = getElementData( mark, 'HSV_INFO' )[8]; -- Sub Owner tts[12] = getElementData( mark, 'HSV_INFO' )[10]; -- Resident 1 tts[13] = getElementData( mark, 'HSV_INFO' )[11]; -- Resident 2 tts[14] = getElementData( mark, 'HSV_INFO' )[12]; -- Resident 3 tts[15] = getElementData( mark, 'HSV_INFO' )[13]; -- Rent 1 tts[16] = getElementData( mark, 'HSV_INFO' )[14]; -- Rent 2 tts[17] = getElementData( mark, 'HSV_INFO' )[15]; -- Rent 3 tts[18] = status; tts[19] = housetype; if isObjectInACLGroup ('user.'..getAccountName (acc), aclGetGroup ('Admin')) or hasObjectPermissionTo( player, 'command.delete', false ) then --If the player is Admin or above, he can see the hidden infos. tts[20] = true; --20=Hidden infos button. else tts[20] = false; end; tts[21] = getElementData( mark, 'HSV_INFO' )[19]; -- House Creator setTimer(triggerClientEvent, 500, 1, player, 'openHouseManagementWndVip', root, tts, cursor ); end; addEvent( 'HOUSEVIP_Buy', true ); addEventHandler( 'HOUSEVIP_Buy', root, function( cost ) local accName = getAccountName( getPlayerAccount( client ) ); local houseCounter = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) then local owner = getElementData( v, 'HSV_INFO' )[7]; local subowner = getElementData( v, 'HSV_INFO' )[8]; local resident1 = getElementData( v, 'HSV_INFO' )[10]; local resident2 = getElementData( v, 'HSV_INFO' )[11]; local resident3 = getElementData( v, 'HSV_INFO' )[12]; if owner == accName or subowner == accName or resident1 == accName or resident2 == accName or resident3 == accName then houseCounter = houseCounter + 1; end; end; end; if houseCounter >= tonumber( get( 'playerHomeCounter' ) ) then outputChatBox( 'Você não pode ter mais do que #00FF00'..get( 'playerHomeCounter' )..' casas#FF3324 ao mesmo tempo!', client, 255, 51, 36, true ); setElementFrozen( client, false ); return false; end; if getPlayerMoney( client ) >= tonumber( cost ) then outputChatBox( 'Parabéns! Você comprou uma casa!', client, 255, 255, 0 ); sqly.Query( "UPDATE housevip_data SET owner = '"..accName.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); takePlayerMoney( client, cost ); local mark = getHouseByID( getElementData( client, 'mark_in' ) ); local t = {}; for i = 1, 19 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; t[7] = accName; if getElementData( mark, 'HSV_INFO' )[17] == 'Reserved' then aclGroupRemoveObject (aclGetGroup(get('premiumACL')), "user."..accName) outputChatBox( 'Você gastou sua permissão de comprar casas reservadas.', client); end setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); setMarkerColor( mark, 255, 51, 36, 150 ); -- Red Color setTimer( onPlayerHouseMarkerHit, 500, 1, client, mark, true ); else outputChatBox( 'Você não tem dinheiro suficiente!', client, 255, 51, 36 ); onPlayerHouseMarkerHit( client, getHouseByID( getElementData( client, 'mark_in' ) ), true ); end; end ); addEvent( 'HOUSEVIP_Sell', true ); addEventHandler( 'HOUSEVIP_Sell', root, function() sqly.Query( "UPDATE housevip_data SET owner=?, subowner=?, user1=?, user2=?, user3=?, rent1=?, rent2=?, rent3=?, status=? WHERE ID = ?", "", "", "", "", "", "", "", "", "closed", getElementData( client, 'mark_in' ) ); local mark = getHouseByID( getElementData( client, 'mark_in' ) ); givePlayerMoney( client, getElementData( mark, 'HSV_INFO' )[6] / 2 ); --Returns half of the house value to the player. local t = {}; for i = 1, 6 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; t[7] = ''; --Owner t[8] = ''; --Sub owner t[9] = getElementData( client, 'mark_in' ); --ID for i = 10, 15 do t[i] = ''; end; t[16] = 'closed' t[17] = getElementData( mark, 'HSV_INFO' )[17]; t[18] = ''; t[19] = getElementData( mark, 'HSV_INFO' )[19]; setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); if getElementData( mark, 'HSV_INFO' )[17] == 'Free' then setMarkerColor( mark, 0, 153, 255, 150 ); --Cyan Blue color elseif getElementData( mark, 'HSV_INFO' )[17] == 'VIP' then setMarkerColor( mark, 255, 255, 0, 150 ); --Yellow color elseif getElementData( mark, 'HSV_INFO' )[17] == 'Reserved' then setMarkerColor( mark, 255, 255, 255, 150 ); --White color else setMarkerColor( mark, 0, 0, 0, 150 ); --Black color, this indicates that an error happened. outputChatBox ("Tipo: "..tostring(getElementData( mark, 'HSV_INFO' )[17])) end setTimer( onPlayerHouseMarkerHit, 500, 1, client, mark, false ); end); addEvent( 'HOUSEVIP_Leave', true ); addEventHandler( 'HOUSEVIP_Leave', root, function(user) local mark = getHouseByID( getElementData( client, 'mark_in' ) ); local t = {}; for i = 1, 19 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; if user == 0 then sqly.Query( "UPDATE housevip_data SET subowner=? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); t[8] = ''; --Sub owner elseif user == 1 then sqly.Query( "UPDATE housevip_data SET user1=?, rent1=? WHERE ID = ?", "", "", getElementData( client, 'mark_in' ) ); t[10] = ''; --User1 t[13] = ''; --Rent1 elseif user == 2 then sqly.Query( "UPDATE housevip_data SET user2=?, rent2=? WHERE ID = ?", "", "", getElementData( client, 'mark_in' ) ); t[11] = ''; --User2 t[14] = ''; --Rent2 elseif user == 3 then sqly.Query( "UPDATE housevip_data SET user3=?, rent3=? WHERE ID = ?", "", "", getElementData( client, 'mark_in' ) ); t[12] = ''; --User3 t[15] = ''; --Rent3 end setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); setTimer( onPlayerHouseMarkerHit, 500, 1, client, mark, false ); end); addEvent( 'HOUSEVIP_Enter', true ); addEventHandler( 'HOUSEVIP_Enter', root, function() setElementFrozen( client, false ); local mark = getHouseByID( getElementData( client, 'mark_in' ) ); local t = {}; for i = 1, 5 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; fadeCamera( client, false ); toggleAllControls( client, false ); setTimer( function( player, t ) if getPedOccupiedVehicle( player ) then removePedFromVehicle( player ); end; setElementInterior( player, t[4], t[1], t[2], t[3] ); setElementDimension( player, t[5] ); toggleAllControls( player, true ); fadeCamera( player, true ); setElementData( player, 'mark_in', nil ) end, 1200, 1, client, t ); end ); addEvent( 'HOUSEVIP_ChangeKey', true ); addEventHandler( 'HOUSEVIP_ChangeKey', root, function(opened, key) local mark = getHouseByID( getElementData( client, 'mark_in' ) ); local t = {}; for i = 1, 19 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; -- t[9] = getElementData( client, 'mark_in' ); --ID if opened == true then t[16] = "opened"; else t[16] = "closed"; end sqly.Query( "UPDATE housevip_data SET status = '"..t[16].."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); if key ~= '' then t[18] = key; else t[18] = ""; end sqly.Query( "UPDATE housevip_data SET key = '"..t[18].."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); end ); addEvent( 'HOUSEVIP_ChangeOwner', true ); addEventHandler( 'HOUSEVIP_ChangeOwner', root, function( name ) local mark = getHouseByID( getElementData( client, 'mark_in' ) ); local subowner = getAccountName( getPlayerAccount(client) ); sqly.Query( "UPDATE housevip_data SET owner = '"..name.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); sqly.Query( "UPDATE housevip_data SET subowner = '"..subowner.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); local t = {}; for i = 1, 19 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; t[7] = name t[8] = subowner t[9] = getElementData( client, 'mark_in' ); setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); setTimer( onPlayerHouseMarkerHit, 500, 1, client, mark, false ); if isElement (getPlayerByAccountName( name )) then outputChatBox( '#FFFF00'..getPlayerName( client )..'#00FF00 transferiu a escritura da casa para você!', getPlayerByAccountName( name ), 0, 255, 0, true ); end end ); addEvent( 'HOUSEVIP_AddResidents', true ); addEventHandler( 'HOUSEVIP_AddResidents', root, function( subowner, user1, user2, user3, newRent1, newRent2, newRent3 ) local mark = getHouseByID( getElementData( client, 'mark_in' ) ); if subowner ~= false then local houseCounter0 = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) then local owner = getElementData( v, 'HSV_INFO' )[7]; local subOwn = getElementData( v, 'HSV_INFO' )[8]; local resident1 = getElementData( v, 'HSV_INFO' )[10]; local resident2 = getElementData( v, 'HSV_INFO' )[11]; local resident3 = getElementData( v, 'HSV_INFO' )[12]; if owner == subowner or subOwn == subowner or resident1 == subowner or resident2 == subowner or resident3 == subowner then houseCounter0 = houseCounter0 + 1; end; end; end; if houseCounter0 >= tonumber( get( 'playerHomeCounter' ) ) and subowner ~= getElementData( mark, 'HSV_INFO' )[8] then outputChatBox( 'O jogador cujo login informado em Sub-Dono já atingiu o limite de #00FF00'..get( 'playerHomeCounter' )..' casas#FF3324 ao mesmo tempo!', client, 255, 51, 36, true ); subowner = false end; end; if user1 ~= false then local houseCounter1 = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) then local owner = getElementData( v, 'HSV_INFO' )[7]; local subowner = getElementData( v, 'HSV_INFO' )[8]; local resident1 = getElementData( v, 'HSV_INFO' )[10]; local resident2 = getElementData( v, 'HSV_INFO' )[11]; local resident3 = getElementData( v, 'HSV_INFO' )[12]; if owner == user1 or subowner == user1 or resident1 == user1 or resident2 == user1 or resident3 == user1 then houseCounter1 = houseCounter1 + 1; end; end; end; if houseCounter1 >= tonumber( get( 'playerHomeCounter' ) ) and user1 ~= getElementData( mark, 'HSV_INFO' )[10] then outputChatBox( 'O jogador cujo login informado em Morador 1 já atingiu o limite de #00FF00'..get( 'playerHomeCounter' )..' casas#FF3324 ao mesmo tempo!', client, 255, 51, 36, true ); user1 = false newRent1 = false end; end; if user2 ~= false then local houseCounter2 = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) then local owner = getElementData( v, 'HSV_INFO' )[7]; local subowner = getElementData( v, 'HSV_INFO' )[8]; local resident1 = getElementData( v, 'HSV_INFO' )[10]; local resident2 = getElementData( v, 'HSV_INFO' )[11]; local resident3 = getElementData( v, 'HSV_INFO' )[12]; if owner == user2 or subowner == user2 or resident1 == user2 or resident2 == user2 or resident3 == user2 then houseCounter2 = houseCounter2 + 1; end; end; end; if houseCounter2 >= tonumber( get( 'playerHomeCounter' ) ) and user2 ~= getElementData( mark, 'HSV_INFO' )[11] then outputChatBox( 'O jogador cujo login informado em Morador 2 já atingiu o limite de #00FF00'..get( 'playerHomeCounter' )..' casas#FF3324 ao mesmo tempo!', client, 255, 51, 36, true ); user2 = false newRent2 = false end; end; if user3 ~= false then local houseCounter3 = 0; for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) then local owner = getElementData( v, 'HSV_INFO' )[7]; local subowner = getElementData( v, 'HSV_INFO' )[8]; local resident1 = getElementData( v, 'HSV_INFO' )[10]; local resident2 = getElementData( v, 'HSV_INFO' )[11]; local resident3 = getElementData( v, 'HSV_INFO' )[12]; if owner == user3 or subowner == user3 or resident1 == user3 or resident2 == user3 or resident3 == user3 then houseCounter3 = houseCounter3 + 1; end; end; end; if houseCounter3 >= tonumber( get( 'playerHomeCounter' ) ) and user3 ~= getElementData( mark, 'HSV_INFO' )[12] then outputChatBox( 'O jogador cujo login informado em Morador 3 já atingiu o limite de #00FF00'..get( 'playerHomeCounter' )..' casas#FF3324 ao mesmo tempo!', client, 255, 51, 36, true ); user3 = false newRent3 = false end; end; local t = {}; for i = 1, 9 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; if subowner == 'guest' or subowner == false then -- If the login informed is empty or the player is logged out. t[8] = ''; sqly.Query( "UPDATE housevip_data SET subowner = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); else sqly.Query( "UPDATE housevip_data SET subowner = '"..subowner.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[8] = subowner end if user1 == 'guest' or user1 == false then t[10] = '' sqly.Query( "UPDATE housevip_data SET user1 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); newRent1 = false else sqly.Query( "UPDATE housevip_data SET user1 = '"..user1.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[10] = user1 end if newRent1 == false then t[13] = ''; sqly.Query( "UPDATE housevip_data SET rent1 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); else sqly.Query( "UPDATE housevip_data SET rent1 = '"..newRent1.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[13] = newRent1 end if user2 == 'guest' or user2 == false then t[11] = '' sqly.Query( "UPDATE housevip_data SET user2 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); newRent2 = false else sqly.Query( "UPDATE housevip_data SET user2 = '"..user2.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[11] = user2 end if newRent2 == false then t[14] = ''; sqly.Query( "UPDATE housevip_data SET rent2 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); else sqly.Query( "UPDATE housevip_data SET rent2 = '"..newRent2.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[14] = newRent2 end if user3 == 'guest' or user3 == false then t[12] = '' sqly.Query( "UPDATE housevip_data SET user3 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); newRent3 = false else sqly.Query( "UPDATE housevip_data SET user3 = '"..user3.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[12] = user3 end if newRent3 == false then t[15] = ''; sqly.Query( "UPDATE housevip_data SET rent3 = ? WHERE ID = ?", "", getElementData( client, 'mark_in' ) ); else sqly.Query( "UPDATE housevip_data SET rent3 = '"..newRent3.."' WHERE ID = ?", getElementData( client, 'mark_in' ) ); t[15] = newRent3 end for i = 16, 19 do t[i] = getElementData( mark, 'HSV_INFO' )[i]; end; setElementData( mark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19] } ); end ); addEvent( 'HOUSEVIP_Destroy', true ); addEventHandler( 'HOUSEVIP_Destroy', root, function() local mark = getHouseByID( getElementData( client, 'mark_in' ) ); if getElementData (mark, 'HSV_INFO' )[19] ~= "Console" then for ii, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'parent' ) == mark then destroyElement( v ); end; end; local hr = sqly.Query( "SELECT * FROM housevip_data" ); for i = getElementData( source, 'mark_in' ), #hr do if getHouseByID( i ) ~= mark then sqly.Query( "UPDATE housevip_data SET ID = "..( i - 1 ).." WHERE ID = ?", i ); local res = sqly.Query( "SELECT owner, key FROM housevip_data WHERE ID = ?", i - 1 ); local nextmark = getHouseByID( i ); local t = {}; for i = 1, 6 do t[i] = getElementData( nextmark, 'HSV_INFO' )[i]; end; t[7] = res[1].owner; t[8] = res[1].key; t[9] = i - 1; setElementData( nextmark, 'HSV_INFO', { t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9] } ); local player = getPlayerByHouseID( i - 1 ); setElementData( player, 'mark_in', i - 1 ); else sqly.Query( "DELETE FROM housevip_data WHERE ID = ?", i ); destroyElement( mark ); end; end; outputChatBox ('Casa #'..getElementData( source, 'mark_in' )..' foi destruída!', source, 255, 255, 0); setElementFrozen (source, false); setElementData (source, 'mark_in', nil); else outputChatBox ('Casas criadas pelo Console não podem ser destruídas in-game.', source, 255, 150, 0); end end ); function getHouseByID( id ) for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do if getElementData( v, 'HSV_INFO' ) and getElementData( v, 'HSV_INFO' )[9] == id then return v; end; end; return false; end; function getPlayerByHouseID( id ) for i, v in ipairs( getElementsByType( 'player' ) ) do if getElementData( v, 'mark_in' ) == id then return v; end; end; return false; end; addEvent( 'setFrozen', true ); addEventHandler( 'setFrozen', root, function( state ) setElementFrozen( client, state ); end ); addEventHandler( 'onPlayerWasted', root, function() if getElementData( source, 'mark_in' ) then setElementData( source, 'mark_in', nil ); setElementFrozen( source, false ); end; end ); function getPlayerByAccountName( name ) for i, v in ipairs( getElementsByType( 'player' ) ) do if getElementData( v, 'HSV_accountName' ) == name then return v; end; end; return false; end; timerRent = tonumber (get( 'rentTimer' )*60000) rentTimer = setTimer (function () for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do --Para cada elemento do tipo marker criado: local housev = getHouseByID (i) --Verifica se o marker é uma casa. Se não for, então isso é false. if housev then --Se o marker for qualquer coisa exceto false ou nulo: (se for false então não é um marker de casa) local ownerv = getElementData (housev, 'HSV_INFO')[7] --ownerv recebe o dono desta casa. local userv1 = getPlayerByAccountName (getElementData (housev, 'HSV_INFO')[10]) --recebe o morador1 local userv2 = getPlayerByAccountName (getElementData (housev, 'HSV_INFO')[11]) --morador2 local userv3 = getPlayerByAccountName (getElementData (housev, 'HSV_INFO')[12]) --3 local rentv1 = getElementData (housev, 'HSV_INFO')[13] --recebe o aluguel1 if rentv1 == '' then --Se o valor do aluguel1 for vazio, então recebe 0. rentv1 = 0 end local rentv2 = getElementData (housev, 'HSV_INFO')[14] --recebe o aluguel2 if rentv2 == '' then rentv2 = 0 end local rentv3 = getElementData (housev, 'HSV_INFO')[15] --recebe o aluguel3 if rentv3 == '' then rentv3 = 0 end for int, players in ipairs( getElementsByType( 'player' ) ) do --Para cada jogador do servidor: local accv = getAccountName (getPlayerAccount (players)) --Recebe a conta deste jogador. if ownerv == accv then --Se o dono da casa for este jogador: if isElement (userv1) and getElementType (userv1) == 'player' then if getPlayerMoney (userv1) >= tonumber(rentv1) then outputChatBox ("O #fff000morador 1#E7D9B0 da sua casa #fff000ID "..i.."#E7D9B0 te pagou o aluguel de #00ff00$"..rentv1, players, 231, 217, 176, true) outputChatBox ("Você pagou o aluguel da cada #fff000ID "..i.."#E7D9B0 no valor de #00ff00$"..rentv1, userv1, 231, 217, 176, true) takePlayerMoney (userv1, tonumber(rentv1)) givePlayerMoney (players, tonumber(rentv1)) else outputChatBox ("O #fff000morador 1#FF3324 da sua casa #fff000ID "..i.."#FF3324 não pagou o aluguel de #fff000$"..rentv1.."#FF3324 pois não possui dinheiro suficiente.", players, 255, 51, 36, true) outputChatBox ("Você não tem dinheiro suficiente para pagar o aluguel da cada #fff000ID "..i.."#FF3324 no valor de #fff000$"..rentv1..".#FF3324 O dono da casa foi notificado.", userv1, 255, 51, 36, true) end end if isElement (userv2) and getElementType (userv2) == 'player' then if getPlayerMoney (userv2) >= tonumber(rentv2) then outputChatBox ("O #fff000morador 2#E7D9B0 da sua casa #fff000ID "..i.."#E7D9B0 te pagou o aluguel de #00ff00$"..rentv2, players, 231, 217, 176, true) outputChatBox ("Você pagou o aluguel da cada #fff000ID "..i.."#E7D9B0 no valor de #00ff00$"..rentv2, userv2, 231, 217, 176, true) takePlayerMoney (userv2, tonumber(rentv2)) givePlayerMoney (players, tonumber(rentv2)) else outputChatBox ("O #fff000morador 2#FF3324 da sua casa #fff000ID "..i.."#FF3324 não pagou o aluguel de #fff000$"..rentv2.."#FF3324 pois não possui dinheiro suficiente.", players, 255, 51, 36, true) outputChatBox ("Você não tem dinheiro suficiente para pagar o aluguel da cada #fff000ID "..i.."#FF3324 no valor de #fff000$"..rentv2..".#FF3324 O dono da casa foi notificado.", userv2, 255, 51, 36, true) end end if isElement (userv3) and getElementType (userv3) == 'player' then if getPlayerMoney (userv3) >= tonumber(rentv3) then outputChatBox ("O #fff000morador 3#E7D9B0 da sua casa #fff000ID "..i.."#E7D9B0 te pagou o aluguel de #00ff00$"..rentv3, players, 231, 217, 176, true) outputChatBox ("Você pagou o aluguel da cada #fff000ID "..i.."#E7D9B0 no valor de #00ff00$"..rentv3, userv3, 231, 217, 176, true) takePlayerMoney (userv3, tonumber(rentv3)) givePlayerMoney (players, tonumber(rentv3)) else outputChatBox ("O #fff000morador 3#FF3324 da sua casa #fff000ID "..i.."#FF3324 não pagou o aluguel de #fff000$"..rentv3.."#FF3324 pois não possui dinheiro suficiente.", players, 255, 51, 36, true) outputChatBox ("Você não tem dinheiro suficiente para pagar o aluguel da cada #fff000ID "..i.."#FF3324 no valor de #fff000$"..rentv3..".#FF3324 O dono da casa foi notificado.", userv3, 255, 51, 36, true) end end end end end end end, timerRent, 0)
×
×
  • Create New...