func_tankmortar

Hello,
I was hoping someone could help me out. I have been messing with lua for the past 8 hours with my extremely basic understanding of lua, trying to create a command that fires a combine mortar down onto the player specified in the command. After failing with the mortar part initially, I began looking at people’s SWEPs on garrysmod.org and someone’s tool on the workshop to try and work from there. I still failed.


concommand.Add( "suppress", function( ply, cmd, args ) 
    if not ply:IsSuperAdmin() then ply:ChatPrint( "You do not have access to this command." ) return end
 
    local playr = args[1]
 
    if not playr then ply:ChatPrint( "Incorrect Syntax" ) return end
 
    local user = nil
 
    for _, v in pairs( player.GetAll() ) do
        if string.find( string.lower( v:Nick() ), string.lower( playr ) ) then
            user = v
			local mortar = ents.Create("func_tankmortar")
			mortar:SetPos(user.GetPos() + Vector( 0, 0, 1 ))
			mortar:SetAngles( Angle( 90, 0, 0 ) )
			mortar:SetKeyValue( "iMagnitude", 100 )
			mortar:SetKeyValue( "firedelay", "1" )
			mortar:SetKeyValue( "warningtime", "1" )
			mortar:SetKeyValue( "incomingsound", "Weapon_Mortar.Incomming" ).
                       	mortar:SetKeyValue("firestartsound" , "Weapon_Mortar.Single")

			mortar:Spawn()
			mortar:Fire( "SetTargetEntity", user, 0 )
			mortar:Fire( "Activate", "", 0 )
			mortar:Fire( "FireAtWill", "", 0 )
			mortar:Fire( "Deactivate", "", 2 )
			mortar:Fire( "kill", "", 2 )

        end
    end
 
    if not user then ply:ChatPrint( "No players found" ) return end
 
end )

If anyone could help me, please do.
Thanks

What’s your error?

Do user:GetPos() instead of user.GetPos()

Sorry, Got sent to the hospital for popping a vein in my head. Who knew lua coding could be dangerous?