Jump to content

SetMarcos

Members
  • Posts

    81
  • Joined

  • Last visited

Posts posted by SetMarcos

  1. client.Lua
    
    function playmusic()
    	sound = playSound("joinsound.mp3")
    end
    
    function stopmusic()
    	stopSound(sound)
    end
    
    addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function()
    	-- little interval, music is getting laggy when all resources are starting..
    	setTimer(function()
    	playmusic()
    	end, 2000, 1)
    end
    )
    
    
    function pararsom()
    	stopmusic()
    end
    addEvent("pararsom", true)
    addEventHandler("pararsom", root, pararsom)
    server.Lua
    -- root = getElementRoot()
    addEventHandler("onPlayerLogin", root,
      function()
        triggerClientEvent ( source,"pararsom",source)
      end
    )

     

  2. Good morning, how can I make the car lights flash when a player tries to catch it? my code:

    function enterVehicle ( player, seat, jacked ) 
    local lock = getElementData(source, "lockedTo")
    local accName = getAccountName(getPlayerAccount(player))
    	if seat == 0 then
    		if accName == lock then
    			setElementFrozen ( source, false )
    			outputChatBox("[SERVER] - #00ff00your veh!", player, 255, 0, 0,true)
    			return true
    		else
    		
    			local Ax,Ay,Az = getElementPosition (source)
    			cancelEvent()
    			outputChatBox("[SERVER] - #ffff00Veh is private. #808080Owner is:#ff0000 "..lock..".", player, 255, 0, 0,true)
    			triggerClientEvent ( player,"alarmeVeh", player ,source,Ax,Ay,Az)
    		end
    	end
    end
    addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle )

     

  3. if commandName then , vai retornar true se vc informar os valores um e dois, caso não seja informado ele retorna false e não entra na condição. tenta assim:

    function soma(thePlayer, commandName, um, dois)
    
    		local num1 = tonumber(um)
    		local num2 = tonumber(dois)
    		local resultado = um + dois
    
    	if commandName then
    		if (num1 and num2) >= 0 then
    			outputChatBox("A soma entre "..num1.. "e "..num2.." é igual a "..resultado..".", thePlayer, 255,255,255, true)
    		end
        	else
        	outputChatBox("Você precisa digitar os dois números para fazer a conta.", thePlayer)
    	end
    end
    addCommandHandler("somar", soma)

     

    • Thanks 1
  4. Version = 1.5.5-release-11815.4.004
    Time = Sun Mar 18 09:22:23 2018
    Module = C:\Games\GTA\proxy_sa.exe
    Code = 0xC0000005
    Offset = 0x00349B7B
    
    EAX=00000000  EBX=0DD462F0  ECX=00000000  EDX=0022FC00  ESI=0DD62558
    EDI=00000008  EBP=00000000  ESP=0022FB9C  EIP=00749B7B  FLG=00010202
    CS=001B   DS=0023  SS=0023  ES=0023   FS=003B  GS=0000

    How can I fix this? pls

  5. Porque a função não está pegando?  :oops:

    Alguém ajude por favor.

    
    
    -- Formato: {x = 0, y = 0, width = 0, height = 0},
    local aSavePlaces = 
    {
    	{x = 1587.1513671875, y = -1152.365234375, width = 245, height = 160},  -- BOSS LS
    	{x = 2372.2763671875, y = 1836.701171875, width = 150, height = 160},  -- BOSS LV
    	{x = -2140.8330078125, y = 124.470703125, width = 150, height = 185},  -- BOSS SF
    }
    
    local aRadarAreaPlaces = 
    {
    
    	{1587.1513, -1152.3652,245, 160,255,0,0,100},  -- BOSS LS
    	{2372.2763, 1836.7011,150, 160,255,0,0,100},  -- BOSS LV
    	{-2140.8330, 124.4707,150, 185,255,0,0,100},  -- BOSS SF
    }
    
    
    function criandoareas( )
    --local display = textCreateDisplay () 
    --local text = textCreateTextItem("Em Zona Segura!", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
    --textDisplayAddText(display, text) 
    						
    for _, a in ipairs( aRadarAreaPlaces ) do
    			
    				pRadarArea = createRadarArea ( unpack( a ) )
    				setElementData( pRadarArea, "zombieProof", true )
    			    	
                
    end
    
    for _, b in ipairs( aSavePlaces ) do				
        if b then 
    	outputChatBox("@b: "..tostring(b))
    	    if b.x and b.y and b.width and b.height then
    		outputChatBox("@b.x: "..tostring(b.x))
    		outputChatBox("@b.y: "..tostring(b.y))
    		outputChatBox("@b.width: "..tostring(b.width))
    		outputChatBox("@b.height: "..tostring(b.height))
    				 zona = createColRectangle (b.x, b.y, b.width, b.height)
             outputChatBox("@zona: "..tostring(zona))				 
            end
    	end		
    end		
    			
    		addEventHandler ( "onColShapeHit", zona ,
    			function ( pHitElement )
    	if getElementType( pHitElement ) == 'player' then	  
    	    --textDisplayAddObserver(display, pHitElement) 
         	outputChatBox("@pHitElement: "..tostring(pHitElement))
    		outputChatBox("[BOSS] - Você entrou em área BOSS.", pHitElement, 0, 145, 0, true)	
    	end
    	
    	if getElementData(pHitElement,"zombie") and getElementType( pHitElement ) == 'ped' then
    	    killPed(pHitElement)                          	
    	end				
    end
    		) 
                
    			
    		addEventHandler ( "onColShapeLeave", zona , 			
    function (pLeaveElement) 
       if getElementType (pLeaveElement) == 'player' then
    	    --textDisplayRemoveObserver(display, pLeaveElement) 
            outputChatBox ("[BOSS] - Você saiu da área BOSS.", pLeaveElement, 145, 0, 0, true)
       end
    	  
    	  if getElementData (pLeaveElement, "zombie") and getElementType (pLeaveElement) == 'ped' then
            killPed (pLeaveElement)
          end
    end
          	)
    
    end 
    addEventHandler ( "onResourceStart", resourceRoot,criandoareas)
    @b: table: 06EDE618
    @b.x: 1587.1513671875
    @b.y: -1152.365234375
    @b.width: 245
    @b.height: 160
    @zona: userdata: 000010CE
    ----
    @b: table: 06EDE5F0
    @b.x: 2372.2763671875
    @b.y: 1836.701171875
    @b.width: 150
    @b.height: 160
    @zona: userdata: 000010CF
    ----
    @b: table: 06EDE6B8
    @b.x: -2140.8330078125
    @b.y: 124.470703125
    @b.width: 150
    @b.height: 185
    @zona: userdata: 000010D0

    Sem erros no debugscript 3

  6. alguém poderia explicar porque as funções 'entrando' e 'saindo' não estão funcionando? pls

    
    
    
    local aSavePlaces = 
    {
    	{1587.1513671875, -1152.365234375,245, 160};  -- BOSS LS
    	{2372.2763671875, 1836.701171875,150, 160};  -- BOSS LV
    	{-2140.8330078125, 124.470703125,150, 185};  -- BOSS SF
    }
    
    local aRadarAreaPlaces = 
    {
    
    	{1587.1513671875, -1152.365234375,245, 160,255,0,0,100};  -- BOSS LS
    	{2372.2763671875, 1836.701171875,150, 160,255,0,0,100};  -- BOSS LV
    	{-2140.8330078125, 124.470703125,150, 185,255,0,0,100};  -- BOSS SF
    }
    
    
    function criandoareas( )
    
    for _, a in ipairs( aRadarAreaPlaces ) do
    				pRadarArea = createRadarArea ( unpack( a ) )
    				setElementData( pRadarArea, "zombieProof", true )
    			end	
    
    for _, b in ipairs( aSavePlaces ) do
    		        zona = createColRectangle ( unpack( b ) )				
    			end		
    			
    addEventHandler ( "onColShapeHit", zona ,entrando) 			
    addEventHandler ( "onColShapeLeave", zona , saindo)
    
    end
    addEventHandler ( "onResourceStart", resourceRoot,criandoareas)
    
    							
    function entrando( pHitElement )
    	if getElementType( pHitElement ) == 'player' then	     
    		 outputChatBox("[BOSS] - Você entrou em área BOSS.", pHitElement, 0, 145, 0, true)
    	elseif getElementData(pHitElement,"zombie") and getElementType( pHitElement ) == 'ped' then
    	    killPed(pHitElement)                          	
    	end				
    end
    
    
    				
    function saindo( pHitElement ) 
    	if getElementType( pHitElement ) == 'player' then
         outputChatBox("[BOSS] - Você saiu da área BOSS.", pHitElement, 145, 0, 0, true)	
    	elseif getElementData(pHitElement,"zombie") and getElementType( pHitElement ) == 'ped' then
    	    killPed(pHitElement) 
    	end
    end
    

     

  7. @marker_id: SOBREVIVENTE-1
    @teamName: SOBREVIVENTE
    @index: 1
    @thePlayer: userdata: 00000EA2
    @table_data: table: 00B66668
    
    @marker_id: SOBREVIVENTE-2
    @teamName: SOBREVIVENTE
    @index: 2
    @thePlayer: userdata: 00000EA2
    @table_data: table: 00B66668
    
    @marker_id: SOBREVIVENTE-3
    @teamName: SOBREVIVENTE
    @index: 3
    @thePlayer: userdata: 00000EA2
    @table_data: table: 00B66668
    
    @marker_id: SOBREVIVENTE-4
    @teamName: SOBREVIVENTE
    @index: 4
    @thePlayer: userdata: 00000EA2
    @table_data: table: 00B66668

    -

    @marker_id: ASSASSINO-4
    @marker_id: ASSASSINO-3
    @marker_id: ASSASSINO-2
    @marker_id: ASSASSINO-1

    Estou na Sobrevivente

  8. 4 minutes ago, DNL291 said:

    Substitua id com marker_id (na condição e na função skins).

    		if g_team and getTeamName(g_team) == marker_id:sub( 1, #marker_id-2 ) then
        				skins( hitPlayer, marker_id:sub( #marker_id ) )

    assim?

  9. testei assim, mais sem sucesso...

            local pos = {
        	["SOBREVIVENTE"]= {
        		{2346.400390625,-1272.5,26.89999961853,276}, -- sobre
        		{2339.8999023438,-1272.5,26.89999961853,277},
        		{2333.5000000000,-1272.5,26.89999961853,278},
        		{2325.400390625,-1272.5,26.89999961853,279},   		
        	},
        	["ASSASSINO"]= {
        		{2346.400390625,-1276.5,26.89999961853,234}, -- assssino
        		{2339.8999023438,-1276.5,26.89999961853,235},
        		{2333.5000000000,-1276.5,26.89999961853,236},
        		{2325.400390625,-1276.5,26.89999961853,237},
        	},
        }
    
        -- criando as marcas
        function createMarkersSkins ()
        	for k, v in pairs(pos) do
        		for i=1, #v do
        			local x, y, z = unpack(pos[k][i])
        			setElementID( createMarker(x, y, z, "cylinder", 1.5, 200 ,200, 0, 155), k )
        		end
        	end
        end
        addEventHandler("onResourceStart", resourceRoot, createMarkersSkins)
    
        addEventHandler( "onMarkerHit", resourceRoot,
        	function( hitPlayer )
        		if getElementType(hitPlayer) == "player" then
        			local g_team = getPlayerTeam(hitPlayer)
        			if g_team and getTeamName(g_team) == getElementID(source) then
        			skins(hitPlayer)
        			end
        		end
        	end
        )
    
    
    function skins(thePlayer)
    	local team = getPlayerTeam( thePlayer )
    	if not team then return end
    	
    	local table_data = pos[getTeamName(team)] or false
    	if table_data then
    	  if table_data[1] then
    		local skinID = table_data[1][4] -- skins 276, 234
    		setElementModel(thePlayer, skinID)
    		outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    	  elseif table_data[2] then
    		local skinID = table_data[2][4] -- skins 277, 235
    		setElementModel(thePlayer, skinID)
    		outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    	  elseif table_data[3] then
    		local skinID = table_data[3][4] -- skins 278, 236
    		setElementModel(thePlayer, skinID)
    		outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    	  elseif table_data[4] then
    		local skinID = table_data[4][4] -- skins 279, 237
    		setElementModel(thePlayer, skinID)
    		outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    	end
    end
    end

    sou meio ruim pra explicar como penso, mais acho que vc já tem uma noção de como quero fazer. Me ajude se puder.

  10. 14 minutes ago, DNL291 said:

    Esses grupos de coordenadas seriam para respectivos times ?

    Se eu entendi bem, você pode fazer assim:

    
    local pos = {
    	["SOBREVIVENTE"]= {
    		{2346.400390625,-1272.5,26.89999961853}, -- sobre
    		{2339.8999023438,-1272.5,26.89999961853},
    		{2333.5000000000,-1272.5,26.89999961853},
    		{2325.400390625,-1272.5,26.89999961853},
    		teamSkin = 71
    	},
    	["ASSASSINO"]= {
    		{2346.400390625,-1272.5,26.89999961853}, -- assssino
    		{2339.8999023438,-1272.5,26.89999961853},
    		{2333.5000000000,-1272.5,26.89999961853},
    		{2325.400390625,-1272.5,26.89999961853},
    		teamSkin = 73
    	},
    }
    
    -- criando as marcas
    function createMarkersSkins ()
    	for k, v in pairs(pos) do
    		for i=1, #v do
    			local x, y, z = unpack(pos[k][i])
    			setElementID( createMarker(x, y, z, "cylinder", 1.5, 200 ,200, 0, 155), k )
    		end
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, createMarkersSkins)
    
    addEventHandler( "onMarkerHit", resourceRoot,
    	function( hitPlayer )
    		if getElementType(hitPlayer) == "player" then
    			local g_team = getPlayerTeam(hitPlayer)
    			if g_team and getTeamName(g_team) == getElementID(source) then
    			
    			end
    		end
    	end
    )
    
    
    function skins(thePlayer)
    	local team = getPlayerTeam( thePlayer )
    	if not team then return outputChatBox( "Você não está em nenhuma equipe", thePlayer ) end
    	
    	local table_data = pos[getTeamName(team)] or false
    	if table_data then
    		setElementModel(thePlayer, table_data.teamSkin)
    		outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    	end
    end
    

    Coloquei identificação para as marcas, caso seja necessário obter qual o time que ela pertence.

    Queria fazer assim, tipo cada marker corresponder a um modelo de skin diferente... sendo 4 markers para cada team

    	skin model 101	{2346.400390625,-1272.5,26.89999961853}, -- sobre
    	skin model 102	{2339.8999023438,-1272.5,26.89999961853},
    	skin model 103	{2333.5000000000,-1272.5,26.89999961853},
    	skin model 104	{2325.400390625,-1272.5,26.89999961853},

     

  11. Fala pessoal, estou aqui novamente com outra dúvida...

    Queria saber como eu faço pra atrelar um modelo de skin a cada marca, para quando o player do team X entrar na marker Y que contenha a id da skin Z...

    local pos = {
    {2346.400390625,-1272.5,26.89999961853}, -- sobre
    {2339.8999023438,-1272.5,26.89999961853},
    {2333.5000000000,-1272.5,26.89999961853},
    {2325.400390625,-1272.5,26.89999961853},
    
    {2346.400390625,-1272.5,26.89999961853}, -- assssino
    {2339.8999023438,-1272.5,26.89999961853},
    {2333.5000000000,-1272.5,26.89999961853},
    {2325.400390625,-1272.5,26.89999961853},
    
    {2346.400390625,-1272.5,26.89999961853}, -- caçador
    {2339.8999023438,-1272.5,26.89999961853},
    {2333.5000000000,-1272.5,26.89999961853},
    {2325.400390625,-1272.5,26.89999961853},
    
    {2346.400390625,-1272.5,26.89999961853}, -- multi
    {2339.8999023438,-1272.5,26.89999961853},
    {2333.5000000000,-1272.5,26.89999961853},
    {2325.400390625,-1272.5,26.89999961853},
    
    {2346.400390625,-1272.5,26.89999961853}, -- pro
    {2339.8999023438,-1272.5,26.89999961853},
    {2333.5000000000,-1272.5,26.89999961853},
    {2325.400390625,-1272.5,26.89999961853},
    
    }
    
    function createMarkersSkins ()
    	for i, v in ipairs(pos) do
    		local x, y, z = unpack(v)
    		marker = createMarker(x, y, z, "cylinder", 1.5, 200 ,200, 0, 155)
    		addEventHandler("onMarkerHit", marker, skins)
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, createMarkersSkins)
    
    
    function skins(thePlayer)
       local team = getTeamName(getPlayerTeam( thePlayer ))
       if (team == "SOBREVIVENTE") then
          setElementModel(thePlayer, 71)
       outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
       
       elseif (team == "ASSASSINO" )then
          setElementModel(thePlayer, 73)
       outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
       
       elseif (team == "CAÇADOR")then
          setElementModel(thePlayer, 73)
       outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
       
       elseif (team == "MULTILADOR")then
          setElementModel(thePlayer, 74)
       outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
       
       elseif (team == "PROFISSIONAL")then
       setElementModel(thePlayer, 75)
       outputChatBox (getPlayerName(thePlayer).." você trocou sua skin",thePlayer, 0, 255, 0,true)
    end
    end

    obs: as markers estão iguais apenas para exemplo.

    Me ajudem pls <3

×
×
  • Create New...