Jump to content

Cocodrilo

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by Cocodrilo

  1. I want to destroy an object and a colSphere when i hit the col but it doesn't work What is wrong ? items = { { "Tire!", 1073, -1428.4814453125, 2666.4931640625, 55.6875 , 1}, { "Engine!", 929, -1425.5595703125, 2654.69140625, 55.6875, 0.3}, { "Hamburguer!", 2768, -1411.2607421875, 2635.3916015625, 55.6875, 1}, } function createFunction ( ) outputChatBox ("New items has been created!", player, 0,255,0) for i, v in ipairs ( items ) do object = createObject ( v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ]- 0.875, 0, 0, math.random ( 0, 360 ) ) setObjectScale(object, v [ 6 ] ) setElementCollisionsEnabled(object, false) setElementFrozen(object, true) setElementData ( object, v [ 1 ], true ) marker = createColSphere(v[3],v[4],v[5], 0.75) setElementData ( marker, "item", v [ 1 ] ) setElementData ( marker, "parent", object ) end end addEventHandler ( "onResourceStart", getRootElement(), createFunction) function claymoreHit ( player, matchingDimension ) if (getElementData (source,"item") == "Tire!" ) then setTimer ( function ( ) outputChatBox ("Tire!", player, 0,255,0) for i, v in ipairs ( items ) do object = createObject ( v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ]- 0.875, 0, 0, math.random ( 0, 360 ) ) setObjectScale(object, v [ 6 ] ) setElementCollisionsEnabled(object, false) setElementFrozen(object, true) setElementData ( object, v [ 1 ], true ) marker = createColSphere(v[3],v[4],v[5], 0.75) setElementData ( marker, "item", v [ 1 ] ) setElementData ( marker, "parent", object ) --[[ 1st Problem : ]] destroyElement(object) destroyElement(marker) --[[ Why elements are not destroyed? ]] end end ,50, 1 ) end end addEventHandler ( "onColShapeHit", getRootElement (), claymoreHit ) function respawnFunction ( ) --[[ 2nd problem: this would works if the problem 1 works ]] if ( not isElement ( object)) and ( not isElement ( marker)) then ---- setTimer ( function ( ) outputChatBox ("Respawn Items!", player, 0,255,0) for i, v in ipairs ( items ) do object = createObject ( v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ]- 0.875, 0, 0, math.random ( 0, 360 ) ) setObjectScale(object, v [ 6 ] ) setElementCollisionsEnabled(object, false) setElementFrozen(object, true) setElementData ( object, v [ 1 ], true ) marker = createColSphere(v[3],v[4],v[5], 0.75) setElementData ( marker, "item", v [ 1 ] ) setElementData ( marker, "parent", object ) end end ,5000, 0 ) end end respawnFunction ( )
  2. maybe, i am very confused. I found this code: local locations = { { -- ls_beach { x=529, y=-1884, z=3 }, { x=612, y=-1884, z=3 } }, { -- sf_beach { x=-2920, y=68, z=1 }, { x=-2913, y=159, z=3 } } } addEventHandler("onResourceStart", resourceRoot, function () setTimer(function() local randomResult = locations[math.random(1,#locations)] for i=1,#randomResult do local locationInfo = randomResult[i] createObject ( 1337, locationInfo.x, locationInfo.y, locationInfo.z) end end,60000,1) end) I want that but without x= , y=, z= just like this { -1428.4814453125, 2666.4931640625, 55.6875 }
  3. I really want : 1.- get objects positions: v[3] , v[4], v[5] from the table. Then create a call local all objects positions to then create the object with random positions. 2.- follow suit for objects ids v[2]
  4. What is wrong here? I want to create items with random ID and Positions. --example for items .. items = { { "Tire!", 1073, -1428.4814453125, 2666.4931640625, 55.6875}, { "Engine!", 929, -1425.5595703125, 2654.69140625, 55.6875}, { "Hamburguer!", 2768, -1411.2607421875, 2635.3916015625, 55.6875}, } function mainFunction() local tiempo = 5000 if ( not isElement (items)) then setTimer ( function() for i,v in ipairs (items) do local randomPos = items[math.random(v[3],v[4],v[5],#items)] local randomID = items[math.random(v[2],#items)] object = createObject(randomID, randomPos, math.random(0, 360)) setElementData(object, v[1], true) end end, tiempo, 1 ) end end mainFunction()
  5. Hi everyone, i got a little problem .. i will be very grateful if you show me a way to solve it I want to do two things: 1.- onClientMarkerHit - destroy: 'neumatico' and 'neumaticoMarker' i had hit i use destroyElement but it only destroys the marker. So, how to destroy the pickup too? 2.- I want to respawn 'neumatico' and 'neumaticoMarker' every 20 seconds if these elements are not. I tried to add setTimer function but doesn't worked. llantas = { {1665.1064453125, -2113.4404296875, 13.546875,0,0} } addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function iniciar() for i,v in ipairs (llantas) do local neumatico = createPickup (v[1],v[2],v[3],3,2768,100) local neumaticoMarker = createMarker (v[1],v[2],v[3],"corona",1,143,143,17,80) setElementData (neumaticoMarker,"Neumatico!!", true) setElementInterior (neumaticoMarker,v[4]) setElementInterior (neumatico,v[4]) setElementDimension(neumatico,tonumber(v[5])) setElementDimension(neumaticoMarker,tonumber(v[5])) end end) addEventHandler ("onClientMarkerHit",getRootElement(), function(hitEle,dim) if (getLocalPlayer() == hitEle) and (getElementData (source,"Neumatico!!") == true) and (dim) then triggerServerEvent("addAcountNeumatico",getLocalPlayer(),getLocalPlayer(),1) outputChatBox ("+ 1 Neumático",0,255,0,false) --destroyElement(source) end end )
  6. Un marcador se crea con: createMarker Y el interior se lo puedes dar con: setElementInterior
  7. setElementData getElementData
  8. Server Humanos vs Zombies IP: mtasa://198.50.238.99:22015 Es un servidor de roleplay, Empiezas eligiendo un personaje, eres un Humano junto con todos los players del server (no se pueden matar entre ellos ) , Pero cuidado.. Si te muerte un zombie en 10 minutos eres uno de ellos y los humanos podran matarte apenas te vean. En nuestro scoreboard contamos con: | Zombie kills | Nivel | Boss kills | Dinero | STAFF | VIP | Contamos con: -Refugios -Zonas Seguras -Mod de armas -Sonidos modificados -Skins de Zombies -Sistema de Boss -Sistema de VIP -Panel de Armas -Panel de Autos -Chat Privado -Autos modificados -Guardamos tus Stats para cuando salgas y entres -Eventos, Premios y mucho mas.
  9. Now how to add a setTimer to spawn the bot 10 sec after i hit the marker ?
  10. Hi everyone, How to make to spawn a bot when i hit a maker? This is my code but even I can't see the marker What is wrong? local coco = createMarker( -5894.84375, 1705.669921875, 190.88436889648, "Cylinder", 3, 143, 7, 49, 255) function MarkerHit( hitElement, matchingDimension ) local elementType = getElementType( hitElement ) local account = getPlayerAccount( hitElement ) local zombiekills = getAccountData(account,"Zombie kills") if (zombiekills <= 100000) then local skin = 155 slothbot1 = exports [ "slothbot" ]:spawnBot ( 168.3, 1409.7, 10.6, 90, skin, 0, 0, ex, 38, "hunting", true ) local id = getElementModel ( slothbot1 ) if id == 155 then exports.extra_health:setElementExtraHealth(slothbot1, 1000) outputChatBox("The Boss 1 has spawned !!!", getRootElement(), 255, 0, 0) myBlip = createBlipAttachedTo ( slothbot1, 23 ) end end end addEventHandler( "onMarkerHit", coco, MarkerHit )
  11. What is wrong? addEventHandler("onPlayerWasted", getRootElement(), function (killer) local message if killer then if killer ~= source then local killerType = getElementType(killer) if killerType == "player" then message = getPlayerName(killer).." mató a "..getPlayerName(source).."." givePlayerMoney ( killer, 10000 ) outputChatBox(message) end end end end )
  12. What is wrong? function kickPlayerHandler ( killer, kickedname, reason ) -- Get player element from the name local kicked = getPlayerFromName ( killer ) if ( killer ) and ( killer ~= source ) then kickPlayer ( kicked, killer, reason ) outputChatBox("No kill people!", 0,0,255) end end addEventHandler ( "onPlayerWasted", getRootElement(), kickPlayerHandler )
  13. thank you!! :') fixed
  14. When i start the script works fine but in 1 hour after aprox happen this.. Simple Spawn.. addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function team ( ) theTeam = createTeam ( "Jugadores", 143,143,16 ) -- create a new team with the specified name end addEventHandler ( "onResourceStart", resourceRoot, team ) function spawn(player) repeat until spawnPlayer ( player, -320.90335, 1799.0190, 42.78125, 0, 23 ) giveWeapon ( player, 25 , 35, true ) fadeCamera(player, true) setCameraTarget(player, player) setPlayerTeam (player, theTeam) end addEventHandler("onPlayerLogin", root, function() spawn(source) end ) addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 4000, 1, source) end ) why?
  15. yes, but doesn't show level 1 and level 2 in the scoreboard. After level 2 its show
  16. Well, this DO NOT show "Level 1" and " Level 2" What's wrong? exports.scoreboard:addScoreboardColumn('Level') addEventHandler("onPlayerSpawn",root, function() local account = getPlayerAccount(source) local zombiekills = getAccountData(account,"Zombie kills") if (zombiekills >= 1) and (zombiekills <= 99) then setAccountData ( account, "Level", "Level 1" ) elseif (zombiekills >= 100) and (zombiekills <= 249) then setAccountData ( account, "Level", "Level 2" ) elseif (zombiekills >= 250) and (zombiekills <= 499) then setAccountData ( account, "Level", "Level 3" ) elseif (zombiekills >= 500) and (zombiekills <= 999) then setAccountData ( account, "Level", "Level 4" ) elseif (zombiekills >= 1000) and (zombiekills <= 1499) then setAccountData ( account, "Level", "Level 5" ) elseif (zombiekills >= 1500) and (zombiekills <= 2249) then setAccountData ( account, "Level", "Level 6" ) elseif (zombiekills >= 2250) and (zombiekills <= 3499) then setAccountData ( account, "Level", "Level 7" ) elseif (zombiekills >= 3500) and (zombiekills <= 4999) then setAccountData ( account, "Level", "Level 8" ) elseif (zombiekills >= 5000) and (zombiekills <= 7999) then setAccountData ( account, "Level", "Level 9" ) elseif (zombiekills >= 8000) and (zombiekills <= 12999) then setAccountData ( account, "Level", "Level 10" ) elseif (zombiekills >= 13000) and (zombiekills <= 19999) then setAccountData ( account, "Level", "Level 11" ) elseif (zombiekills >= 20000) and (zombiekills <= 29999) then setAccountData ( account, "Level", "Level 12" ) elseif (zombiekills >= 30000) and (zombiekills <= 39999) then setAccountData ( account, "Level", "Level 13" ) elseif (zombiekills >= 40000) and (zombiekills <= 49999) then setAccountData ( account, "Level", "Level 14" ) elseif (zombiekills >= 50000) and (zombiekills <= 59999) then setAccountData ( account, "Level", "Level 15" ) elseif (zombiekills >= 60000) and (zombiekills <= 69999) then setAccountData ( account, "Level", "Level 16" ) elseif (zombiekills >= 70000) and (zombiekills <= 79999) then setAccountData ( account, "Level", "Level 17" ) elseif (zombiekills >= 80000) and (zombiekills <= 79999) then setAccountData ( account, "Level", "Level 18" ) elseif (zombiekills >= 80000) and (zombiekills <= 89999) then setAccountData ( account, "Level", "Level 19" ) elseif (zombiekills >= 90000) and (zombiekills <= 99999) then setAccountData ( account, "Level", "Level 20" ) elseif (zombiekills >= 100000) and (zombiekills <= 999999999) then setAccountData ( account, "Level", "Level Dios" ) end end ) addEventHandler("onPlayerSpawn",root, function () local cuenta = getPlayerAccount(source) if isGuestAccount(cuenta) then return end local rango = getAccountData(cuenta,"Level") if rango then setElementData(source,"Level", rango) end end )
  17. I am trying to make a spawn menu. I use "guiStaticImageLoadImage" to change one image for another one.. but i need use "onClientGUIClick" in a image(which are constantly changing) to add a "triggerServerEvent" and finally use "spawnPlayer" in Server-side. please anyone can help me with the function? local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 661, 528 local left = (screenWidth-windowWidth)/2 local top = (screenHeight-windowHeight)/2 PANEL = guiCreateWindow(left,top,windowWidth,windowHeight, "", false) guiWindowSetSizable(PANEL, false) showCursor( true ) BANNER = guiCreateStaticImage(9, 18, 642, 163, ":guieditor/images/examples/shruk.png", false, PANEL) LEFT = guiCreateStaticImage(190, 350, 26, 23, "left.png", false, PANEL) RIGHT = guiCreateStaticImage(440, 350, 26, 23, "right.png", false, PANEL) LABEL = guiCreateStaticImage(150, 173, 400, 64, "label.png", false, PANEL) BOTONLEFT = guiCreateButton(190, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONLEFT, 0.0) BOTONIMAGEN = guiCreateButton(225, 242, 208, 219, "", true, PANEL) guiSetAlpha(BOTONIMAGEN, 0.0) IMAGENRICK = guiCreateStaticImage(225, 242, 208, 219, "1.png", false, PANEL) BOTONRIGHT = guiCreateButton(440, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONRIGHT, 0.0) local images = { "1.png","2.png","3.png","4.png","5.png","6.png","7.png","8.png" } local id = 1 addEventHandler("onClientGUIClick", BOTONRIGHT, function ( ) if id then id = id + 1 else id = id - 1 end if id < 1 then id = #images end if id > #images then id = 1 end guiStaticImageLoadImage ( IMAGENRICK , images [ id ] ) end,false ); local images = { "1.png","2.png","3.png","4.png","5.png","6.png","7.png","8.png" } local id = 1
  18. wow!! works thank you so much!! :')
×
×
  • Create New...