Aono Posted August 18, 2013 Share Posted August 18, 2013 Hola, estaba tratando de crear un script para que un admin ponga un comando y aparezca un carro, y luego lo teletransporte adentro del auto, pero no me funciona el script es algo asi: function funcion( source, commandName) Jugador = getLocalPlayer() x,y,z = getElementPosition ( Jugador ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then local carrouno = createVehicle ( 411, x, y, z ) warpPlayerIntoVehicle ( Jugador, carrouno ) end addCommandHandler ( "infernus", funcion) tambien me gustaria que al salir el admin del vehiculo este se destruya pero no se como hacer eso Link to comment
Daniel1zD Posted August 18, 2013 Share Posted August 18, 2013 (edited) function infernus(thePlayer) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then Object1 = createVeichle(411, x, y, z-1)--- ID del auto outputChatBox("creaste el auto", thePlayer, 0, 250, 0) else(isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(Object1, vehicle) end end addCommandHandler("auto", infernus) function infernus(thePlayer) if (isElement(Object1)) then destroyElement(Object1) outputChatBox("destruido", thePlayer, 0, 0, 255) else outputChatBox("destruido", thePlayer, 250, 0, 0) end end addCommandHandler("destroy", infernus) con eso puedes destruir el auto no lo e probado avísame si funciona o tiene algún error Edited August 18, 2013 by Guest Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 pero, en vez de object1, pongo carrouno verdad? Link to comment
Daniel1zD Posted August 18, 2013 Share Posted August 18, 2013 function infernus(thePlayer) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then Object1 = createVeichle(411, x, y, z-1)--- ID del auto outputChatBox("creaste el auto", thePlayer, 0, 250, 0) else(isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(Object1, vehicle) end end addCommandHandler("auto", infernus) function infernus(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then else (isElement(Object1)) then destroyElement(Object1) outputChatBox("destruido", thePlayer, 0, 0, 255) else outputChatBox("destruido", thePlayer, 250, 0, 0) end end addCommandHandler("destroy", infernus) prueva y decime si te funciono no esta provado aun Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 No pero antes una duda (creo que debio ser mi primera pregunta) es server side o client side? Link to comment
Daniel1zD Posted August 18, 2013 Share Posted August 18, 2013 "Aono" name="" version="1.0" type="script"/> Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 no functiona mejor tratare de hacer un panel de freeroam para admins Link to comment
Daniel1zD Posted August 18, 2013 Share Posted August 18, 2013 que te sale en debugscript 3 ? Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 SCRIPT ERROR: autosadmin\server.lua:6: syntax error near ´then´ WARNING: Loading script failed: autosadmin\server.lua:6: syntax error near ´then´ start: Resource ´autosadmin´ started Link to comment
AlvareZ_ Posted August 18, 2013 Share Posted August 18, 2013 function infernus(thePlayer) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then Object1 = createVeichle(411, x, y, z-1)--- ID del auto outputChatBox("creaste el auto", thePlayer, 0, 250, 0) elseif (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(Object1, vehicle) end end addCommandHandler("auto", infernus) function infernus(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then elseif (isElement(Object1)) then destroyElement(Object1) outputChatBox("destruido", thePlayer, 0, 0, 255) else outputChatBox("destruido", thePlayer, 250, 0, 0) end end addCommandHandler("destroy", infernus) Link to comment
FraN-724 Posted August 18, 2013 Share Posted August 18, 2013 Pusieron createVeichle, Aono intenta esto: function infernus(thePlayer) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then Object1 = createVehicle(411, x, y, z-1)--- ID del auto outputChatBox("creaste el auto", thePlayer, 0, 250, 0) elseif (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(Object1, vehicle) end end addCommandHandler("auto", infernus) function infernus(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then elseif (isElement(Object1)) then destroyElement(Object1) outputChatBox("destruido", thePlayer, 0, 0, 255) else outputChatBox("destruido", thePlayer, 250, 0, 0) end end addCommandHandler("destroy", infernus) Link to comment
AlvareZ_ Posted August 18, 2013 Share Posted August 18, 2013 Sucia no me di cuenta de eso, Jum >< Link to comment
FraN-724 Posted August 18, 2013 Share Posted August 18, 2013 Sucia no me di cuenta de eso, Jum >< Hahaha abre los ojos -.- Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 No me funciona dice WARNING: autosadmin\server.lua:3: Bad argument @ ´getPlayerAccount´ [Expected element at argument 1, got nil] autosadmin\server.lua:3: Bad argument @ ´getAccountName´ [Expected account at argument 1, got boolean] ERROR: autosadmin\server.lua:3: attempt to concatenate a boolean value Y no tengo la menor idea de que significa Link to comment
Daniel1zD Posted August 18, 2013 Share Posted August 18, 2013 No me funciona dice WARNING: autosadmin\server.lua:3: Bad argument @ ´getPlayerAccount´ [Expected element at argument 1, got nil] autosadmin\server.lua:3: Bad argument @ ´getAccountName´ [Expected account at argument 1, got boolean] ERROR: autosadmin\server.lua:3: attempt to concatenate a boolean value Y no tengo la menor idea de que significa aveses llegan a salir los mensajes , se pudo crear el auto con el guion que te dio Frank ? Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 Ese intente, pero tampoco Link to comment
MTA Team 0xCiBeR Posted August 18, 2013 MTA Team Share Posted August 18, 2013 El error radica en que la variable de getPlayerAccount la setearon a source, cuando en la funcion la estan definiendo como thePlayer Ademas estan definiendo ambas funciones con el mismo nombre. Tambien attachElements es bizzaro. Y te falto la funcion que te mete dentro del auto recien creado. Y agregan -1 a la coordenada Z lo cual meteran el auto parcialmente en la tierra. Usa esto:(no esta probado) function infernus(thePlayer) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then if (isPedInVehicle(thePlayer)) then outputChatBox("Sal de tu auto actual", thePlayer, 0, 250, 0) end Object1 = createVehicle(411, x+2, y+2, z)--- ID del auto outputChatBox("creaste el auto", thePlayer, 0, 250, 0) warpPedIntoVehicle (thePlayer,Object1) end end addCommandHandler("auto", infernus) function destruir(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then if (isElement(Object1)) then destroyElement(Object1) outputChatBox("destruido", thePlayer, 0, 0, 255) else outputChatBox("Error, auto inexistente", thePlayer, 250, 0, 0) end end end addCommandHandler("destroy", destruir) Link to comment
AlvareZ_ Posted August 18, 2013 Share Posted August 18, 2013 Tenias Muchos errores, Prueba Esto: addCommandHandler("auto", function (thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) and (isPedInVehicle(thePlayer)) then outputChatBox("Sal de tu auto actual", thePlayer, 0, 250, 0) else local x, y, z = getElementPosition(thePlayer) Object1 = createVehicle(411, x+2, y+2, z)--- ID del auto outputChatBox("Auto creado con Exito!", thePlayer, 0, 250, 0) warpPedIntoVehicle (thePlayer,Object1) end end ) addCommandHandler("destroy", function (thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) and (isElement(Object1)) then destroyElement(Object1) outputChatBox("Auto Destruido", thePlayer, 0, 0, 255) else outputChatBox("Error, auto inexistente", thePlayer, 250, 0, 0) end end ) Link to comment
Sasu Posted August 18, 2013 Share Posted August 18, 2013 Si tu quieres que el auto se destruya cuando el conductor salga, que en este caso seria el administrador que lo aparecio, se destruya. local adminVehicle = {} function infernus(thePlayer, cmdName) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then if (isPedInVehicle(thePlayer)) then outputChatBox("Sal de tu auto actual ( "..getVehicleName(getPedOccupiedVehicle(thePlayer)).." )", thePlayer, 0, 250, 0) else adminVehicle[thePlayer] = createVehicle(411, x+2, y+2, z)--- ID del auto if adminVehicle[thePlayer] then outputChatBox("Creaste el auto", thePlayer, 0, 250, 0) warpPedIntoVehicle(thePlayer, adminVehicle[thePlayer]) else outputChatBox("Ha ocurrido un error al crear el vehiculo. Revisa bien los argumentos", thePlayer, 255, 0, 0) end end else outputChatBox("Tu no eres del grupo ACL 'Admin' por lo tanto no puedes usar este comando. ( /"..cmdName.." )", thePlayer, 255, 0, 0) end end addCommandHandler("auto", infernus) function destroyAdminVehicle(thePlayer, seat) if adminVehicle[thePlayer] and source == adminVehicle[thePlayer] and seat == 0 then outputChatBox("Tu vehiculo '"..getVehicleName(source).."' ha sido destruido", thePlayer, 0, 255, 0) destroyElement(source) adminVehicle[thePlayer] = nil end end addEventHandler("onVehicleExit", root, destroyAdminVehicle) Link to comment
Aono Posted August 18, 2013 Author Share Posted August 18, 2013 Alvarez, el tuyo funciono, pero no lo destruia, y el de Sasuke ya funciono, gracias Link to comment
Recommended Posts