Kilfwan Posted June 3, 2015 Share Posted June 3, 2015 Hola estoy haciendo mi sistema De Zonas de Guerra: Todo va bien Pero cuando es de matar al bot solo detecta al primero que se spawnio , cuando se spawnea el segundo lo mato y no me da dinero solo al primero que salio este es la parte del error: function money (theKiller) if (source == gang) then givePlayerMoney(theKiller,math.random(50)) outputChatBox ( getPlayerName ( theKiller ) .. " un Balla a Muerto", thePlayer, 255, 0, 0, true ) setTimer(losBot, 50000, 0) end end addEvent("onBotWasted", true) addEventHandler("onBotWasted", getRootElement(), money) function destroy () if ( not isElement ( gang ) ) then destroyElement(sublip) end end addEvent("onBotWasted", true) addEventHandler("onBotWasted", getRootElement(), destroy) A y otra cosa Cuando se muere el bot no se Borra el blip. Link to comment
Castillo Posted June 3, 2015 Share Posted June 3, 2015 Eso es porque estas sobrescribiendo las variables, usa una tabla para que esto no pase. Link to comment
Josemisplit Posted June 4, 2015 Share Posted June 4, 2015 A qué te refieres con esto A y otra cosa Cuando se muere el bot no se Borra el blip. A que se queda en el minimapa y aunque respawnee el muerto sigue estando allí ? Link to comment
Kilfwan Posted June 4, 2015 Author Share Posted June 4, 2015 Se muere el y desaparece pero su blip sige hay Este es todo el codigo que uso: local ballas = createTeam ( "Ballas", 198, 0, 255 ) local ase = createTeam ( "Asesinos", 255, 0, 0 ) local ninos = createTeam ( "Ninos Rata", 255, 126, 0 ) local hillRadar = createRadarArea ( 2382.18433, -1648.25464, 150, -150, 198, 0, 255, 175 ) local hillRadar2 = createRadarArea ( 2223.94067, -1887.78479, 150, -150, 198, 0, 255, 175 ) local hillRadar3 = createRadarArea (2231.70142, -1769.14685, 140, -110, 198, 0, 255, 175 ) local hillRadar4 = createRadarArea (2823.50952, -1493.70227, 140, -110, 198, 0, 255, 175 ) local hillRadar5 = createRadarArea (2178.48828, -1636.26770, 130, -120, 198, 0, 255, 175 ) local hillRadar6 = createRadarArea (2173.64746, -1119.93347, 130, -120, 198, 0, 255, 175 ) local hillRadar7 = createRadarArea (2164.70581, -1258.82349, 130, -120, 198, 0, 255, 175 ) posiciones = { {2251.39038, -1916.87305, 13.54688}, {2323.17017, -1943.71057, 13.58594}, {2298.85156, -1811.56531, 13.54688}, {2178.48828, -1636.26770, 20.43101}, {2882.48706, -1531.57092, 11.08802}, {2226.44482, -1169.71008, 25.72656}, {2220.83789, -1178.87000, 29.79709}, {2229.82300, -1169.64258, 25.75455}, {2218.19360, -1299.41711, 23.82031}, {2224.39893, -1357.40991, 23.98745}, {2212.27734, -1705.17261, 13.63867}, {2225.02881, -1683.69617, 14.14757}, } arma = { {30}, {31}, {29}, {27}, } function losBot() local x, y, z = unpack(posiciones[math.random(#posiciones)]) local arma = unpack(arma[math.random(#arma)]) gang = exports [ "slothBot" ]: spawnBot (x, y, z, 0, 102, 0, 0, ballas, arma, "hunting", true ) local sublip = (createBlipAttachedTo ( gang, 0 )) setBotTeam ( gang, ballas ) end addEventHandler("onResourceStart", resourceRoot, losBot) setTimer(losBot, 120000, 0) function money (theKiller) if (source == gang) then givePlayerMoney(theKiller,math.random(5000)) outputChatBox ( getPlayerName ( theKiller ) .. " un Balla a Muerto", thePlayer, 255, 0, 0, true ) setTimer(losBot, 100000, 0) end end addEvent("onBotWasted", true) addEventHandler("onBotWasted", getRootElement(), money) function destroy () if ( not isElement ( gang ) ) then destroyElement(sublip) end end addEvent("onBotWasted", true) addEventHandler("onBotWasted", getRootElement(), destroy) local cool = createColRectangle ( 2382.18433, -1648.25464, 50, 500) function hill_Enter ( thePlayer, matchingDimension ) -- announce to everyone that the player entered the hill if (getElementType(thePlayer) == "player") then outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", getRootElement(), 255, 255, 109 ) setRadarAreaFlashing ( hillRadar, true ) end end addEventHandler ( "onColShapeHit", cool, hill_Enter ) -- add hill_Enter as a handler for when a player leaves the hill area function hill_Exit ( thePlayer, matchingDimension ) -- check if the player is not dead if (getElementType(thePlayer) == "player") then if isPedDead ( thePlayer ) ~= true then -- if he was alive, announce to everyone that the player has left the hill outputChatBox ( getPlayerName(thePlayer) .. " left the zone!", getRootElement(), 255, 255, 109 ) setRadarAreaFlashing ( hillRadar, false ) end end end addEventHandler ( "onColShapeLeave", cool, hill_Exit ) Algo esta mal? Y si pueden ayudarme en alinear el cool rectangle con el radar area?? Link to comment
Recommended Posts