Jump to content

Name


Arsilex

Recommended Posts

Posted

Hola me gustaria saber como puede hacer un comando que se use asi

addCommandHandler ("Hola", 
function (source, commandName, name) 
  
Juugador1= getPlayerName (source) 
Jugador2 =-- SACAR EL NOMBRE DE JUGADOR DE NAME JEMPLO: si el name es AsuS que al poner asu ya funcione ya saque el --name entero 
  
--y que eso salga en el chat usanto tostring 
  
end 
) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

No te entendì mucho pero creo que es esto

function nombre () 
outputChatBox("Tu nombre es: "..getPlayerName(playerSource), playerSource) 
end 
addCommandHandler("hola", nombre) 

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

Posted

No le entendiste.

addCommandHandler ( "Hola", 
    function ( source, commandName, name ) 
        Jugador1 = getPlayerName ( source ) 
        Jugador2 = getPlayerFromNamePart ( name ) 
        if ( Jugador2 ) then 
            outputChatBox ( Jugador1 ..": ".. getPlayerName ( Jugador2 ), source ) 
        end 
    end 
) 
  
function getPlayerFromNamePart(name) 
    if name then  
        for i, player in ipairs(getElementsByType("player")) do 
            if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then 
                return player  
            end 
        end 
    end 
    return false 
end 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
No le entendiste.
addCommandHandler ( "Hola", 
    function ( source, commandName, name ) 
        Jugador1 = getPlayerName ( source ) 
        Jugador2 = getPlayerFromNamePart ( name ) 
        if ( Jugador2 ) then 
            outputChatBox ( Jugador1 ..": ".. getPlayerName ( Jugador2 ), source ) 
        end 
    end 
) 
  
function getPlayerFromNamePart(name) 
    if name then  
        for i, player in ipairs(getElementsByType("player")) do 
            if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then 
                return player  
            end 
        end 
    end 
    return false 
end 

thx castillo eso me sirvió :D

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

tengo otro problema que es que al poner por ejemplo yo ponga hola castillo pues lo que quiero es que con otro comando por ejemplo hola2 solo con eso sin name enviarle el mensaje de vuelta al jugador que me mando hola

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Vas a tener que crear una tabla y guardar ahi.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

crea una tabla

local la_masturbanda = {} 
  
addCommandHandler ( "Hola", 
    function ( source, commandName, name ) 
        Jugador1 = getPlayerName ( source ) 
        Jugador2 = getPlayerFromNamePart ( name ) 
        if ( Jugador2 ) then 
            la_masturbanda[Jugador1] = Jugador2 
            outputChatBox ( Jugador1 ..": ".. getPlayerName ( Jugador2 ), Jugador2 ) 
            outputChatBox( "mensaje enviado", source) 
        end 
    end 
) 
  
addCommandHandler("Hola2",  
function(source) 
     outputChatBox(getPlayerName(source) .. " quiere hablar con vos ", la_masturbanda[source]) 
end ) 
  
function getPlayerFromNamePart(name) 
    if name then 
        for i, player in ipairs(getElementsByType("player")) do 
            if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then 
                return player 
            end 
        end 
    end 
    return false 
end 

  • Recently Browsing   0 members

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