Ernesto Posted May 5, 2018 Share Posted May 5, 2018 local blips = { } local ref = { } addCommandHandler ( "ref", function ( player ) local x, y, z = getElementPosition ( player ) local city = getZoneName ( x, y, z ) local ref = ref [ player ] local blip = blips [ player ] if exports.factions:isPlayerInFaction ( player, 1 ) then getPolicias ( ) if ref == false or ref == nil then exports.chat:me ( player, "pide refuerzos por su radio." ) for i=1, #policias do local value = policias [ i ] blips [ player ] = createBlipAttachedTo ( player, 0, 3, 255, 255, 0 ) setElementVisibleTo ( blips [ player ], root, false ) setElementVisibleTo ( blips [ player ], value, true ) end exports.factions:sendMessageToFaction ( 1, "El compañero "..getPlayerName (player).." ha pedido refuerzos en "..city..". Punto marcado en el GPS.", 255, 255, 0 ) ref[ player ] = true else if isElement ( blip ) then destroyElement ( blip ) end exports.chat:me ( player, "cancela los refuerzos por su radio." ) exports.factions:sendMessageToFaction ( 1, "El compañero "..getPlayerName (player).." ha cancelado los refuerzos.", 255, 255, 0 ) ref[ player ] = false end end end ) ¿Donde podria estar el error?, al usar /ref , marca donde esta la persona pero cuando lo vuelvo a poner /ref no se quita el blip sino que pide refuerzos denuevo. Link to comment
Platin Posted May 5, 2018 Share Posted May 5, 2018 Esto debería de funcionar, la tabla ref esta al dope. local blips = {} addCommandHandler ( "ref", function ( player ) local x, y, z = getElementPosition ( player ) local city = getZoneName ( x, y, z ) if exports.factions:isPlayerInFaction ( player, 1 ) then getPolicias ( ) if not blips[player] then exports.chat:me ( player, "pide refuerzos por su radio." ) for i=1, #policias do local value = policias [ i ] blips [ player ] = createBlipAttachedTo ( player, 0, 3, 255, 255, 0 ) setElementVisibleTo ( blips [ player ], root, false ) setElementVisibleTo ( blips [ player ], value, true ) end exports.factions:sendMessageToFaction ( 1, "El compañero "..getPlayerName (player).." ha pedido refuerzos en "..city..". Punto marcado en el GPS.", 255, 255, 0 ) else if isElement ( blips[player] ) then destroyElement ( blips[player] ) end exports.chat:me ( player, "cancela los refuerzos por su radio." ) exports.factions:sendMessageToFaction ( 1, "El compañero "..getPlayerName (player).." ha cancelado los refuerzos.", 255, 255, 0 ) blips[player] = nil end end end ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now