Jump to content

zMpyster

Members
  • Posts

    111
  • Joined

  • Last visited

Posts posted by zMpyster

  1. 
    edit = {}
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            edit[1] = guiCreateEdit(470, 217, 45, 21, "", false)
    
    
            edit[2] = guiCreateEdit(470, 246, 45, 21, "", false)
    
    
            edit[3] = guiCreateEdit(470, 275, 45, 21, "", false)
    
    
            edit[4] = guiCreateEdit(470, 306, 45, 21, "", false)
    
    
            edit[5] = guiCreateEdit(470, 337, 45, 21, "", false)
    
    
            edit[6] = guiCreateEdit(470, 395, 45, 21, "", false)
    
    
            edit[7] = guiCreateEdit(470, 516, 45, 21, "", false)
    
    
            edit[8] = guiCreateEdit(470, 366, 45, 21, "", false)
    
    
            edit[9] = guiCreateEdit(470, 426, 45, 21, "", false)
    
    
            edit[10] = guiCreateEdit(470, 455, 45, 21, "", false)
    
    
            edit[11] = guiCreateEdit(470, 484, 45, 21, "", false)
    
    
            edit[12] = guiCreateEdit(642, 217, 45, 21, "", false)
    
    
            edit[13] = guiCreateEdit(642, 275, 45, 21, "", false)
    
    
            edit[14] = guiCreateEdit(642, 306, 45, 21, "", false)
    
    
            edit[15] = guiCreateEdit(642, 246, 45, 21, "", false)
    
    
            edit[16] = guiCreateEdit(642, 335, 45, 21, "", false)
    
    
            edit[17] = guiCreateEdit(799, 217, 45, 21, "", false)
    
    
            edit[18] = guiCreateEdit(642, 365, 45, 21, "", false)
    
    
            edit[19] = guiCreateEdit(642, 394, 45, 21, "", false)
    
    
            edit[20] = guiCreateEdit(799, 248, 45, 21, "", false)
    
    
            edit[21] = guiCreateEdit(642, 426, 45, 21, "", false)
    
    
            edit[22] = guiCreateEdit(642, 456, 45, 21, "", false)
    
    
            edit[23] = guiCreateEdit(642, 485, 45, 21, "", false)
    
    
            edit[24] = guiCreateEdit(799, 275, 45, 21, "", false)
    
    
            edit[25] = guiCreateEdit(642, 514, 45, 21, "", false)
    
    
            edit[26] = guiCreateEdit(799, 304, 45, 21, "", false)
    
    
            edit[27] = guiCreateEdit(799, 333, 45, 21, "", false)
    
    
            edit[28] = guiCreateEdit(799, 365, 45, 21, "", false)
    
    
            edit[29] = guiCreateEdit(799, 394, 45, 21, "", false)
    
    
            edit[30] = guiCreateEdit(799, 426, 45, 21, "", false)
    
    
            edit[31] = guiCreateEdit(799, 457, 45, 21, "", false)
    
    
            edit[32] = guiCreateEdit(798, 485, 45, 21, "", false)
    
    
            edit[33] = guiCreateEdit(880, 298, 55, 27, "", false)
    
    
            edit[34] = guiCreateEdit(954, 298, 55, 27, "", false)   
    	Visible(false)
        end
    ) 
    
    function Visible(confg)
    	for i=1, 34 do
    	guiSetVisible(edit[i], confg)
    	guiEditSetMaxLength ( edit[i], 4 )
    	end
    end
    
    function painelRemoverMultas()
            dxDrawRectangle(x*331, y*143, x*705, y*482, tocolor(0, 0, 0, 147), false)
            dxDrawRectangle(x*432, y*143, x*512, y*34, tocolor(255, 255, 255, 147), false)
            Texto("PAGAR MULTAS", 432, 143, 944, 177, tocolor(255, 255, 255, 255), 1.80, "default", "center", "center", false, false, false, false, false)
            if getElementData(localPlayer, "tomoumulta".. 445) then
    		Texto("Sandero:  ".. getElementData(localPlayer, "tomoumulta".. 445), 368, 219, 462, 238, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Sandero: 0", 368, 219, 462, 238, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 602) then
    		Texto("Porsche 911:  ".. getElementData(localPlayer, "tomoumulta".. 602), 358, 246, 452, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Porsche 911: 0", 358, 246, 452, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 536) then
    		Texto("SLK 350:  ".. getElementData(localPlayer, "tomoumulta".. 536), 375, 277, 460, 296, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("SLK 350: 0", 375, 277, 460, 296, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 483) then
    		Texto("Kombi:  ".. getElementData(localPlayer, "tomoumulta".. 483), 393, 306, 456, 325, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Kombi: 0", 393, 306, 456, 325, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 542) then
    		Texto("Corvette:  ".. getElementData(localPlayer, "tomoumulta".. 542), 383, 337, 452, 356, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Corvette: 0", 383, 337, 452, 356, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 419) then
    		Texto("Camaro SS:  ".. getElementData(localPlayer, "tomoumulta".. 419), 371, 426, 452, 445, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Camaro SS: 0", 371, 426, 452, 445, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 492) then
    		Texto("Honda Fit:  ".. getElementData(localPlayer, "tomoumulta".. 492), 377, 515, 453, 537, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Honda Fit: 0", 377, 515, 453, 537, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 589) then
    		Texto("BMW M235I:  ".. getElementData(localPlayer, "tomoumulta".. 589), 361, 368, 456, 387, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("BMW M235I: 0", 361, 368, 456, 387, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 507) then
    		Texto("Sonata:  ".. getElementData(localPlayer, "tomoumulta".. 507), 393, 397, 453, 416, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Sonata: 0", 393, 397, 453, 416, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 466) then
    		Texto("Civic Ferio:  ".. getElementData(localPlayer, "tomoumulta".. 466), 379, 455, 452, 474, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Civic Ferio: 0", 379, 455, 452, 474, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 604) then
    		Texto("Uno-S:  ".. getElementData(localPlayer, "tomoumulta".. 604), 398, 484, 453, 505, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Uno-S: 0", 398, 484, 453, 505, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		Texto("VEÍCULO | MULTAS", 348, 186, 525, 201, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
            Texto("VEÍCULO | MULTAS", 515, 186, 692, 201, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
            if getElementData(localPlayer, "tomoumulta".. 494) then
    		Texto("Ferrari FF:  ".. getElementData(localPlayer, "tomoumulta".. 494), 542, 217, 636, 236, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Ferrari FF: 0", 542, 217, 636, 236, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 502) then
    		Texto("GranTurismo:  ".. getElementData(localPlayer, "tomoumulta".. 502), 535, 246, 629, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("GranTurismo: 0", 535, 246, 629, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 411) then
    		Texto("Zonda:  ".. getElementData(localPlayer, "tomoumulta".. 411), 564, 306, 629, 325, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Zonda: 0", 564, 306, 629, 325, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end       
    		if getElementData(localPlayer, "tomoumulta".. 404) then
    		Texto("Logan:  ".. getElementData(localPlayer, "tomoumulta".. 404), 569, 425, 622, 447, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Logan: 0", 569, 425, 622, 447, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 500) then
    		Texto("Jipe:  ".. getElementData(localPlayer, "tomoumulta".. 500), 579, 394, 624, 413, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Jipe: 0", 579, 394, 624, 413, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 579) then
    		Texto("Palio EX:  ".. getElementData(localPlayer, "tomoumulta".. 579), 558, 275, 629, 296, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Palio EX: 0", 558, 275, 629, 296, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 603) then
    		Texto("Gallardo:  ".. getElementData(localPlayer, "tomoumulta".. 603), 544, 456, 638, 475, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Gallardo: 0", 544, 456, 638, 475, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 551) then
    		Texto("Fusion:  ".. getElementData(localPlayer, "tomoumulta".. 551), 567, 365, 624, 384, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Fusion: 0", 567, 365, 624, 384, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 559) then
    		Texto("Audi TT:  ".. getElementData(localPlayer, "tomoumulta".. 559), 558, 335, 624, 355, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Audi TT: 0", 558, 335, 624, 355, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 600) then
    		Texto("Montana:  ".. getElementData(localPlayer, "tomoumulta".. 600), 554, 484, 624, 504, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Montana: 0", 554, 484, 624, 504, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 534) then
    		Texto("Focus:  ".. getElementData(localPlayer, "tomoumulta".. 534), 735, 217, 787, 236, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Focus: 0", 735, 217, 787, 236, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 580) then
    		Texto("Fox:  ".. getElementData(localPlayer, "tomoumulta".. 580), 745, 275, 788, 295, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Fox: 0", 745, 275, 788, 295, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 426) then
    		Texto("Santana:  ".. getElementData(localPlayer, "tomoumulta".. 426), 555, 514, 624, 533, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Santana: 0", 555, 514, 624, 533, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 405) then
    		Texto("Vectra GT:  ".. getElementData(localPlayer, "tomoumulta".. 405), 711, 246, 789, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Vectra GT: 0", 711, 246, 789, 265, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		end
    		Texto("VEÍCULO | MULTAS", 677, 187, 854, 202, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
            if getElementData(localPlayer, "tomoumulta".. 549) then
    		Texto("Golf Sapao:  ".. getElementData(localPlayer, "tomoumulta".. 549), 708, 304, 788, 324, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Golf Sapao: 0", 708, 304, 788, 324, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 421) then
    		Texto("Siena:  ".. getElementData(localPlayer, "tomoumulta".. 421), 737, 364, 789, 384, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Siena: 0", 737, 364, 789, 384, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 558) then
    		Texto("Maverick GT:  ".. getElementData(localPlayer, "tomoumulta".. 558), 703, 334, 788, 354, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Maverick GT: 0", 703, 334, 788, 354, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 529) then
    		Texto("Duster:  ".. getElementData(localPlayer, "tomoumulta".. 529), 736, 394, 788, 414, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Duster: 0", 736, 394, 788, 414, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		end
    		if getElementData(localPlayer, "tomoumulta".. 477) then
    		Texto("Diablo:  ".. getElementData(localPlayer, "tomoumulta".. 477), 737, 425, 789, 445, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Diablo: 0", 737, 425, 789, 445, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 540) then
    		Texto("Punto:  ".. getElementData(localPlayer, "tomoumulta".. 540), 737, 456, 789, 476, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Punto: 0", 737, 456, 789, 476, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
            end
    		if getElementData(localPlayer, "tomoumulta".. 535) then
    		Texto("Mustang GT:  ".. getElementData(localPlayer, "tomoumulta".. 535), 705, 486, 793, 506, tocolor(255, 255, 255, 255), 1.000, "default", "center", "center", false, false, false, false, false)
    		else
    		Texto("Mustang GT: 0", 705, 486, 793, 506, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
            end
    		Texto("SE NÃO TIVER O VEÍCULO, DIGITE O ID DELE AQUI E A QUANTIDADE DE MULTAS A SEREM PAGAS", 858, 212, 1030, 277, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, true, false, false, false)
            dxDrawLine(x*853, y*217, x*853, y*503, tocolor(255, 255, 255, 255), x*5, false)
            dxDrawRectangle(x*430, y*563, x*176, y*43, tocolor(255, 255, 255, 147), false)
            Texto("PAGAR", 430, 563, 608, 607, tocolor(255, 255, 255, 255), 1.40, "default-bold", "center", "center", false, true, false, false, false)
            dxDrawRectangle(x*753, y*561, x*176, y*43, tocolor(255, 255, 255, 147), false)
            Texto("VOLTAR", 753, 560, 931, 604, tocolor(255, 255, 255, 255), 1.40, "default-bold", "center", "center", false, true, false, false, false)
            Texto("ID", 877, 279, 935, 298, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
            Texto("MULTAS", 954, 279, 1012, 298, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false)
        end
    
    function Texto (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
        dxDrawText(a, x*b, y*c, x*d, y*e, f, x*g, h, i, j, k, l, m, n, o)
    end

     

  2. Basicamente esses tableVeh, era o valor de dentro e o "i" o index, ex

    tableVeh = {
      	[1] = {valor1, valor2, valor3...}
      }
    
    tableVeh[1][1] -- Vai recuperar o valor1 do index1 da tabela tableVeh

    Isso seria bem útil para verificar o veículo assim ficando muito mais fácil verificar se ele é da tabela ou n, ai dps u

    veh = {}	
    	for i=1, 9 do
      	veh[i] -- Isso vai fazer com que cada veículo fique "salvo" em cada número, o que tinha o index1 fica "salvo" em veh[1], e assim vai...
      end

     

  3. money = {}
    function verificarPag(player)
    	local timer = getRealTime()
    	local accName = getAccountName ( getPlayerAccount ( player ))
    		 if isObjectInACLGroup ("user."..accName, aclGetGroup("Mr")) then
    			 if timer.hour == 7 then
    				 --exports.Mr_Dxmessages:outputDx(player, "Seu pagamento está liberado , até as 08 horas! receba no /receber", "warning")
    				 money[player] = createPickup (1542, -1684, 14, 3, 1274, 0 )
    else
    				exports.Mr_Dxmessages:outputDx(player, "Você ainda não pode receber, somente as 08 horas!", "error")
    		end	 
    	end
    end
    addCommandHandler("receber", verificarPag)
    
    function receber (player)
    	if source == money[player] then
    	local timer = getRealTime()
    	local accName = getAccountName ( getPlayerAccount ( player ) )
    		if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Mr") ) then
    		if timer.hour == 7 then 
    			exports.Mr_Dxmessages:outputDx(player, "Você recebeu seu pagamento $500  ", "success")
    				givePlayerMoney(player, 500)
    			destroyElement(money[player])
    	end
    end
    end
    --addCommandHandler("receber", receber)
    addEventHandler ( "onPickupHit", resourceRoot, receber )

    Tente assim. obs: não testei, qualquer erro me fale

    • Thanks 1
  4. tableVeh = {
    	[1] = {481, 1505.42102, -1753.69446, 13.54688},
    	[2] = {481, 1505.42102 +1, -1753.69446, 13.54688},
    	[3] = {481, 1505.42102 +2, -1753.69446, 13.54688},
    	[4] = {481, 1505.42102 +3, -1753.69446, 13.54688},
    	[5] = {481, 1505.42102 +4, -1753.69446, 13.54688},
    	[6] = {481, 1505.42102 +5, -1753.69446, 13.54688},
    	[7] = {481, 1505.42102 +6, -1753.69446, 13.54688},
    	[8] = {481, 1505.42102 +7, -1753.69446, 13.54688},
    	[9] = {481, 1505.42102 +8, -1753.69446, 13.54688},
    	[10] = {481, 1505.42102 +9, -1753.69446, 13.54688},
    }
    
    addEventHandler("onResourceStart", resourceRoot, function()
    	for i=1, 10 do
    		veh[i] = createVehicle(tableVeh[i][1], tableVeh[i][2], tableVeh[i][3], tableVeh[i][4])
    		local rx, ry, rz = getElementRotation(veh[i])
    		setVehicleRespawnPosition(tableVeh[i][2], tableVeh[i][3], tableVeh[i][4], rx, ry, rz)
    		addEventHandler("onVehicleStartEnter", veh[i], isTempOwner)
    	end
    end )
    
    timer = {}
    function isTempOwner(thePlayer) 
    	if not table.thePlayer then
    		exports.dxmsgs:outputDx(thePlayer, "Você precisa alugar uma bike para poder usá-la", "error")
    		cancelEvent()
    	else
    		for i=1, 10 do
    			if source == veh[i] then
    				playerAndI = getPlayerName(thePlayer) .."".. i 
    				timer[playerAndI] = setTimer ( function()
    					respawnVehicle(veh[i])
    					if table.thePlayer then
    						table.thePlayer = nil
    					end
    				end, 60000, 1)
    			end
    		end
    	end
    end

    Não testei.

  5. 12 minutes ago, DNL291 said:

    Sobre o 'resourceRoot' é a melhor forma que ele pode fazer, já que ele quer que execute a função apenas para as markers do próprio resource. Daí no caso ele pode fazer um if-elseif e criar o código numa só função.

    Já isso que você citou não vai acontecer já que a variável da marker estará num outro resource. Só daria esse conflito se fosse no mesmo script, e acredito que você não quis dizer isso, pois com 'resourceRoot' também vai executar essa função para outras markers dentro do resource.

    Edit:

    @Zakk

    As 2 funções nas linhas 4 e 5 do seu código não precisam, pois o elemento já vai ser criado nessa dimensão e interior. Também tenha como hábito definir variáveis sempre local para evitar conflitos entre o nome dela e para otimização do script.

    Você também pode abrir mão da função setElementPosition especificando as coordenadas com setElementInterior Ex: 

    
    setElementInterior(source, 3, 418.18564, -81.11912, 1001.80469)
    

     

    Aé né, acabei me esquecendo, obrigado pela correção

    • Like 1
  6. 18 minutes ago, kevincouto6 said:

    destruir é melhor assim ele tera que refazer tudo denovo, porem não tenho a minima idea de como destruir, quando o player se desconnectar

    function plantDestroyIfPlayerQuit ()
    	newIndex = getPlayerName(source) .."".. indexPl[source]
    	if plants[newIndex]  and isElement(plants[newIndex] ) and getElementModel(plants[newIndex]  ) == 862 then
    	local numero = tonumber(indexPl[source])
    	for i=1,numero do
    			destroyElement ( plants[newIndex]  )
    			indexPl[source] = indexPl[source] -1
    	newIndex = getPlayerName(source) .."".. indexPl[source]
    	end
    	end	
    end
    addEventHandler ("onPlayerQuit", getRootElement(), plantDestroyIfPlayerQuit)

    Se essa for sua ideia, tente assim.

  7. 21 hours ago, danilin said:

    Tamanho do Marker é 1 Ai não funciona, tu errou também na function "entradafun" onde setou dimensão 3 e o marker "sair" estava na dimensão 2

    
    Entrar = createMarker (910.30902, -1397.46484, 13.19776 -1, "cylinder", 1.2, 227, 240, 14)
    setElementInterior(Entrar, 0)
    setElementDimension(Entrar, 0)
    
    Sair = createMarker (418.62479, -84.36529, 1001.80469 -1, "cylinder", 1.2, 227, 240, 14)
    setElementInterior(Sair, 3)
    setElementDimension(Sair, 2)
    
    function entradafun(source)
        setElementInterior(source, 3)
        setElementDimension(source, 2)
        setElementPosition(source, 418.18564, -81.11912, 1001.80469) 
    end
    addEventHandler("onMarkerHit", Entrar, entradafun)
    
    function saidafun(source)
        setElementDimension(source, 0)
        setElementInterior(source, 0)
        setElementPosition(source, 902.76819, -1398.39978, 13.19219 -1) 
    end
    addEventHandler("onMarkerHit", Sair, saidafun)
    

     

    recomendo que quando for fazer função "onMarkerHit" use o resourceRoot ex:

    function saidafun(hitElement)
      	if source == Sair then
        setElementDimension(hitElement, 0)
        setElementInterior(hitElement, 0)
        setElementPosition(hitElement, 902.76819, -1398.39978, 13.19219 -1) 
        end
    end
    addEventHandler("onMarkerHit", resourceRoot, saidafun)

    Isso irá ajudar a n bugar markers entre scripts, exemplo, se vc tiver outro script com a marker chamada Sair, poderá bugar e vc ir parar aonde essa marker leva de vez a outra marker Sair.

  8. 24 minutes ago, kevincouto6 said:

    Desculpe voltar, mas não sei o que fazer estava fazendo os detalhes finais e me deparei com um problema " onClientPlayerQuit " " onPlayerQuit "  como fazer com que as plantas sejam destruidas, não e possivel verificar se as tabelas e o player quando ele se desconnect então sabem como posso fazer ?

    Você quer destruir as plantas quando ele sair, ou salvar na conta do player?

  9. 17 minutes ago, kevincouto6 said:
    
     
    

    Continua o mesmo erro, esse erro so acontece quando tem dois fazendo ao mesmo tempo, plantei 1 planto o outro jogador vai la e planta 2 e completa quando eu plantar a segunda para completar não vai funcionar vai aparecer o erro 

    GUImission/server.lua:181: Bad argument @ 'destroyElement' [Expected element at argument 1, got nill] aparace conforme a quantidade de plantas que não foi destuida

    Aé, acabei me esquecendo, quando coloca "and" automaticamente o valor vira o ultimo, ou seja dessa forma não mudou nada o problema

    local plants = {}
    local plants1 = {}
    local indexPl = {}
    function iniciarFarm8 ( client, x, y, z ) 
      	if not indexPl[client] then
        	indexPl[client] = 1    
    		else
      		indexPl[client] = indexPl[client] + 1
    	end
    		newIndex = getPlayerName(client) .."".. indexPl[client]
    		plants[newIndex] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
       	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false) 
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	newIndex = getPlayerName(thePlayer) .."".. indexPl[thePlayer]
    	if plants[newIndex]  and isElement(plants[newIndex] ) and getElementModel(plants[newIndex]  ) == 862 then
    	local numero = tonumber(indexPl[thePlayer])
    	for i=1,numero do
    			destroyElement ( plants[newIndex]  )
    			indexPl[thePlayer] = indexPl[thePlayer] -1
    	newIndex = getPlayerName(thePlayer) .."".. indexPl[thePlayer]
    	end
    	end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    Tente dessa forma, o ruim mesmo, é que eu não tenho como testar, ai tenho que ficar mandando sempre kk

    • Like 1
  10. Just now, DNL291 said:

    Você pode usar a função createElement - a função cria um elemento no jogo e isso iria representar o do banco de todos os postos. Para salvar você usaria setElementData assim como fosse em um player qualquer. Ou também fazer o mesmo só que com uma conta e salvar o valor com setAccountData.

    Sobre a função createElement, nunca tinha lido sobre ela, quando o resource for restartado, o setElementData, deixaria de existir certo, sendo assim de qualquer forma precisaria usar o setAccountData ou não?

  11. Olá gente, gostaria de saber se de alguma forma tem como salvar algo literalmente no server, ou se alguém tem algum ideia pra me dar, eu to em mente em fazer um script, onde um player será o dono de todos os postos da cidade e quando algum player comprar gasolina vai 80% do preço da gasolina pra ele, só que, queria algo, tipo um banco, onde armazenava todo o dinheiro que o posto arrecadasse, ou seja se usasse setElementData(dono...), não iria funcionar, pois no mesmo momento que o player saísse do server, pararia de ganhar o dinheiro das vendas de gasolina, será que tem alguma forma de salvar isso no server, pra quando a resource for stoppada ou restartada, salvasse automaticamente!

     

     

  12. 13 minutes ago, kevincouto6 said:

    OKay funcionou obrigado, porem 

     

    o outro poblema e assim 

    player 1 plantou 1 planta 

    player 2 plantou 2 plantas e completou, as plantas dele foram destruidos tudo coretamente,

    player1 apos o player 2 completar , player1 plantou e quando chegou na contidade total de 2, foi completar nãa destruiu todos.

    espera que consiga me entender.

    No debug aparece esse erro 

    GUImission/server.lua:176: Bad argument @ 'destroyElement' [Expected element at argument 1, got nill]

    local plants = {}
    local plants1 = {}
    local indexPl = {}
    function iniciarFarm8 ( client, x, y, z ) 
      	if not indexPl[client] then
        	indexPl[client] = 1    
    		else
      		indexPl[client] = indexPl[client] + 1
    	end
    		plants[client and indexPl[client]] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
       	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false) 
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	if plants[thePlayer and indexPl[thePlayer]]  and isElement(plants[thePlayer and indexPl[thePlayer]] ) and getElementModel(plants[thePlayer and indexPl[thePlayer]]  ) == 862 then
    	local numero = tonumber(indexPl[thePlayer])
    	for i=1,numero do
    			destroyElement ( plants[thePlayer and indexPl[thePlayer]] )
    			indexPl[thePlayer] = indexPl[thePlayer] -1
    	end
    	end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    Não testei, se tiver algum erro me fale

  13. 28 minutes ago, kevincouto6 said:

    gui_Windon_Mission.lua ( client-side )

    
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Panel Gui Missions-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------GUIEditor = {    gridlist = {},    window = {},    button = {}}addEventHandler("onClientResourceStart", resourceRoot,	function ()        WinMission = guiCreateWindow(374, 156, 594, 329, "Mission ZHP", false)		guiSetVisible (WinMission, false )        guiWindowSetSizable(WinMission, false)        accepted = guiCreateButton(12, 236, 180, 34, "ACCEPTED", false, WinMission)        info = guiCreateButton(207, 236, 180, 34, "INFO", false, WinMission)        abandon = guiCreateButton(397, 236, 180, 34, "ABANDON", false, WinMission)        ListMissions = guiCreateGridList(12, 36, 565, 190, false, WinMission)		guiGridListSetSortingEnabled ( ListMissions, false )        guiGridListAddColumn(ListMissions, "MISSION", 0.9)        for i = 1, 11 do            guinumeber = guiGridListAddRow(ListMissions)        end        guiGridListSetItemText(ListMissions, 0, 1, "Mission Plants", false, false)        guiGridListSetItemText(ListMissions, 1, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 2, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 3, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 4, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 5, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 6, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 7, 1, "-", false, false)		guiGridListSetItemText(ListMissions, 8, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 9, 1, "-", false, false)        guiGridListSetItemText(ListMissions, 10, 1, "-", false, false)		        Buttonexit = guiCreateButton(10, 276, 567, 43, "EXIT", false, WinMission)    	end)--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Memo info Mission-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------local janelas = {	{		titulo = "Mission Description",		memo = "You must kill 50 zombies in area 51              RewardMoney: R$ 5,000.00 EXP : 3555 "	}}------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Info Missios-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------local elementos = {	window = {},	btns = {},}addEventHandler("onClientResourceStart", resourceRoot,    function()		for i,janela in ipairs(janelas) do			wnd = guiCreateWindow(939, 156, 196, 329, janela.titulo, false)			elementos.window[wnd] = i-1			guiSetVisible (wnd, false)			guiWindowSetSizable(wnd, false)					guiCreateMemo(9, 32, 175, 196, janela.memo, false, wnd)						btnExit = guiCreateButton(10, 280, 174, 40, "EXIT", false, wnd)			btnCopy = guiCreateButton(9, 233, 175, 37, "COPY", false, wnd)			elementos.btns[btnExit] = {wnd,"exit"}			elementos.btns[btnCopy] = {wnd,"copy"}		end     end)addEventHandler ("onClientGUIClick", resourceRoot, function (button, state, absoluteX, absoluteY)	if (elementos.btns[source]) then		if (elementos.btns[source][2] == "exit") then			guiSetVisible (elementos.btns[source][1], false)		end	endend)addEventHandler ("onClientGUIClick", resourceRoot, function (button, state, absoluteX, absoluteY)	if (source == info) then		for wnd, id in pairs(elementos.window) do			if (id == guiGridListGetSelectedItem(ListMissions)) then				guiSetVisible (wnd, true)			else				guiSetVisible (wnd, false)			end		end	endend)-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Local Marker points---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------if you want add Marker# {},Mark = {{225.38281, 1905.20300, 17.64063},}--Markerlocal Marker1 = createMarker(225.38281, 1905.20300, 17.64063, "cylinder", 1.5, 250,250,0)for k,v in ipairs (Mark) doz = v[3] -1Marker = createMarker ( v[1], v[2], z, "cylinder", 1.5,  255, 255, 0, 255 )addEventHandler('onClientMarkerHit', Marker,    function ( hitPlayer )        if ( hitPlayer == localPlayer ) then            guiSetVisible (WinMission, true )            showCursor( true )        end    end)end----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Accepted Mission-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------addEventHandler ("onClientGUIClick", getRootElement(),   function (button, state, absoluteX, absoluteY)    outputDebugString("onClientGUIClick called.")     local me = not guiGetVisible (WinMission)    if (source == accepted) then      outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions))      if (guiGridListGetSelectedItem(ListMissions) == 0) then         outputDebugString("1 was selected")		inicio8 ()		guiSetVisible (WinMission, me)		showCursor (me)      end    end  end)------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Button EXIT -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY)	if (source == Buttonexit) then		guiSetVisible (WinMission, false)			for wnd, id in pairs(elementos.window) do				guiSetVisible (wnd, false)			end		showCursor (false)	endend)

    client_mission.lua ( client-side )

    
    plantsPoints = 0function inicio8 ( )		local retanguloParaPlantio = createColRectangle ( 209.52605, 1906.70947, 155, 155 )	hillRadar = createRadarArea ( 209.52605, 1906.70947, 155, 155, 0, 255, 0, 175 )		addEventHandler("onClientColShapeHit", retanguloParaPlantio, function ( theElement, matchingDimension )		if ( theElement == localPlayer ) then 			function plant ()					local block, anim = getPedAnimation( localPlayer ) 				if ( not( block == "medic" and  anim == "CPR" ) ) then 					local x, y, z = getElementPosition ( localPlayer ) 					triggerServerEvent ("iniciaJob8", localPlayer, localPlayer, x, y, z )								setTimer(function() 						plantsPoints = plantsPoints+1 						outputChatBox( "Foi plantado  "..(plantsPoints).."/2" )												if plantsPoints >= 2 then 							triggerServerEvent ( "onDestroyElement", localPlayer, localPlayer )							outputChatBox ("voçê plantou todos")							plantsPoints = 0							destroyElement ( hillRadar )						end					end, 6500, 1)				else					outputChatBox (" voçê deve esperar 6 sec para plantar novamente " )				end				end			addCommandHandler ( "d", plant )		end	end )		addEventHandler("onClientColShapeLeave", retanguloParaPlantio, function ( theElement, matchingDimension )		if ( theElement == localPlayer ) then 			outputChatBox( "nop Function." )			removeCommandHandler ( "d", plant )		end	end )end

    server_mission.lua ( server-side )

    
     local plant = {}local plants1 = {}local indexPl = {}function iniciarFarm8 ( client, x, y, z )    	if not indexPl[client] then    	indexPl[client] = 1      		indexPl[client] = indexPl[client] + 1		plant[client][indexPl[client]] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )    	setElementData( client, "Trabalho8", true, false )   	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false)       endendaddEvent ("iniciaJob8", true) addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)function plantDestroy ( thePlayer )	if plant[thePlayer][indexPl[thePlayer]] and isElement(plant[thePlayer][indexPl[thePlayer]]) and getElementModel( plant[thePlayer][indexPl[thePlayer]] ) == 862 then			destroyElement ( plant[thePlayer][indexPl[thePlayer]] )		end	endaddEvent ("onDestroyElement", true) addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    meta.xml

    
    <meta>	<script src="gui_Windon_Mission.lua" type="client"/>	<script src="client_mission.lua" type="client" />	<script src="server_mission.lua" type="server" /></meta>

     

    aki esta todo o script @DNL291 e @zMpyster

    plantsPoints = 0
    
    	local retanguloParaPlantio = createColRectangle ( 209.52605, 1906.70947, 155, 155 )
    	hillRadar = createRadarArea ( 209.52605, 1906.70947, 155, 155, 0, 255, 0, 175 )
    		
    			function plant ()	
    				local block, anim = getPedAnimation( localPlayer ) 
    				if block and anim then
    				if block == "medic" and anim == "CPR"  then 
    					outputChatBox (" voçê deve esperar 6 sec para plantar novamente " )
    				end	
    				return end
    						local x, y, z = getElementPosition ( localPlayer ) 
    						triggerServerEvent ("iniciaJob8", localPlayer, localPlayer, x, y, z )
    							setTimer(function() 
    								plantsPoints = plantsPoints+1 
    								outputChatBox( "Foi plantado  "..(plantsPoints).."/2" )
    								
    								if plantsPoints >= 2 then
    										if plantsPoints >= 2 then
    											outputChatBox ("voçê plantou todos")
    											plantsPoints = 0
    											destroyElement ( hillRadar )
    											triggerServerEvent ( "onDestroyElement", localPlayer, localPlayer)
    								end
    								end
    							end, 6500, 1)
    			end
    			addCommandHandler ( "d", plant )
    			
    			
    	addEventHandler("onClientColShapeLeave", retanguloParaPlantio, function ( theElement, matchingDimension )
    		if ( theElement == localPlayer ) then 
    			outputChatBox( "nop Function." )
    			removeCommandHandler ( "d", plant )
    		end
    	end )
    local plants = {}
    local plants1 = {}
    local indexPl = {}
    function iniciarFarm8 ( client, x, y, z ) 
      	if not indexPl[client] then
        	indexPl[client] = 1    
    	end
      		indexPl[client] = indexPl[client] + 1
    		plants[indexPl[client]] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
       	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false) 
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	if plants[indexPl[client]]  and isElement(plants[indexPl[client]] ) and getElementModel(plants[indexPl[client]]  ) == 862 then
    			destroyElement ( plants[indexPl[client]] )
    		end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    Ainda ta com alguns bugs, más, ai vc conserta

    
    function plantDestroy ( thePlayer )
    	if plants[indexPl[thePlayer]]  and isElement(plants[indexPl[thePlayer]] ) and getElementModel(plants[indexPl[thePlayer]]  ) == 862 then
    	local numero = tonumber(indexPl[thePlayer])
    	for i=1,numero do
    			destroyElement ( plants[indexPl[thePlayer]] )
    			indexPl[thePlayer] = indexPl[thePlayer] -1
    	end
    	end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    Aqui está pra destruir todas as plantas

  14. 12 minutes ago, kevincouto6 said:

    Acabei de faze-lo criei o objeto como plant não funcionou 

    então tentei destruir if plants[thePlayer][indexPl[thePlayer]]  e ainda não funcionou, mds estou ficando louco, hheheh, 

    Use o debugscript, e fale o erro, fica ruim de resolve-lo sem saber aonde é

  15. 26 minutes ago, kevincouto6 said:

     

    Aki esta os dois lados

    guiWindonClient.lua ( client - side )

    a parte que inicia8 é esta, botei apenas um pedaço

    
    		elseif (guiGridListGetSelectedItem(ListMissions) == 2) then
            outputDebugString("2 was selected")
    		inicio8 ()
    		guiSetVisible (WinMission, me)
    		showCursor (me)
    			for wnd, id in pairs(elementos.window) do
    				guiSetVisible (wnd, false)
    			end
    

    Client-side

    
    plantsPoints = 0
    
    function inicio8 ( )
    	
    	local retanguloParaPlantio = createColRectangle ( 209.52605, 1906.70947, 155, 155 )
    	hillRadar = createRadarArea ( 209.52605, 1906.70947, 155, 155, 0, 255, 0, 175 )
    	
    	addEventHandler("onClientColShapeHit", retanguloParaPlantio, function ( theElement, matchingDimension )
    		if ( theElement == localPlayer ) then 
    			function plant ( thePlayer )	
    				local block, anim = getPedAnimation( localPlayer ) 
    				if ( not( block == "medic" and  anim == "CPR" ) ) then 
    					if ( thePlayer ) then
    						local x, y, z = getElementPosition ( localPlayer ) 
    						triggerServerEvent ("iniciaJob8", localPlayer, x, y, z )
    						
    							--setTimer(function() 
    								plantsPoints = plantsPoints+1 
    								outputChatBox( "Foi plantado  "..(plantsPoints).."/2" )
    								
    								if plantsPoints >= 2 then
    									if ( thePlayer ) then
    										if plantsPoints >= 2 then
    											outputChatBox ("voçê plantou todos")
    											plantsPoints = 0
    											destroyElement ( hillRadar )
    											triggerServerEvent ( "onDestroyElement", localPlayer )
    										end
    									end
    								end
    							--end, 6500, 1)
    					end
    				else
    					outputChatBox (" voçê deve esperar 6 sec para plantar novamente " )
    				end	
    			end
    			addCommandHandler ( "d", plant )
    		end
    	end )
    	
    	addEventHandler("onClientColShapeLeave", retanguloParaPlantio, function ( theElement, matchingDimension )
    		if ( theElement == localPlayer ) then 
    			outputChatBox( "nop Function." )
    			removeCommandHandler ( "d", plant )
    		end
    	end )
    
    end
    

    Server-side 

    
    local plants = {}
    local plants1 = {}
    local indexPl = {}
    
    function iniciarFarm8 ( client, x, y, z )  
      	if not indexPl[client] then
        	indexPl[client] = 1    
      		indexPl[client] = indexPl[client] + 1
    		plants[client][indexPl[client]] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
       	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false)   
        end
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	if plant[thePlayer][indexPl[thePlayer]] and isElement(plant[thePlayer][indexPl[thePlayer]]) and getElementModel( plant[thePlayer][indexPl[thePlayer]] ) == 862 then
    			destroyElement ( plant[thePlayer][indexPl[thePlayer]] )
    		end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)
    

     

    triggerServerEvent ("iniciaJob8", localPlayer, localPlayer, x, y, z )
    triggerServerEvent ( "onDestroyElement", localPlayer, localPlayer )

    Coloca esses trigger no lugar para ver

     

  16. 1 hour ago, kevincouto6 said:

    Não funcionou, omg eu estou ficando louco XD

    * primeiro ele não encontra o valor X

    *então removi o Cliente de (client, x, y,z )

    * ai fica dizendo ( attemple to index field '?' (a nil value )

    mas não vou desistir tem alguma ideia do que fazer ?

    O erro ta sendo no trigger, recomendo que mande essa parte

  17. tente usar: 

    addEventHandler("onElementDestroy", getRootElement(), 
    function ()
        if getElementType(source) == "vehicle" then
            if(p_lights[source] == 1) then
          		 if isTimer(p_timer[source]) then killTimer(p_timer[source]) end
      			p_timer[source] = nil
            end
        end
    end)

     

    • Thanks 1
  18. 12 minutes ago, kevincouto6 said:

    será que esta é a unica fora, tipo a missão vai ser plantar +-- 50 plantas, vou ter que criar para as 50, ou será que tem outra forma, estou usando 2 apenas para test 

    local plants = {}
    local plants1 = {}
    local indexPl = {}
    
    function iniciarFarm8 ( client, x, y, z )  
      	if not indexPl[client] then
        	indexPl[client] = 1    
      		indexPl[client] = indexPl[client] + 1
    		plants[client][indexPl[client]] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
       	    animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false)   
        end
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	if plant[thePlayer][indexPl[thePlayer]] and isElement(plant[thePlayer][indexPl[thePlayer]]) and getElementModel( plant[thePlayer][indexPl[thePlayer]] ) == 862 then
    			destroyElement ( plant[thePlayer][indexPl[thePlayer]] )
    		end	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

    Tenta assim, não testei o mod, por isso não sei se tem algum erro.

  19. 5 minutes ago, kevincouto6 said:
    
    local plant = {}
    
    function iniciarFarm8 ( x, y, z )
    	
    	setElementData( client, "Trabalho8", true, false )
    	
    	plant[client] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
    
    
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)
    
    function plantDestroy ( thePlayer )
    	local thePlayer = client
    	if plant[thePlayer] and isElement(plant[thePlayer]) and getElementModel( plant[thePlayer] ) == 862 then
    		for thePlayer, plant in ipairs(getElementsByType("object")) do 
    			destroyElement ( plant )
    		end
    	end 
    	
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)
    

    Estou usando desta forma, assim posso criar varias, e remover todos porem remove a dos outros jogadores tambem, preciso que seja removido apenas a minha

    Use desta forma

    local plants = {}
    local plants1 = {}
    
    function iniciarFarm8 ( client, x, y, z )  
          	if plants[client] then
            plants1[client] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
            animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false)
            else
          	plants[client] = createObject ( 862, x , y , z - 1 , 0, 0, 0 )
        	setElementData( client, "Trabalho8", true, false )
            animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false)
            end    
    end
    addEvent ("iniciaJob8", true) 
    addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8)

    edit: Não se esqueça de quando usar o triggeClientEvent ou triggerEvent, de colocar todas as variáveis que se pede (client, x, y, z)

  20. 1 minute ago, kevincouto6 said:

     for id, plant in ipairs(getElementsByType("object")) do 

    end

    porem sem esta parte ele remove apenas a ultima planta,  tem um modo de juntar as duas será ?

    Você esta usando meu exemplo da parte de cima? se estiver faça dessa forma

    
    function plantDestroy ( thePlayer )
    	if plants[thePlayer] and isElement(plants[thePlayer]) and getElementModel( plants[thePlayer ) == 862 then
    		destroyElement ( plants[thePlayer )
    	end 
     	if plants1[thePlayer] and isElement(plants1[thePlayer]) and getElementModel( plants1[thePlayer ) == 862 then
    		destroyElement ( plants1[thePlayer )
        end
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)

     

  21. 11 minutes ago, kevincouto6 said:

    Este formato destroy todos, porem ate o dos outros players que estão na missão, saberia como posso fazer para especificar que é pra destruir apenas as que eu plantei não a dos outros

    Teste dessa forma

    function plantDestroy ( thePlayer )
    	if plant[thePlayer] and isElement(plant[thePlayer]) and getElementModel( plant[thePlayer ) == 862 then
    		destroyElement ( plant[thePlayer )
    	end 
    end
    addEvent ("onDestroyElement", true) 
    addEventHandler ("onDestroyElement", getRootElement(), plantDestroy)
×
×
  • Create New...