Jump to content

I need help ?


Recommended Posts

  • Moderators
Posted

first code, then help...

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

mysql = exports.mysql

local getPlayerName_ = getPlayerName

getPlayerName = function( ... )

s = getPlayerName_( ... )

return s and s:gsub( "_", " " ) or s

end

--/MINFO

function adminUncuff(thePlayer, commandName, targetPlayer)

if (exports.global:isPlayerAdmin(thePlayer)) then

if not (targetPlayer) then

outputChatBox("SYNTAX: /" .. commandName .. " [info Text]", thePlayer, 255, 194, 14)

end

addCommandHandler("minfo", adminminfo, false, false)

(Alright I dont know what to do from here :/)

Posted
wtf :lol:

try this

local x,y,z = getElementPosition( source ) 
  
addCommandHandler( "info", 
function (thePlayer, commandName, id) 
    if (tonumber(id)) then 
    createObject(id, y, x, z - 1) 
    end 
end 
)    

source is not defined .

  

Posted
wtf :lol:

try this

local x,y,z = getElementPosition( source ) 
  
addCommandHandler( "info", 
function (thePlayer, commandName, id) 
    if (tonumber(id)) then 
    createObject(id, y, x, z - 1) 
    end 
end 
)    

source is not defined .

Thanks for warn, but are the rest right?

local x,y,z = getElementPosition( thePlayer ) 
  
addCommandHandler( "info", 
function (thePlayer, commandName, id) 
    if getElementType(thePlayer) == "player" then 
        if (tonumber(id)) then 
        createObject(id, y, x, z - 1) 
        end 
    end 
end 
)    

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted
wtf :lol:

try this

local x,y,z = getElementPosition( source ) 
  
addCommandHandler( "info", 
function (thePlayer, commandName, id) 
    if (tonumber(id)) then 
    createObject(id, y, x, z - 1) 
    end 
end 
)    

source is not defined .

Thanks for warn, but are the rest right?

local x,y,z = getElementPosition( thePlayer ) 
  
addCommandHandler( "info", 
function (thePlayer, commandName, id) 
    if getElementType(thePlayer) == "player" then 
        if (tonumber(id)) then 
        createObject(id, y, x, z - 1) 
        end 
    end 
end 
)    

No it's not .

  

  • 2 weeks later...
Posted

Whats wrong with this?

  
function createinfop(thePlayer, commandName, id) 
    if not dep then 
        outputChatBox("SYNTAX: /" .. commandName .. " [TEXT]", thePlayer, 255, 194, 14) 
    else 
        if (exports.global:isPlayerLeadAdmin(thePlayer)) or exports.global:isPlayerScripter(thePlayer) then 
            local dimension = getElementDimension(thePlayer) 
            local interior = getElementInterior(thePlayer) 
            local x, y, z  = getElementPosition(thePlayer) 
            local rotation = getPedRotation(thePlayer) 
            local id = tonumber(id) 
             
            z = z - 0.3 
             
            local id = mysql:query_insert_free("INSERT INTO infopoints SET x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .. "', z='" .. mysql:escape_string(z) .. "', dimension='" .. mysql:escape_string(dimension) .. "', interior='" .. mysql:escape_string(interior) .. "', rotation='" .. mysql:escape_string(rotation) .. "', `id`='" .. mysql:escape_string(limit) .."'") 
                     
            local x,y,z = getElementPosition( source ) 
  
    addCommandHandler( "info", 
    function (thePlayer, commandName, id) 
    if (tonumber(id)) then 
    createObject(id, y, x, z - 1) 
    end 
    end 
    ) 
  

Posted

Things that's wrong or unknown to us:

  • Variable "dep" isn't defined (Line 2)
  • Variable "id" is already defined you can't localize it (Line 11 and Line 14)
  • "source" isn't defined (Line 16)
  • "id" needs to be converted into a number (Line 19)

BTW, What are you trying to do in this script?

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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...