Plate Posted June 12, 2012 Author Posted June 12, 2012 es facil por skin lo de los autos esta arreglado vas a la wiki ponias nose que y te sale el script gracias por tu ayuda igual lo unico que me falta son los teams
iFoReX Posted June 12, 2012 Posted June 12, 2012 podrias hacer un setPlayerTeam( getPlayerFromName( sourcePlayer ) )
Castillo Posted June 12, 2012 Posted June 12, 2012 hay va bien? function teams ( sourcePlayer ) local accName = getAccountName ( getPlayerAccount ( sourcePlayer ) ) if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) then local pname = getPlayerFromName ( sourcePlayer ) if (pname) then local teams = getTeamFromName ( 'Umbrella') if ( teams ) then setPlayerTeam ( sourcePlayer, teams ) end end end end addCommandHandler ( "agregarUmbrella", teams ) Yo dije agregar, no remplazar.
Plate Posted June 12, 2012 Author Posted June 12, 2012 antes de seguir con el tema me dicen si esta bien esto? local randomSpawnTable = { { 1086.6645507813, 1076.1888427734, 10.838157653809,}, { -2086.9196777344, 173.74137878418, 35.0546875 }, { -2667.5134277344, 734.33197021484, 27.953125 }, { -2497.6953125, -697.30908203125, 139.3203125 }, { -2333.6032714844, -1621.1364746094, 483.71069335938 }, { 1862.423828125, 2624.6528320313, 13.8719085693 } } function Bot () local random = math.random ( #randomSpawnTable ) slothbot = exports["slothbot"]:spawnBot( unpack (randomSpawnTable [ random ] ), 90, math.random (300,303), 0, 0, Boss, 38, hunting, true ) exports.extrahealth:setElementExtraHealth(slothbot,5000) end addEventHandler("onResourceStart",getRootElement(),Bot)
Castillo Posted June 12, 2012 Posted June 12, 2012 Parecer estarlo, lo unico, no creo que la vida extra te funcione, ese recurso tiene algun tipo de problema.
Plate Posted June 12, 2012 Author Posted June 12, 2012 aparte de que el bot no spawnea por que solid yo quisiera poner posiciones y que el bot spawnee en una random como seria?
Castillo Posted June 12, 2012 Posted June 12, 2012 local randomSpawnTable = { { 1086.6645507813, 1076.1888427734, 10.838157653809,}, { -2086.9196777344, 173.74137878418, 35.0546875 }, { -2667.5134277344, 734.33197021484, 27.953125 }, { -2497.6953125, -697.30908203125, 139.3203125 }, { -2333.6032714844, -1621.1364746094, 483.71069335938 }, { 1862.423828125, 2624.6528320313, 13.8719085693 } } function Bot ( ) local random = math.random ( #randomSpawnTable ) local x, y, z = unpack ( randomSpawnTable [ random ] ) slothbot = exports [ "slothbot" ]:spawnBot ( x, y, z, 90, math.random ( 300, 303 ), 0, 0, Boss, 38, hunting, true ) exports.extrahealth:setElementExtraHealth ( slothbot, 5000 ) end addEventHandler ( "onResourceStart", resourceRoot, Bot )
Plate Posted June 12, 2012 Author Posted June 12, 2012 Solid del recurso de bloquear los autos como seria para bloquear mas de uno
Castillo Posted June 12, 2012 Posted June 12, 2012 Podrias crear una tabla con los vehiculos y luego checkeas si ese vehiculo tiene X element data.
Plate Posted June 12, 2012 Author Posted June 12, 2012 D: no me anda el extrahealth cuando pongo que el bot spawnee en las posiciones esas(random) como podria hacer que ande???
Castillo Posted June 12, 2012 Posted June 12, 2012 --[[ /************************************************************** * * Script: Spot Management System * File: manager_server.lua * Version: 1.0.0 R3 * Date: 2012-05-26 * ***************************************************************/ --]] if not getResourceFromName("zombies") then return end local RADIUS = 10 local COUNT = 0 local SPOT = { } local ZOMBIESINSPOT = { } function setRadius ( source, command, radius ) if ( command == "setradius" ) then if ( not radius ) then return false end RADIUS = tonumber ( radius ) outputChatBox ( "You have set spot radius to " .. RADIUS, source ) playSoundFrontEnd ( source, 41 ) end end addCommandHandler ( "setradius", setRadius ) function setCSPOT ( source, command, spot ) if ( command == "setcurrentspot" ) then if ( not spot ) then return false end currentSpot = tonumber ( spot ) outputChatBox ( "You have set current spot to spot[" .. spot .. "]", source ) playSoundFrontEnd ( source, 41 ) end end addCommandHandler ( "setcurrentspot", setCSPOT ) function addZombieToSpot ( source, command, spot, rot, skin, interior, dimension, level, maxhealth, boss ) if ( command == "addzombie" ) then if ( not spot ) then return false end if ( not rot ) then local rot = math.random ( 1, 359 ) end if ( not skin ) then skin = 0 end if ( not interior ) then interior = 0 end if ( not dimension ) then dimension = 0 end if ( not level ) then level = 1 end if ( not maxhealth ) then maxhealth = 100 end if ( not boss ) then boss = false end local currentSpot = tonumber ( spot ) local sx, sy, sz = getElementPosition ( SPOT [ currentSpot ] ) local sortZombies = ( RADIUS / 1.2 ) local zom = exports.zombies:createZombie ( sx + math.random ( -sortZombies, sortZombies ), sy + math.random ( -sortZombies, sortZombies ), sz + 10, rot, skin, interior, dimension, level, maxhealth, boss ) if ( zom ) then table.insert ( ZOMBIESINSPOT, zom ) setElementData ( zom, "zombieSpot", SPOT [ currentSpot ] ) outputChatBox ( "You have added '" .. getElementData ( zom, "name" ) .. "' to spot[" .. spot .. "]", source ) playSoundFrontEnd ( source, 41 ) else outputChatBox ( "Failed to create spot!", source ) end end end addCommandHandler ( "addzombie", addZombieToSpot ) -- ADD ZOMBIE GUI addEvent ( "addz", true ) function addZgui ( isboss, skin, interior, dimension, level, maxhp, name ) if ( skin and interior and dimension and level and maxhp ) then local rot = math.random ( 1, 359 ) local sx,sy,sz = getElementPosition ( SPOT [ currentSpot ] ) local sortZombies = ( RADIUS / 1.2 ) local zom = exports.zombies:createZombie ( sx + math.random ( -sortZombies, sortZombies ),sy + math.random ( -sortZombies, sortZombies ), sz + 10, rot, skin, interior, dimension, level, maxhp, isboss ) if ( zom ) then table.insert ( ZOMBIESINSPOT, zom ) setElementData ( zom, "zombieSpot", SPOT [ currentSpot ] ) if ( name == "" ) then outputChatBox ( "You have added '" .. getElementData ( zom, "name" ) .. "' to spot[" .. currentSpot .. "]", source ) else outputChatBox ( "You have added '" .. name .. "' to spot[" .. currentSpot .. "]", source ) setElementData ( zom, "name", name ) end else outputChatBox ( "Failed to create spot!", source ) end end end addEventHandler( "addz", root, addZgui ) function destroySpot ( source, command, spotToDestroy ) if ( command == "destroyspot" ) then if ( currentSpot ) then if ( not spotToDestroy ) then spotToDestroy = currentSpot currentSpotElem = SPOT [ currentSpot ] end local currentSpotElem = SPOT [ tonumber ( spotToDestroy ) ] if ( currentSpotElem and spotToDestroy ) then destroyElement ( currentSpotElem ) table.remove ( SPOT, spotToDestroy ) COUNT = ( COUNT - 1 ) outputChatBox ( "You have destroyed SPOT[" .. spotToDestroy .. "]", source ) playSoundFrontEnd ( source, 41 ) else outputChatBox ( "SPOT[" .. spotToDestroy .. "] doesnt exist.", source ) playSoundFrontEnd ( source, 41 ) end end end end addCommandHandler ( "destroyspot", destroySpot ) function outputClick ( mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY ) if ( mouseButton == "right" and buttonState == "down" ) then local file = fileOpen ( "spots.lua", false ) fileSetPos ( file, fileGetSize ( file ) ) COUNT = ( COUNT + 1 ) local written = fileWrite ( file, '\n\r\nspot[' .. COUNT .. '] = createZombieSpot(' .. worldPosX .. ", " .. worldPosY .. ", " .. worldPosZ .. ", " .. RADIUS .. " )\r\n" ) if ( written ) then outputChatBox ( "You have created SPOT[" .. COUNT .. "]", source ) playSoundFrontEnd ( source, 41 ) end --SPOT [ COUNT ] = createColSphere ( worldPosX, worldPosY, worldPosZ, RADIUS ) SPOT [ COUNT ], radius = exports.zombies:createZombieSpot ( worldPosX, worldPosY, worldPosZ, RADIUS ) setElementData ( SPOT [ COUNT ], "radius", radius ) --setElementData ( SPOT [ COUNT ], "count", COUNT ) currentSpot = COUNT fileFlush ( file ) end end addEventHandler ( "onPlayerClick", getRootElement(), outputClick ) function markSpot ( ) local spot = SPOT local currentspot = currentSpot local zombiesinspot = ZOMBIESINSPOT triggerClientEvent ( "markSpotC", root, spot, currentspot, zombiesinspot ) end setTimer ( markSpot, 50, 0 ) --DESTROYS CREATED ZOMBIES BY SPOT MANAGER function Zomb_delete ( ped ) if isElement ( ped ) then if ( getElementData ( ped, "zombie") == true ) then for theKey, thePed in ipairs ( ZOMBIESINSPOT ) do if ( ped == thePed ) then table.remove ( ZOMBIESINSPOT, theKey ) break end end destroyElement ( ped ) end end end addEventHandler ( "onResourceStop", resourceRoot, function ( ) for k,zombie in ipairs ( ZOMBIESINSPOT ) do --table.remove( ZOMBIESINSPOT, k ) Zomb_delete ( zombie ) end end ) Le agregue unos "if" para saber si el zombie fue creado o no.
Plate Posted June 12, 2012 Author Posted June 12, 2012 eso me dice cuando lo inicio que puedo hacer con eso del bot para que me funcione el extrahealth
Castillo Posted June 12, 2012 Posted June 12, 2012 Copialo de nuevo, ya arregle el error. Para lo del extrahealth, te dije que no iva a funcionar, algo no funciona en ese recurso.
Plate Posted June 12, 2012 Author Posted June 12, 2012 Genial solid muchas gracias por corregir el recurso ahora simplemente me falta usar getElementData, setElementData para que den experiencia por que esos zombies tienen level y segun su level son zombies rojos verdes o amarillos lo de los teams seria haci mira function teams ( sourcePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( sourcePlayer ) ) if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) then local pname = getPlayerFromName ( sourcePlayer, teams ) if (pname) then local teams = getTeamFromName ( 'Umbrella') if ( teams ) then setPlayerTeam(sourcePlayer, teams) end end end end addCommandHandler ( "agregarUmbrella", teams )
iFoReX Posted June 12, 2012 Posted June 12, 2012 por lo que veo tiene solo algunos errores 1. para que y que es 'playerName' ? 2. para que poner 3 if si en 1 if puedes hacer todos esos con 'and's
Alexs Posted June 12, 2012 Posted June 12, 2012 function teams ( thePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) --Consigue el Nombre de una cuenta y la cuenta del Player local pname = getPlayerFromName ( playerName ) --Consigue al user local teams = getTeamFromName ( 'Umbrella') --Consigue el Team Por su nombre if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) and (pname) and ( teams )) then --Si el player esta en "LiderUmbrella" , el player que busco existe y el team existe entonces: setPlayerTeam(playerName, teams) --Se pone al user en el team "Umbrella" end end addCommandHandler ( "agregarumbrella", teams ) Quiza haya algun error.
Plate Posted June 12, 2012 Author Posted June 12, 2012 (edited) Si hay pero gracias igual esto me dice cuando lo inicio SCRIPT ERROR : team/teams.lua:5:"then" expected near ")" WARNING loading script failed : team/ teams.lua deja lo arregle no no anda los saca pero no los agrega Edited June 12, 2012 by Guest
Alexs Posted June 12, 2012 Posted June 12, 2012 pasame el que pusiste, segun eso falta el 'then' pero yo si lo agregue
Plate Posted June 12, 2012 Author Posted June 12, 2012 seria el de agregar (este) function teams ( thePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local pname = getPlayerFromName ( playerName ) local teams = getTeamFromName ( 'Umbrella') if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) and (pname) and ( teams ) then setPlayerTeam(playerName, teams) end end addCommandHandler ( "agregarumbrella", teams ) no funciona pero haci (para sacar) si function teams ( thePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local pname = getPlayerFromName ( playerName ) local teams = getTeamFromName ( 'Umbrella') if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) and (pname) and ( teams ) then setPlayerTeam(playerName, nil) end end addCommandHandler ( "quitarumbrella", teams )
Alexs Posted June 13, 2012 Posted June 13, 2012 function teamsa ( thePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local pname = getPlayerFromName ( playerName ) local teams = getTeamFromName ( 'Umbrella') if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) and (pname) and ( teams ) then setPlayerTeam(playerName, teams) end end addCommandHandler ( "quitarumbrella", teamsa ) Si sacar funciona, intenta asi
Plate Posted June 14, 2012 Author Posted June 14, 2012 no , no funciona u.u no tendria que ser mas haci mira function teamsa ( thePlayer, playerName ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local pname = getPlayerFromName ( playerName ) local teams = getTeamFromName ( 'Umbrella') if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "LiderUmbrella" ) ) and (pname) and ( teams ) then setPlayerTeam(playerName, teams, pname) end end addCommandHandler ( "quitarumbrella", teamsa )
Recommended Posts