Jump to content

[HELP]About addCommandHandler.


irinel1996

Recommended Posts

Hi!

I've made a command, /LSA.

But it only work's when I type /LSA with capital letters.

I want to make it work in the same command, albeit with lower case letters. =/

Here is the first line:

addCommandHandler("LSA",function(thePlayer) 

I don't want make another command with case letters.

Thanks all!

Edited by Guest
Link to comment

Read the wiki, you can make it ignore the case of the command.

addCommandHandler("LSA",function(thePlayer) ... end, false, false) 

First false is for restricted access, just ignore that and put the default value (false)

Second false is for case-insensitive

Edit: Ah, no offense intended JR10 ^^.

I was replying to the TS that he should read the addCommandHandler wikipage for more info.

Edited by Guest
Link to comment

Well, I have 2 errors and one warning, look:

SCRIPT ERROR: play\MSN_S.lua:35: unexpected symbol near '...' 
WARNING: Loading script failed play\MSN_S.lua:35:  unexpected symbol near '...' 
ERROR: Client triggered serverside event RequestServerData, but event is not added serverside. 

Here you have the "FULL" command:

addCommandHandler("LSA",function(thePlayer) ... end, false, false) 
    if(isPedInVehicle(thePlayer)) then 
        local theVehicle = getPedOccupiedVehicle(thePlayer) 
        setElementPosition(theVehicle,1907.1351318359,-2491.1325683594,13.217620849609) 
    else 
        setElementPosition(thePlayer,1907.1351318359,-2491.1325683594,13.217620849609) 
    end 
end) 

PD: I put it in my server.lua

Sorry, I'm new in MTA. :|

___________

Thanks!

Link to comment
addCommandHandler("LSA",function(thePlayer) 
    if (isPedInVehicle(thePlayer)) then 
        local theVehicle = getPedOccupiedVehicle(thePlayer) 
        setElementPosition(theVehicle,1907.1351318359,-2491.1325683594,13.217620849609) 
    else 
        setElementPosition(thePlayer,1907.1351318359,-2491.1325683594,13.217620849609) 
    end 
end,false,false) 

Link to comment

Ah, if you're new I'd recommend not doing it that way (but it is correct tho!)

function LSA_Command123(thePlayer)    -- first create the function 'LSA_Command123' (you can rename it) 
    if (isPedInVehicle(thePlayer)) then 
        local theVehicle = getPedOccupiedVehicle(thePlayer) 
        setElementPosition(theVehicle,1907.1351318359,-2491.1325683594,13.217620849609) 
    else 
        setElementPosition(thePlayer,1907.1351318359,-2491.1325683594,13.217620849609) 
    end 
end 
  
-- then attach a command to the function 
addCommandHandler("LSA", LSA_Command123,false,false) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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