Jump to content

Quién me da un pequeño empujoncito?


iiKings

Recommended Posts

Posted

Hola,

Bueno, esto me da un poco de vergüenza :oops:, pero me estoy iniciando en scripting (Castillo me inspira :lol: ), Me gustaría aprender, y alguien que me ayude, por ahora estoy mirando para que sirve cada cosa, pero me gustaria que alguien me ayudara, aunque LA MAYORÍA lo hacen por dinero, y eso ami me suena a no querer hacer crecer a las personas, aunque sea poco tiempo al día para ir preguntando, porque ahora que lo veo Me encanta el scripting en mta, Primero ví el server de serginix, por cierto Buenisimo, y ahora el de Castillo, que aquí en el foro se llama SolidSnake y me quede sorprendido.

El tema viene a si a alguien le gustaria ayudarme, porque estoy medio perdido, aunque sea como empezar o algo, y la wiki no sirve de mucho, ami me sirve (como mucho) para saber que sirve cada cosa pero nada mas...

Por eso vengo pidiendo esto xD, y la verdad esque agradeceria mucho que me ayudara alguien.

SALUDOS,

RECUERDA, SOLO UN EMPUJONCITO, ME HARÁ CRECER xD

  • MTA Team
Posted

Lo esencial para comenzar es entender 3 puntos claves:

1-) que es un lenguaje de programacion

2-)que es lua y cuales son sus sintaxis

3-)Como se aplica LUA en MTA (funciones propias de este, eventos propios de este, etc..)

Posted
function spawnVehicles ( thePlayer, commandName, theModel ) 
    local theModel = tonumber ( theModel ) 
    if ( theModel ) then 
        local x, y, z = getElementPosition ( thePlayer ) 
        local theVehicle = createVehicle ( theModel, x, y, z ) 
        if ( theVehicle ) then 
            warpPedIntoVehicle ( thePlayer, theVehicle ) 
        end 
    end 
end 
addCommandHandler ( "spawnveh", spawnVehicles ) 

donde pone the model, y esas cosas, hay que rellenarlas con los modelos y esas cosas?

Posted

Se llaman argumentos, no tenes que cambiarlos para que ESE script funcione, ya que el punto es que puedas elegir el modelo que queres para el coche que se va a crear con el comando.

Posted

Vale, hasta ahora he creado estos 2 scripts y ninguno de ellos funciona, no se si es por el directorio pero necesito ayuda xD

Direcrotio:

C:\Program Files\MTA San Andreas 1.3\server\mods\deathmatch\resources\projects

Ped(hecho por mi):

function pedLoad ( name ) 
   createPed ( 120, 5540.6654, 1020.55122, 1240.545 ) 
    outputChatBox ( "Hello and welcome.", getRootElement(), 255, 0, 0, true ) 
   bool  setPedFightingStyle  (  ped Boxing, int 5 ) 
   end 
addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) 

Posicion (Copiado de un video de youtube):

Addcommandhandler ("pos", 
x,y,z = getElementPosition (source) 
xr,yr,zr = getElementRotation (source) 
Dimension = getElementDimension (souce) 
Interior = getElementInterior (source) 
  
outputChatBox (" Tu posicion es:"..x.." "..y.." "..z, source, 0, 255,0,true ) 
outputChatBox (" Tu rotacion es:"..xr.." "..yr.." "..zr, source, 0, 255,0,true ) 
outputChatBox (" Tu dimension es:"..dimension, source, 0, 255,0,true ) 
outputChatBox (" Tu interior es:"..Interior, source, 0, 255,0,true ) 
  
end 
) 

Pense que iva a ser cosa de otro mundo, y realmente no es tan dificil como pense que lo iva a ser...

Posted

El primero esta mal, pusiste "bool" y "int", pero no son necesarios, ademas de que "Boxing" no es un estilo de pelea valido y ped no esta definido.

En el segundo, pusiste "Addcommandhandler", esa funcion no existe, y lua no es case-sensitive asi que tenes que ponerlo como es, osea: "addCommandHandler".

Tambien te olvidaste de crear la funcion en si.

Posted

ayf5yPX.png

Vamos mejorando xD..., lo hize yo e.e

    addEventHandler( "onClientResourceStart", resourceRoot, 
        function() 
        setSkyGradient( 0, 0, 0, 99, 11, 5 ) 
        setSunSize( 2 ) 
        setWeather (10) 
        end 
    ) 
     
    addEventHandler( "onClientResourceStop", resourceRoot, 
        function() 
        resetSkyGradient() 
        resetSunSize () 
        end 
    ) 

Algo le copie a El_Zoro xD

Posted

que le pasa a esto, cuando pongo el comando puerta se duplica una roca, se supone que se debe de subir hacia arriba pero se duplica, y no funciona bien.

object = createObject ( 17029, 244.89999389648, 2916.3000488281, 27.39999961853, 90, 0, 0 ) 
addCommandHandler("Puerta", 
function (source) 
if getElementData ( source, "Puerta" ) == "ON" then 
moveObject ( Object, 17029, 244.89999389648, 2916.3000488281, 0 ) 
setElementData (source, "Puerta", "OFF") 
elseif getElementData ( source, "Puerta" ) == "OFF" then 
moveObject ( Object, 17029, 244.89999389648, 2916.3000488281, 27.39999961853 ) 
setElementData (source, "Puerta", "ON") 
end 
end 
) 

Posted

[lua]object = createObject ( 17029, 244.89999389648, 2916.3000488281, 27.39999961853, 90, 0, 0 )

addCommandHandler("Puerta",

function (source)

if getElementData ( source, "Puerta" ) == "ON" then

moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 0 )

setElementData (source, "Puerta", "OFF")

elseif getElementData ( source, "Puerta" ) == "OFF" then

moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 27.39999961853 )

setElementData (source, "Puerta", "ON")

end

end

)lua]

Castillo, sigue sin funcionarme, ahora no funciona ni el comando, puedes corregirmelo tu?

Posted
object = createObject ( 17029, 244.89999389648, 2916.3000488281, 27.39999961853, 90, 0, 0 ) 
state = false 
  
addCommandHandler ( "puerta", 
    function ( source ) 
        if ( state == true ) then 
            moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 0 ) 
            state = false 
        else 
            moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 27.39999961853 ) 
            state = true 
        end 
    end 
) 

Posted
object = createObject ( 17029, 244.89999389648, 2916.3000488281, 27.39999961853, 90, 0, 0 ) 
state = false 
  
addCommandHandler ( "puerta", 
    function ( source ) 
        if ( state == true ) then 
            moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 0 ) 
            state = false 
        else 
            moveObject ( object, 17029, 244.89999389648, 2916.3000488281, 27.39999961853 ) 
            state = true 
        end 
    end 
) 

Simplemente y para mi, THE BOSS!

PD: Quiero un hijo tuyo ;) xDD

Posted
function asd() 
        arma = guiCreateWindow(322, 130, 190, 227, "Arma", false) 
        guiWindowSetSizable(arma, false) 
  
        MP5 = guiCreateButton(29, 68, 139, 113, "MP5", false, arma)     
    end 
  
addCommandHandler ("mp5", asd) 

al poner mp5 no funciona :S

Posted

Ahora ya no me da el arma xD

Meta:

    

Zombie.lua (client)

    function asd() 
        arma = guiCreateWindow(322, 130, 190, 227, "Arma", false) 
        guiWindowSetSizable(arma, false) 
  
        MP5 = guiCreateButton(29, 68, 139, 113, "MP5", false, arma)     
     
    showCursor (true) 
    addEventHandler ( "onClientGUIClient", mp5, mp55, false ) 
    end 
  
addCommandHandler ("mp5", asd) 
  
function mp55 () 
showCursor (true) 
triggerServerEvent ( "onGreeting", getLocalPlayer() )  
end 

server.lua(server)

function greetingHandler () 
    
 giveWeapon ( source, 29, 200 )  
  
end 
   addEvent( "onGreeting", true ) 
    addEventHandler( "onGreeting", getRootElement(), greetingHandler ) 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...